1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 02:47:34 +00:00

Everywhere: Rename ASSERT => VERIFY

(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
This commit is contained in:
Andreas Kling 2021-02-23 20:42:32 +01:00
parent b33a6a443e
commit 5d180d1f99
725 changed files with 3448 additions and 3448 deletions

View file

@ -125,8 +125,8 @@ void Mixer::mix()
stream << out_sample;
}
ASSERT(stream.is_end());
ASSERT(!stream.has_any_error());
VERIFY(stream.is_end());
VERIFY(!stream.has_any_error());
m_device->write(stream.data(), stream.size());
}
}

View file

@ -40,7 +40,7 @@ int main(int, char**)
auto server = Core::LocalServer::construct();
bool ok = server->take_over_from_system_server();
ASSERT(ok);
VERIFY(ok);
server->on_ready_to_accept = [&] {
auto client_socket = server->accept();
if (!client_socket) {

View file

@ -41,10 +41,10 @@ void ChessEngine::handle_uci()
void ChessEngine::handle_position(const PositionCommand& command)
{
// FIXME: Implement fen board position.
ASSERT(!command.fen().has_value());
VERIFY(!command.fen().has_value());
m_board = Chess::Board();
for (auto& move : command.moves()) {
ASSERT(m_board.apply_move(move));
VERIFY(m_board.apply_move(move));
}
}
@ -52,7 +52,7 @@ void ChessEngine::handle_go(const GoCommand& command)
{
// FIXME: A better algorithm than naive mcts.
// FIXME: Add different ways to terminate search.
ASSERT(command.movetime.has_value());
VERIFY(command.movetime.has_value());
srand(arc4random());

View file

@ -51,13 +51,13 @@ MCTSTree& MCTSTree::select_leaf()
node = &child;
}
}
ASSERT(node);
VERIFY(node);
return node->select_leaf();
}
MCTSTree& MCTSTree::expand()
{
ASSERT(!expanded() || m_children.size() == 0);
VERIFY(!expanded() || m_children.size() == 0);
if (!m_moves_generated) {
m_board.generate_moves([&](Chess::Move move) {
@ -78,12 +78,12 @@ MCTSTree& MCTSTree::expand()
return child;
}
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
int MCTSTree::simulate_game() const
{
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
Chess::Board clone = m_board;
while (!clone.game_finished()) {
clone.apply_move(clone.random_move());
@ -135,7 +135,7 @@ Chess::Move MCTSTree::best_move() const
Chess::Move best_move = { { 0, 0 }, { 0, 0 } };
double best_score = -double(INFINITY);
ASSERT(m_children.size());
VERIFY(m_children.size());
for (auto& node : m_children) {
double node_score = node.expected_value() * score_multiplier;
if (node_score >= best_score) {

View file

@ -48,7 +48,7 @@ int main(int, char**)
auto server = Core::LocalServer::construct();
bool ok = server->take_over_from_system_server();
ASSERT(ok);
VERIFY(ok);
if (pledge("stdio recvfd sendfd accept", nullptr) < 0) {
perror("pledge");

View file

@ -40,7 +40,7 @@ static void wait_until_coredump_is_ready(const String& coredump_path)
struct stat statbuf;
if (stat(coredump_path.characters(), &statbuf) < 0) {
perror("stat");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (statbuf.st_mode & 0400) // Check if readable
break;
@ -92,7 +92,7 @@ int main()
Core::BlockingFileWatcher watcher { "/tmp/coredump" };
while (true) {
auto event = watcher.wait_for_event();
ASSERT(event.has_value());
VERIFY(event.has_value());
if (event.value().type != Core::FileWatcherEvent::Type::ChildAdded)
continue;
auto coredump_path = event.value().child_path;

View file

@ -269,9 +269,9 @@ public:
void add_option(DHCPOption option, u8 length, const void* data)
{
ASSERT(m_can_add);
VERIFY(m_can_add);
// we need enough space to fit the option value, its length, and its data
ASSERT(next_option_offset + length + 2 < DHCPV4_OPTION_FIELD_MAX_LENGTH);
VERIFY(next_option_offset + length + 2 < DHCPV4_OPTION_FIELD_MAX_LENGTH);
auto* options = peek().options();
options[next_option_offset++] = (u8)option;

View file

@ -126,7 +126,7 @@ DHCPv4Client::DHCPv4Client(Vector<InterfaceDescriptor> ifnames)
if (!m_server->bind({}, 68)) {
dbgln("The server we just created somehow came already bound, refusing to continue");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
for (auto& iface : m_ifnames)
@ -233,7 +233,7 @@ void DHCPv4Client::process_incoming(const DHCPv4Packet& packet)
case DHCPMessageType::DHCPDecline:
default:
dbgln("I dunno what to do with this {}", (u8)value);
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
break;
}
}

View file

@ -45,7 +45,7 @@ static u8 mac_part(const Vector<String>& parts, size_t index)
static MACAddress mac_from_string(const String& str)
{
auto chunks = str.split(':');
ASSERT(chunks.size() == 6); // should we...worry about this?
VERIFY(chunks.size() == 6); // should we...worry about this?
return {
mac_part(chunks, 0), mac_part(chunks, 1), mac_part(chunks, 2),
mac_part(chunks, 3), mac_part(chunks, 4), mac_part(chunks, 5)

View file

@ -85,13 +85,13 @@ String Handler::to_details_str() const
Launcher::Launcher()
{
ASSERT(s_the == nullptr);
VERIFY(s_the == nullptr);
s_the = this;
}
Launcher& Launcher::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}

View file

@ -48,7 +48,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
}
bool ok = server->take_over_from_system_server();
ASSERT(ok);
VERIFY(ok);
server->on_ready_to_accept = [&] {
auto client_socket = server->accept();
if (!client_socket) {

View file

@ -41,14 +41,14 @@ void DNSPacket::add_question(const DNSQuestion& question)
{
m_questions.empend(question);
ASSERT(m_questions.size() <= UINT16_MAX);
VERIFY(m_questions.size() <= UINT16_MAX);
}
void DNSPacket::add_answer(const DNSAnswer& answer)
{
m_answers.empend(answer);
ASSERT(m_answers.size() <= UINT16_MAX);
VERIFY(m_answers.size() <= UINT16_MAX);
}
ByteBuffer DNSPacket::to_byte_buffer() const

View file

@ -69,13 +69,13 @@ public:
u16 question_count() const
{
ASSERT(m_questions.size() <= UINT16_MAX);
VERIFY(m_questions.size() <= UINT16_MAX);
return m_questions.size();
}
u16 answer_count() const
{
ASSERT(m_answers.size() <= UINT16_MAX);
VERIFY(m_answers.size() <= UINT16_MAX);
return m_answers.size();
}

View file

@ -47,13 +47,13 @@ static LookupServer* s_the;
LookupServer& LookupServer::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
LookupServer::LookupServer()
{
ASSERT(s_the == nullptr);
VERIFY(s_the == nullptr);
s_the = this;
auto config = Core::ConfigFile::get_for_system("LookupServer");
@ -79,7 +79,7 @@ LookupServer::LookupServer()
IPC::new_client_connection<ClientConnection>(socket.release_nonnull(), client_id);
};
bool ok = m_local_server->take_over_from_system_server();
ASSERT(ok);
VERIFY(ok);
}
void LookupServer::load_etc_hosts()

View file

@ -44,7 +44,7 @@ int main(int argc, char** argv)
auto server = Core::LocalServer::construct();
bool ok = server->take_over_from_system_server();
ASSERT(ok);
VERIFY(ok);
server->on_ready_to_accept = [&] {
auto client_socket = server->accept();
if (!client_socket) {

View file

@ -103,7 +103,7 @@ void ClientConnection::did_receive_headers(Badge<Download>, Download& download)
void ClientConnection::did_finish_download(Badge<Download>, Download& download, bool success)
{
ASSERT(download.total_size().has_value());
VERIFY(download.total_size().has_value());
post_message(Messages::ProtocolClient::DownloadFinished(download.id(), success, download.total_size().value()));

View file

@ -49,7 +49,7 @@ Protocol::Protocol(const String& name)
Protocol::~Protocol()
{
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
Result<Protocol::Pipe, String> Protocol::get_pipe_for_download()

View file

@ -63,7 +63,7 @@ int main(int, char**)
[[maybe_unused]] auto https = new ProtocolServer::HttpsProtocol;
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
ASSERT(socket);
VERIFY(socket);
IPC::new_client_connection<ProtocolServer::ClientConnection>(socket.release_nonnull(), 1);
return event_loop.exec();
}

View file

@ -82,7 +82,7 @@ OwnPtr<Messages::SymbolServer::SymbolicateResponse> ClientConnection::handle(con
}
auto it = s_cache.find(path);
ASSERT(it != s_cache.end());
VERIFY(it != s_cache.end());
auto& cached_elf = it->value;
if (!cached_elf)

View file

@ -63,7 +63,7 @@ int main(int, char**)
}
bool ok = server->take_over_from_system_server();
ASSERT(ok);
VERIFY(ok);
server->on_ready_to_accept = [&] {
auto client_socket = server->accept();
if (!client_socket) {

View file

@ -190,7 +190,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
auto& theme = g_themes[theme_identifier];
dbgln("Theme switched to {} at path {}", theme.name, theme.path);
auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name);
ASSERT(response->success());
VERIFY(response->success());
});
if (theme.name == current_theme_name)
action->set_checked(true);

View file

@ -53,11 +53,11 @@ Service* Service::find_by_pid(pid_t pid)
void Service::setup_socket()
{
ASSERT(!m_socket_path.is_null());
ASSERT(m_socket_fd == -1);
VERIFY(!m_socket_path.is_null());
VERIFY(m_socket_fd == -1);
auto ok = Core::File::ensure_parent_directories(m_socket_path);
ASSERT(ok);
VERIFY(ok);
// Note: we use SOCK_CLOEXEC here to make sure we don't leak every socket to
// all the clients. We'll make the one we do need to pass down !CLOEXEC later
@ -65,47 +65,47 @@ void Service::setup_socket()
m_socket_fd = socket(AF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
if (m_socket_fd < 0) {
perror("socket");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (m_account.has_value()) {
auto& account = m_account.value();
if (fchown(m_socket_fd, account.uid(), account.gid()) < 0) {
perror("fchown");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
if (fchmod(m_socket_fd, m_socket_permissions) < 0) {
perror("fchmod");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
auto socket_address = Core::SocketAddress::local(m_socket_path);
auto un_optional = socket_address.to_sockaddr_un();
if (!un_optional.has_value()) {
dbgln("Socket name {} is too long. BUG! This should have failed earlier!", m_socket_path);
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
auto un = un_optional.value();
int rc = bind(m_socket_fd, (const sockaddr*)&un, sizeof(un));
if (rc < 0) {
perror("bind");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
rc = listen(m_socket_fd, 16);
if (rc < 0) {
perror("listen");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
void Service::setup_notifier()
{
ASSERT(m_lazy);
ASSERT(m_socket_fd >= 0);
ASSERT(!m_socket_notifier);
VERIFY(m_lazy);
VERIFY(m_socket_fd >= 0);
VERIFY(!m_socket_notifier);
m_socket_notifier = Core::Notifier::construct(m_socket_fd, Core::Notifier::Event::Read, this);
m_socket_notifier->on_ready_to_read = [this] {
@ -134,7 +134,7 @@ void Service::handle_socket_connection()
void Service::activate()
{
ASSERT(m_pid < 0);
VERIFY(m_pid < 0);
if (m_lazy)
setup_notifier();
@ -158,7 +158,7 @@ void Service::spawn(int socket_fd)
if (!m_working_directory.is_null()) {
if (chdir(m_working_directory.characters()) < 0) {
perror("chdir");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -167,16 +167,16 @@ void Service::spawn(int socket_fd)
int rc = sched_setparam(0, &p);
if (rc < 0) {
perror("sched_setparam");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (!m_stdio_file_path.is_null()) {
close(STDIN_FILENO);
int fd = open(m_stdio_file_path.characters(), O_RDWR, 0);
ASSERT(fd <= 0);
VERIFY(fd <= 0);
if (fd < 0) {
perror("open");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
dup2(STDIN_FILENO, STDOUT_FILENO);
dup2(STDIN_FILENO, STDERR_FILENO);
@ -193,14 +193,14 @@ void Service::spawn(int socket_fd)
close(STDERR_FILENO);
int fd = open("/dev/null", O_RDWR);
ASSERT(fd == STDIN_FILENO);
VERIFY(fd == STDIN_FILENO);
dup2(STDIN_FILENO, STDOUT_FILENO);
dup2(STDIN_FILENO, STDERR_FILENO);
}
if (socket_fd >= 0) {
ASSERT(!m_socket_path.is_null());
ASSERT(socket_fd > 3);
VERIFY(!m_socket_path.is_null());
VERIFY(socket_fd > 3);
dup2(socket_fd, 3);
// The new descriptor is !CLOEXEC here.
setenv("SOCKET_TAKEOVER", "1", true);
@ -226,7 +226,7 @@ void Service::spawn(int socket_fd)
rc = execv(argv[0], argv);
perror("exec");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
} else if (!m_multi_instance) {
// We are the parent.
m_pid = pid;
@ -236,8 +236,8 @@ void Service::spawn(int socket_fd)
void Service::did_exit(int exit_code)
{
ASSERT(m_pid > 0);
ASSERT(!m_multi_instance);
VERIFY(m_pid > 0);
VERIFY(!m_multi_instance);
dbgln("Service {} has exited with exit code {}", name(), exit_code);
@ -271,7 +271,7 @@ void Service::did_exit(int exit_code)
Service::Service(const Core::ConfigFile& config, const StringView& name)
: Core::Object(nullptr)
{
ASSERT(config.has_group(name));
VERIFY(config.has_group(name));
set_name(name);
m_executable_path = config.read_entry(name, "Executable", String::formatted("/bin/{}", this->name()));
@ -286,7 +286,7 @@ Service::Service(const Core::ConfigFile& config, const StringView& name)
else if (prio == "high")
m_priority = 50;
else
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
m_keep_alive = config.read_bool_entry(name, "KeepAlive");
m_lazy = config.read_bool_entry(name, "Lazy");
@ -309,13 +309,13 @@ Service::Service(const Core::ConfigFile& config, const StringView& name)
m_socket_path = config.read_entry(name, "Socket");
// Lazy requires Socket.
ASSERT(!m_lazy || !m_socket_path.is_null());
VERIFY(!m_lazy || !m_socket_path.is_null());
// AcceptSocketConnections always requires Socket, Lazy, and MultiInstance.
ASSERT(!m_accept_socket_connections || (!m_socket_path.is_null() && m_lazy && m_multi_instance));
VERIFY(!m_accept_socket_connections || (!m_socket_path.is_null() && m_lazy && m_multi_instance));
// MultiInstance doesn't work with KeepAlive.
ASSERT(!m_multi_instance || !m_keep_alive);
VERIFY(!m_multi_instance || !m_keep_alive);
// Socket path (plus NUL) must fit into the structs sent to the Kernel.
ASSERT(m_socket_path.length() < UNIX_PATH_MAX);
VERIFY(m_socket_path.length() < UNIX_PATH_MAX);
if (!m_socket_path.is_null() && is_enabled()) {
auto socket_permissions_string = config.read_entry(name, "SocketPermissions", "0600");

View file

@ -88,7 +88,7 @@ static void chown_wrapper(const char* path, uid_t uid, gid_t gid)
{
int rc = chown(path, uid, gid);
if (rc < 0 && errno != ENOENT) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -98,22 +98,22 @@ static void prepare_devfs()
int rc = mount(-1, "/dev", "dev", 0);
if (rc != 0) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
rc = mkdir("/dev/pts", 0755);
if (rc != 0) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
rc = mount(-1, "/dev/pts", "devpts", 0);
if (rc != 0) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
rc = symlink("/dev/random", "/dev/urandom");
if (rc < 0) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
// FIXME: Find a better way to chown without hardcoding the gid!
@ -140,15 +140,15 @@ static void prepare_devfs()
rc = symlink("/proc/self/fd/0", "/dev/stdin");
if (rc < 0) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
rc = symlink("/proc/self/fd/1", "/dev/stdout");
if (rc < 0) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
rc = symlink("/proc/self/fd/2", "/dev/stderr");
if (rc < 0) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -159,11 +159,11 @@ static void mount_all_filesystems()
if (pid < 0) {
perror("fork");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
} else if (pid == 0) {
execl("/bin/mount", "mount", "-a", nullptr);
perror("exec");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
} else {
wait(nullptr);
}
@ -176,7 +176,7 @@ static void create_tmp_rpc_directory()
auto rc = mkdir("/tmp/rpc", 01777);
if (rc < 0) {
perror("mkdir(/tmp/rpc)");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
umask(old_umask);
}
@ -188,7 +188,7 @@ static void create_tmp_coredump_directory()
auto rc = mkdir("/tmp/coredump", 0755);
if (rc < 0) {
perror("mkdir(/tmp/coredump)");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
umask(old_umask);
}

View file

@ -105,7 +105,7 @@ static void paint_custom_progress_bar(GUI::Painter& painter, const Gfx::IntRect&
void TaskbarButton::paint_event(GUI::PaintEvent& event)
{
ASSERT(icon());
VERIFY(icon());
auto& icon = *this->icon();
auto& font = is_checked() ? Gfx::FontDatabase::default_bold_font() : this->font();
auto& window = WindowList::the().ensure_window(m_identifier);

View file

@ -130,7 +130,7 @@ void TaskbarWindow::create_quick_launch_bar()
}
execl(app_executable.characters(), app_executable.characters(), nullptr);
perror("execl");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
} else {
if (disown(pid) < 0)
perror("disown");
@ -291,7 +291,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
} else if (window_owner) {
// check the window owner's button if the modal's window button
// would have been checked
ASSERT(window.is_modal());
VERIFY(window.is_modal());
update_window_button(*window_owner, window.is_active());
}
break;

View file

@ -176,7 +176,7 @@ void Client::send_commands(Vector<Command> commands)
for (auto& command : commands)
stream << (u8)IAC << command.command << command.subcommand;
ASSERT(stream.is_end());
VERIFY(stream.is_end());
m_socket->write(buffer.data(), buffer.size());
}

View file

@ -99,7 +99,7 @@ static void run_command(int ptm_fd, String command)
perror("execve");
exit(1);
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -116,7 +116,7 @@ void PageHost::page_did_change_selection()
void PageHost::page_did_layout()
{
auto* layout_root = this->layout_root();
ASSERT(layout_root);
VERIFY(layout_root);
auto content_size = enclosing_int_rect(layout_root->absolute_rect()).size();
m_client.post_message(Messages::WebContentClient::DidLayout(content_size));
}

View file

@ -54,7 +54,7 @@ int main(int, char**)
}
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
ASSERT(socket);
VERIFY(socket);
IPC::new_client_connection<WebContent::ClientConnection>(socket.release_nonnull(), 1);
return event_loop.exec();
}

View file

@ -174,7 +174,7 @@ static String folder_image_data()
static String cache;
if (cache.is_empty()) {
auto file_or_error = MappedFile::map("/res/icons/16x16/filetype-folder.png");
ASSERT(!file_or_error.is_error());
VERIFY(!file_or_error.is_error());
cache = encode_base64(file_or_error.value()->bytes());
}
return cache;
@ -185,7 +185,7 @@ static String file_image_data()
static String cache;
if (cache.is_empty()) {
auto file_or_error = MappedFile::map("/res/icons/16x16/filetype-unknown.png");
ASSERT(!file_or_error.is_error());
VERIFY(!file_or_error.is_error());
cache = encode_base64(file_or_error.value()->bytes());
}
return cache;

View file

@ -68,7 +68,7 @@ int main(int argc, char** argv)
server->on_ready_to_accept = [&] {
auto client_socket = server->accept();
ASSERT(client_socket);
VERIFY(client_socket);
auto client = WebServer::Client::construct(client_socket.release_nonnull(), real_root_path, server);
client->start();
};

View file

@ -49,7 +49,7 @@ AppletManager::~AppletManager()
AppletManager& AppletManager::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}

View file

@ -537,14 +537,14 @@ void ClientConnection::destroy_window(Window& window, Vector<i32>& destroyed_win
for (auto& child_window : window.child_windows()) {
if (!child_window)
continue;
ASSERT(child_window->window_id() != window.window_id());
VERIFY(child_window->window_id() != window.window_id());
destroy_window(*child_window, destroyed_window_ids);
}
for (auto& accessory_window : window.accessory_windows()) {
if (!accessory_window)
continue;
ASSERT(accessory_window->window_id() != window.window_id());
VERIFY(accessory_window->window_id() != window.window_id());
destroy_window(*accessory_window, destroyed_window_ids);
}

View file

@ -221,15 +221,15 @@ void Compositor::compose()
auto prepare_rect = [&](const Gfx::IntRect& rect) {
dbgln_if(COMPOSE_DEBUG, " -> flush opaque: {}", rect);
ASSERT(!flush_rects.intersects(rect));
ASSERT(!flush_transparent_rects.intersects(rect));
VERIFY(!flush_rects.intersects(rect));
VERIFY(!flush_transparent_rects.intersects(rect));
flush_rects.add(rect);
check_restore_cursor_back(rect);
};
auto prepare_transparency_rect = [&](const Gfx::IntRect& rect) {
dbgln_if(COMPOSE_DEBUG, " -> flush transparent: {}", rect);
ASSERT(!flush_rects.intersects(rect));
VERIFY(!flush_rects.intersects(rect));
for (auto& r : flush_transparent_rects.rects()) {
if (r == rect)
return;
@ -261,7 +261,7 @@ void Compositor::compose()
auto src_rect = Gfx::FloatRect { rect.x() * hscale, rect.y() * vscale, rect.width() * hscale, rect.height() * vscale };
painter.draw_scaled_bitmap(rect, *m_wallpaper, src_rect);
} else {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
};
@ -434,7 +434,7 @@ void Compositor::compose()
}
// Check that there are no overlapping transparent and opaque flush rectangles
ASSERT(![&]() {
VERIFY(![&]() {
for (auto& rect_transparent : flush_transparent_rects.rects()) {
for (auto& rect_opaque : flush_rects.rects()) {
if (rect_opaque.intersects(rect_transparent)) {
@ -649,7 +649,7 @@ bool Compositor::set_wallpaper(const String& path, Function<void(bool)>&& callba
void Compositor::flip_buffers()
{
ASSERT(m_screen_can_set_buffer);
VERIFY(m_screen_can_set_buffer);
swap(m_front_bitmap, m_back_bitmap);
swap(m_front_painter, m_back_painter);
Screen::the().set_buffer(m_buffers_are_flipped ? 0 : 1);
@ -838,7 +838,7 @@ void Compositor::increment_display_link_count(Badge<ClientConnection>)
void Compositor::decrement_display_link_count(Badge<ClientConnection>)
{
ASSERT(m_display_link_count);
VERIFY(m_display_link_count);
--m_display_link_count;
if (!m_display_link_count)
m_display_link_notify_timer->stop();
@ -1024,7 +1024,7 @@ void Compositor::recompute_occlusions()
if (!transparency_rects.is_empty())
have_transparent = true;
ASSERT(!visible_opaque.intersects(transparency_rects));
VERIFY(!visible_opaque.intersects(transparency_rects));
// Determine visible area for the window below
if (w.is_opaque()) {
@ -1089,9 +1089,9 @@ void Compositor::recompute_occlusions()
dbgln(" transparent: {}", r);
}
ASSERT(!w.opaque_rects().intersects(m_opaque_wallpaper_rects));
ASSERT(!w.transparency_rects().intersects(m_opaque_wallpaper_rects));
ASSERT(!w.transparency_wallpaper_rects().intersects(m_opaque_wallpaper_rects));
VERIFY(!w.opaque_rects().intersects(m_opaque_wallpaper_rects));
VERIFY(!w.transparency_rects().intersects(m_opaque_wallpaper_rects));
VERIFY(!w.transparency_wallpaper_rects().intersects(m_opaque_wallpaper_rects));
return IterationDecision::Continue;
});
}

View file

@ -125,7 +125,7 @@ Cursor::Cursor(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const CursorParams& cursor_p
, m_rect(m_bitmap->rect())
{
if (m_params.frames() > 1) {
ASSERT(m_rect.width() % m_params.frames() == 0);
VERIFY(m_rect.width() % m_params.frames() == 0);
m_rect.set_width(m_rect.width() / m_params.frames());
}
}
@ -182,7 +182,7 @@ RefPtr<Cursor> Cursor::create(Gfx::StandardCursor standard_cursor)
case Gfx::StandardCursor::Wait:
return WindowManager::the().wait_cursor();
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -52,7 +52,7 @@ EventLoop::EventLoop()
m_mouse_fd = open("/dev/mouse", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
bool ok = m_server->take_over_from_system_server();
ASSERT(ok);
VERIFY(ok);
m_server->on_ready_to_accept = [this] {
auto client_socket = m_server->accept();
@ -145,7 +145,7 @@ void EventLoop::drain_keyboard()
ssize_t nread = read(m_keyboard_fd, (u8*)&event, sizeof(::KeyEvent));
if (nread == 0)
break;
ASSERT(nread == sizeof(::KeyEvent));
VERIFY(nread == sizeof(::KeyEvent));
screen.on_receive_keyboard_data(event);
}
}

View file

@ -172,7 +172,7 @@ int Menu::visible_item_count() const
{
if (!is_scrollable())
return m_items.size();
ASSERT(m_menu_window);
VERIFY(m_menu_window);
// Make space for up/down arrow indicators
return m_menu_window->height() / item_height() - 2;
}
@ -182,8 +182,8 @@ void Menu::draw()
auto palette = WindowManager::the().palette();
m_theme_index_at_last_paint = MenuManager::the().theme_index();
ASSERT(menu_window());
ASSERT(menu_window()->backing_store());
VERIFY(menu_window());
VERIFY(menu_window()->backing_store());
Gfx::Painter painter(*menu_window()->backing_store());
Gfx::IntRect rect { {}, menu_window()->size() };
@ -297,7 +297,7 @@ MenuItem* Menu::hovered_item() const
void Menu::update_for_new_hovered_item(bool make_input)
{
if (hovered_item() && hovered_item()->is_submenu()) {
ASSERT(menu_window());
VERIFY(menu_window());
MenuManager::the().close_everyone_not_in_lineage(*hovered_item()->submenu());
hovered_item()->submenu()->do_popup(hovered_item()->rect().top_right().translated(menu_window()->rect().location()), make_input);
} else {
@ -309,8 +309,8 @@ void Menu::update_for_new_hovered_item(bool make_input)
void Menu::open_hovered_item()
{
ASSERT(menu_window());
ASSERT(menu_window()->is_visible());
VERIFY(menu_window());
VERIFY(menu_window()->is_visible());
if (!hovered_item())
return;
if (hovered_item()->is_enabled())
@ -320,17 +320,17 @@ void Menu::open_hovered_item()
void Menu::descend_into_submenu_at_hovered_item()
{
ASSERT(hovered_item());
VERIFY(hovered_item());
auto submenu = hovered_item()->submenu();
ASSERT(submenu);
VERIFY(submenu);
MenuManager::the().open_menu(*submenu, false, false);
submenu->set_hovered_item(0);
ASSERT(submenu->hovered_item()->type() != MenuItem::Separator);
VERIFY(submenu->hovered_item()->type() != MenuItem::Separator);
}
void Menu::handle_mouse_move_event(const MouseEvent& mouse_event)
{
ASSERT(menu_window());
VERIFY(menu_window());
MenuManager::the().set_current_menu(this);
if (hovered_item() && hovered_item()->is_submenu()) {
@ -368,7 +368,7 @@ void Menu::event(Core::Event& event)
}
if (event.type() == Event::MouseWheel && is_scrollable()) {
ASSERT(menu_window());
VERIFY(menu_window());
auto& mouse_event = static_cast<const MouseEvent&>(event);
m_scroll_offset += mouse_event.wheel_delta();
m_scroll_offset = clamp(m_scroll_offset, 0, m_max_scroll_offset);
@ -388,8 +388,8 @@ void Menu::event(Core::Event& event)
if (!(key == Key_Up || key == Key_Down || key == Key_Left || key == Key_Right || key == Key_Return))
return;
ASSERT(menu_window());
ASSERT(menu_window()->is_visible());
VERIFY(menu_window());
VERIFY(menu_window()->is_visible());
// Default to the first enabled, non-separator item on key press if one has not been selected yet
if (!hovered_item()) {
@ -406,7 +406,7 @@ void Menu::event(Core::Event& event)
}
if (key == Key_Up) {
ASSERT(m_items.at(0).type() != MenuItem::Separator);
VERIFY(m_items.at(0).type() != MenuItem::Separator);
if (is_scrollable() && m_hovered_item_index == 0)
return;
@ -421,7 +421,7 @@ void Menu::event(Core::Event& event)
return;
} while (hovered_item()->type() == MenuItem::Separator || !hovered_item()->is_enabled());
ASSERT(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
VERIFY(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
if (is_scrollable() && m_hovered_item_index < m_scroll_offset)
--m_scroll_offset;
@ -431,7 +431,7 @@ void Menu::event(Core::Event& event)
}
if (key == Key_Down) {
ASSERT(m_items.at(0).type() != MenuItem::Separator);
VERIFY(m_items.at(0).type() != MenuItem::Separator);
if (is_scrollable() && m_hovered_item_index == static_cast<int>(m_items.size()) - 1)
return;
@ -446,7 +446,7 @@ void Menu::event(Core::Event& event)
return;
} while (hovered_item()->type() == MenuItem::Separator || !hovered_item()->is_enabled());
ASSERT(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
VERIFY(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
if (is_scrollable() && m_hovered_item_index >= (m_scroll_offset + visible_item_count()))
++m_scroll_offset;

View file

@ -81,15 +81,15 @@ void MenuItem::set_default(bool is_default)
Menu* MenuItem::submenu()
{
ASSERT(is_submenu());
ASSERT(m_menu.client());
VERIFY(is_submenu());
VERIFY(m_menu.client());
return m_menu.client()->find_menu_by_id(m_submenu_id);
}
const Menu* MenuItem::submenu() const
{
ASSERT(is_submenu());
ASSERT(m_menu.client());
VERIFY(is_submenu());
VERIFY(m_menu.client());
return m_menu.client()->find_menu_by_id(m_submenu_id);
}

View file

@ -44,7 +44,7 @@ static constexpr int s_search_timeout = 3000;
MenuManager& MenuManager::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
@ -162,7 +162,7 @@ void MenuManager::event(Core::Event& event)
if (key_event.key() == Key_Left) {
auto it = m_open_menu_stack.find_if([&](const auto& other) { return m_current_menu == other.ptr(); });
ASSERT(!it.is_end());
VERIFY(!it.is_end());
// Going "back" a menu should be the previous menu in the stack
if (it.index() > 0)
@ -229,13 +229,13 @@ void MenuManager::handle_mouse_event(MouseEvent& mouse_event)
if (has_open_menu()) {
auto* topmost_menu = m_open_menu_stack.last().ptr();
ASSERT(topmost_menu);
VERIFY(topmost_menu);
auto* window = topmost_menu->menu_window();
if (!window) {
dbgln("MenuManager::handle_mouse_event: No menu window");
return;
}
ASSERT(window->is_visible());
VERIFY(window->is_visible());
bool event_is_inside_current_menu = window->rect().contains(mouse_event.position());
if (event_is_inside_current_menu) {
@ -326,7 +326,7 @@ void MenuManager::close_all_menus_from_client(Badge<ClientConnection>, ClientCon
void MenuManager::close_everyone()
{
for (auto& menu : m_open_menu_stack) {
ASSERT(menu);
VERIFY(menu);
if (menu->menu_window())
menu->menu_window()->set_visible(false);
menu->clear_hovered_item();
@ -440,7 +440,7 @@ void MenuManager::set_current_menu(Menu* menu)
return;
}
ASSERT(is_open(*menu));
VERIFY(is_open(*menu));
if (menu == m_current_menu) {
return;
}

View file

@ -43,18 +43,18 @@ static Screen* s_the;
Screen& Screen::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
Screen::Screen(unsigned desired_width, unsigned desired_height, int scale_factor)
{
ASSERT(!s_the);
VERIFY(!s_the);
s_the = this;
m_framebuffer_fd = open("/dev/fb0", O_RDWR | O_CLOEXEC);
if (m_framebuffer_fd < 0) {
perror("failed to open /dev/fb0");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (fb_set_buffer(m_framebuffer_fd, 0) == 0) {
@ -93,7 +93,7 @@ bool Screen::set_resolution(int width, int height, int new_scale_factor)
on_change_resolution(physical_resolution.pitch, physical_resolution.width, physical_resolution.height, new_scale_factor);
return false;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void Screen::on_change_resolution(int pitch, int new_physical_width, int new_physical_height, int new_scale_factor)
@ -102,14 +102,14 @@ void Screen::on_change_resolution(int pitch, int new_physical_width, int new_phy
if (m_framebuffer) {
size_t previous_size_in_bytes = m_size_in_bytes;
int rc = munmap(m_framebuffer, previous_size_in_bytes);
ASSERT(rc == 0);
VERIFY(rc == 0);
}
int rc = fb_get_size_in_bytes(m_framebuffer_fd, &m_size_in_bytes);
ASSERT(rc == 0);
VERIFY(rc == 0);
m_framebuffer = (Gfx::RGBA32*)mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebuffer_fd, 0);
ASSERT(m_framebuffer && m_framebuffer != (void*)-1);
VERIFY(m_framebuffer && m_framebuffer != (void*)-1);
}
m_pitch = pitch;
@ -122,20 +122,20 @@ void Screen::on_change_resolution(int pitch, int new_physical_width, int new_phy
void Screen::set_buffer(int index)
{
ASSERT(m_can_set_buffer);
VERIFY(m_can_set_buffer);
int rc = fb_set_buffer(m_framebuffer_fd, index);
ASSERT(rc == 0);
VERIFY(rc == 0);
}
void Screen::set_acceleration_factor(double factor)
{
ASSERT(factor >= mouse_accel_min && factor <= mouse_accel_max);
VERIFY(factor >= mouse_accel_min && factor <= mouse_accel_max);
m_acceleration_factor = factor;
}
void Screen::set_scroll_step_size(unsigned step_size)
{
ASSERT(step_size >= scroll_step_size_min);
VERIFY(step_size >= scroll_step_size_min);
m_scroll_step_size = step_size;
}

View file

@ -153,7 +153,7 @@ void Window::set_title(const String& title)
void Window::set_rect(const Gfx::IntRect& rect)
{
ASSERT(!rect.is_empty());
VERIFY(!rect.is_empty());
if (m_rect == rect)
return;
auto old_rect = m_rect;
@ -168,7 +168,7 @@ void Window::set_rect(const Gfx::IntRect& rect)
void Window::set_rect_without_repaint(const Gfx::IntRect& rect)
{
ASSERT(!rect.is_empty());
VERIFY(!rect.is_empty());
if (m_rect == rect)
return;
auto old_rect = m_rect;
@ -232,7 +232,7 @@ void Window::nudge_into_desktop(bool force_titlebar_visible)
void Window::set_minimum_size(const Gfx::IntSize& size)
{
ASSERT(!size.is_empty());
VERIFY(!size.is_empty());
if (m_minimum_size == size)
return;
@ -265,7 +265,7 @@ void Window::handle_mouse_event(const MouseEvent& event)
m_client->post_message(Messages::WindowClient::MouseWheel(m_window_id, event.position(), (u32)event.button(), event.buttons(), event.modifiers(), event.wheel_delta()));
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -332,7 +332,7 @@ void Window::start_minimize_animation()
// next time we want to start the animation
m_taskbar_rect = w.taskbar_rect();
ASSERT(!m_have_taskbar_rect); // should remain unset!
VERIFY(!m_have_taskbar_rect); // should remain unset!
return IterationDecision::Break;
};
return IterationDecision::Continue;
@ -421,7 +421,7 @@ void Window::set_resizable(bool resizable)
void Window::event(Core::Event& event)
{
if (!m_client) {
ASSERT(parent());
VERIFY(parent());
event.ignore();
return;
}
@ -721,7 +721,7 @@ void Window::set_fullscreen(bool fullscreen)
Gfx::IntRect Window::tiled_rect(WindowTileType tiled) const
{
ASSERT(tiled != WindowTileType::None);
VERIFY(tiled != WindowTileType::None);
int frame_width = (m_frame.rect().width() - m_rect.width()) / 2;
int title_bar_height = m_frame.title_bar_rect().height();
@ -770,7 +770,7 @@ Gfx::IntRect Window::tiled_rect(WindowTileType tiled) const
Screen::the().width() / 2 - frame_width,
(max_height - title_bar_height) / 2);
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -778,7 +778,7 @@ bool Window::set_untiled(Optional<Gfx::IntPoint> fixed_point)
{
if (m_tiled == WindowTileType::None)
return false;
ASSERT(!resize_aspect_ratio().has_value());
VERIFY(!resize_aspect_ratio().has_value());
m_tiled = WindowTileType::None;
@ -797,7 +797,7 @@ bool Window::set_untiled(Optional<Gfx::IntPoint> fixed_point)
void Window::set_tiled(WindowTileType tiled)
{
ASSERT(tiled != WindowTileType::None);
VERIFY(tiled != WindowTileType::None);
if (m_tiled == tiled)
return;
@ -851,7 +851,7 @@ void Window::add_accessory_window(Window& accessory_window)
void Window::set_parent_window(Window& parent_window)
{
ASSERT(!m_parent_window);
VERIFY(!m_parent_window);
m_parent_window = parent_window;
if (m_accessory)
parent_window.add_accessory_window(*this);

View file

@ -232,7 +232,7 @@ bool WindowFrame::frame_has_alpha() const
void WindowFrame::did_set_maximized(Badge<Window>, bool maximized)
{
ASSERT(m_maximize_button);
VERIFY(m_maximize_button);
m_maximize_button->set_icon(maximized ? *s_restore_icon : *s_maximize_icon);
}
@ -427,7 +427,7 @@ void WindowFrame::render_to_cache()
if (m_top_bottom && top_bottom_height > 0) {
m_bottom_y = window_rect.y() - total_frame_rect.y();
ASSERT(m_bottom_y >= 0);
VERIFY(m_bottom_y >= 0);
Gfx::Painter top_bottom_painter(*m_top_bottom);
top_bottom_painter.add_clip_rect({ update_location, { frame_rect_to_update.width(), top_bottom_height - update_location.y() - (total_frame_rect.bottom() - frame_rect_to_update.bottom()) } });
@ -441,7 +441,7 @@ void WindowFrame::render_to_cache()
if (left_right_width > 0) {
m_right_x = window_rect.x() - total_frame_rect.x();
ASSERT(m_right_x >= 0);
VERIFY(m_right_x >= 0);
Gfx::Painter left_right_painter(*m_left_right);
left_right_painter.add_clip_rect({ update_location, { left_right_width - update_location.x() - (total_frame_rect.right() - frame_rect_to_update.right()), window_rect.height() } });
@ -578,7 +578,7 @@ bool WindowFrame::hit_test(const Gfx::IntPoint& point) const
void WindowFrame::on_mouse_event(const MouseEvent& event)
{
ASSERT(!m_window.is_fullscreen());
VERIFY(!m_window.is_fullscreen());
auto& wm = WindowManager::the();
if (m_window.type() != WindowType::Normal && m_window.type() != WindowType::ToolWindow && m_window.type() != WindowType::Notification)
@ -657,7 +657,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event)
{ ResizeDirection::DownLeft, ResizeDirection::Down, ResizeDirection::DownRight },
};
Gfx::IntRect outer_rect = { {}, rect().size() };
ASSERT(outer_rect.contains(event.position()));
VERIFY(outer_rect.contains(event.position()));
int window_relative_x = event.x() - outer_rect.x();
int window_relative_y = event.y() - outer_rect.y();
int hot_area_row = min(2, window_relative_y / (outer_rect.height() / 3));
@ -675,7 +675,7 @@ void WindowFrame::start_flash_animation()
{
if (!m_flash_timer) {
m_flash_timer = Core::Timer::construct(100, [this] {
ASSERT(m_flash_counter);
VERIFY(m_flash_counter);
invalidate_title_bar();
if (!--m_flash_counter)
m_flash_timer->stop();
@ -717,7 +717,7 @@ void WindowFrame::paint_simple_rect_shadow(Gfx::Painter& painter, const Gfx::Int
}
// The containing_rect should have been inflated appropriately
ASSERT(containing_rect.size().contains(Gfx::IntSize { base_size, base_size }));
VERIFY(containing_rect.size().contains(Gfx::IntSize { base_size, base_size }));
auto sides_height = containing_rect.height() - 2 * base_size;
auto half_height = sides_height / 2;

View file

@ -58,7 +58,7 @@ static WindowManager* s_the;
WindowManager& WindowManager::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
@ -460,7 +460,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& pos
};
Gfx::IntRect outer_rect = window.frame().rect();
if (!outer_rect.contains(position)) {
// FIXME: This used to be an ASSERT but crashing WindowServer over this seems silly.
// FIXME: This used to be an VERIFY but crashing WindowServer over this seems silly.
dbgln("FIXME: !outer_rect.contains(position): outer_rect={}, position={}", outer_rect, position);
}
int window_relative_x = position.x() - outer_rect.x();
@ -469,7 +469,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& pos
int hot_area_column = min(2, window_relative_x / (outer_rect.width() / 3));
m_resize_direction = direction_for_hot_area[hot_area_row][hot_area_column];
if (m_resize_direction == ResizeDirection::None) {
ASSERT(!m_resize_window);
VERIFY(!m_resize_window);
return;
}
@ -644,7 +644,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo
change_h = diff_y;
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
auto new_rect = m_resize_window_original_rect;
@ -692,7 +692,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo
new_rect.set_right_without_resize(m_resize_window_original_rect.right());
break;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (new_rect.contains(event.position()))
@ -772,7 +772,7 @@ auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) con
case MouseButton::Forward:
return m_forward;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -790,7 +790,7 @@ auto WindowManager::DoubleClickInfo::metadata_for_button(MouseButton button) ->
case MouseButton::Forward:
return m_forward;
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -816,7 +816,7 @@ void WindowManager::start_menu_doubleclick(Window& window, const MouseEvent& eve
// So, in order to be able to detect a double click when a menu is being
// opened by the MouseDown event, we need to consider the MouseDown event
// as a potential double-click trigger
ASSERT(event.type() == Event::MouseDown);
VERIFY(event.type() == Event::MouseDown);
auto& metadata = m_double_click_info.metadata_for_button(event.button());
if (&window != m_double_click_info.m_clicked_window) {
@ -835,7 +835,7 @@ void WindowManager::start_menu_doubleclick(Window& window, const MouseEvent& eve
bool WindowManager::is_menu_doubleclick(Window& window, const MouseEvent& event) const
{
ASSERT(event.type() == Event::MouseUp);
VERIFY(event.type() == Event::MouseUp);
if (&window != m_double_click_info.m_clicked_window)
return false;
@ -850,7 +850,7 @@ bool WindowManager::is_menu_doubleclick(Window& window, const MouseEvent& event)
void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& event)
{
// We only care about button presses (because otherwise it's not a doubleclick, duh!)
ASSERT(event.type() == Event::MouseUp);
VERIFY(event.type() == Event::MouseUp);
if (&window != m_double_click_info.m_clicked_window) {
// we either haven't clicked anywhere, or we haven't clicked on this
@ -983,7 +983,7 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
return;
}
ASSERT(window.hit_test(event.position()));
VERIFY(window.hit_test(event.position()));
if (event.type() == Event::MouseDown) {
// We're clicking on something that's blocked by a modal window.
// Flash the modal window to let the user know about it.
@ -1131,7 +1131,7 @@ Gfx::IntRect WindowManager::arena_rect_for_type(WindowType type) const
case WindowType::Notification:
return Screen::the().rect();
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -1310,8 +1310,8 @@ void WindowManager::set_active_window(Window* window, bool make_input)
{
if (window) {
if (auto* modal_window = window->blocking_modal_window()) {
ASSERT(modal_window->is_modal());
ASSERT(modal_window != window);
VERIFY(modal_window->is_modal());
VERIFY(modal_window != window);
window = modal_window;
make_input = true;
}
@ -1473,7 +1473,7 @@ Gfx::IntRect WindowManager::maximized_window_rect(const Window& window) const
void WindowManager::start_dnd_drag(ClientConnection& client, const String& text, const Gfx::Bitmap* bitmap, const Core::MimeData& mime_data)
{
ASSERT(!m_dnd_client);
VERIFY(!m_dnd_client);
m_dnd_client = client;
m_dnd_text = text;
m_dnd_bitmap = bitmap;
@ -1484,7 +1484,7 @@ void WindowManager::start_dnd_drag(ClientConnection& client, const String& text,
void WindowManager::end_dnd_drag()
{
ASSERT(m_dnd_client);
VERIFY(m_dnd_client);
Compositor::the().invalidate_cursor();
m_dnd_client = nullptr;
m_dnd_text = {};

View file

@ -39,7 +39,7 @@ static WindowSwitcher* s_the;
WindowSwitcher& WindowSwitcher::the()
{
ASSERT(s_the);
VERIFY(s_the);
return *s_the;
}
@ -124,7 +124,7 @@ void WindowSwitcher::on_key_event(const KeyEvent& event)
hide();
return;
}
ASSERT(!m_windows.is_empty());
VERIFY(!m_windows.is_empty());
int new_selected_index;
@ -135,7 +135,7 @@ void WindowSwitcher::on_key_event(const KeyEvent& event)
if (new_selected_index < 0)
new_selected_index = static_cast<int>(m_windows.size()) - 1;
}
ASSERT(new_selected_index < static_cast<int>(m_windows.size()));
VERIFY(new_selected_index < static_cast<int>(m_windows.size()));
select_window_at_index(new_selected_index);
}
@ -154,7 +154,7 @@ void WindowSwitcher::select_window_at_index(int index)
{
m_selected_index = index;
auto* highlight_window = m_windows.at(index).ptr();
ASSERT(highlight_window);
VERIFY(highlight_window);
WindowManager::the().set_highlight_window(highlight_window);
redraw();
}

View file

@ -77,7 +77,7 @@ int main(int, char**)
auto theme_name = wm_config->read_entry("Theme", "Name", "Default");
auto theme = Gfx::load_system_theme(String::formatted("/res/themes/{}.ini", theme_name));
ASSERT(theme.is_valid());
VERIFY(theme.is_valid());
Gfx::set_system_theme(theme);
auto palette = Gfx::PaletteImpl::create_with_anonymous_buffer(theme);
@ -114,5 +114,5 @@ int main(int, char**)
dbgln("Entering WindowServer main loop");
loop.exec();
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}