1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +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

@ -200,9 +200,9 @@ String Account::generate_passwd_file() const
void Account::load_shadow_file()
{
auto file_or_error = Core::File::open("/etc/shadow", Core::File::ReadOnly);
ASSERT(!file_or_error.is_error());
VERIFY(!file_or_error.is_error());
auto shadow_file = file_or_error.release_value();
ASSERT(shadow_file->is_open());
VERIFY(shadow_file->is_open());
Vector<ShadowEntry> entries;
@ -250,7 +250,7 @@ bool Account::sync()
auto new_shadow_file_content = generate_shadow_file();
if (new_passwd_file_content.is_null() || new_shadow_file_content.is_null()) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
char new_passwd_name[] = "/etc/passwd.XXXXXX";
@ -260,34 +260,34 @@ bool Account::sync()
auto new_passwd_fd = mkstemp(new_passwd_name);
if (new_passwd_fd < 0) {
perror("mkstemp");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
ScopeGuard new_passwd_fd_guard = [new_passwd_fd] { close(new_passwd_fd); };
auto new_shadow_fd = mkstemp(new_shadow_name);
if (new_shadow_fd < 0) {
perror("mkstemp");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
ScopeGuard new_shadow_fd_guard = [new_shadow_fd] { close(new_shadow_fd); };
if (fchmod(new_passwd_fd, 0644) < 0) {
perror("fchmod");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
auto nwritten = write(new_passwd_fd, new_passwd_file_content.characters(), new_passwd_file_content.length());
if (nwritten < 0) {
perror("write");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
ASSERT(static_cast<size_t>(nwritten) == new_passwd_file_content.length());
VERIFY(static_cast<size_t>(nwritten) == new_passwd_file_content.length());
nwritten = write(new_shadow_fd, new_shadow_file_content.characters(), new_shadow_file_content.length());
if (nwritten < 0) {
perror("write");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
ASSERT(static_cast<size_t>(nwritten) == new_shadow_file_content.length());
VERIFY(static_cast<size_t>(nwritten) == new_shadow_file_content.length());
}
if (rename(new_passwd_name, "/etc/passwd") < 0) {

View file

@ -87,10 +87,10 @@ AnonymousBufferImpl::~AnonymousBufferImpl()
{
if (m_fd != -1) {
auto rc = close(m_fd);
ASSERT(rc == 0);
VERIFY(rc == 0);
}
auto rc = munmap(m_data, round_up_to_power_of_two(m_size, PAGE_SIZE));
ASSERT(rc == 0);
VERIFY(rc == 0);
}
AnonymousBuffer AnonymousBuffer::create_from_anon_fd(int fd, size_t size)

View file

@ -104,16 +104,16 @@ bool ArgsParser::parse(int argc, char** argv, bool exit_on_failure)
Option* found_option = nullptr;
if (c == 0) {
// It was a long option.
ASSERT(index_of_found_long_option >= 0);
VERIFY(index_of_found_long_option >= 0);
found_option = &m_options[index_of_found_long_option];
index_of_found_long_option = -1;
} else {
// It was a short option, look it up.
auto it = m_options.find_if([c](auto& opt) { return c == opt.short_name; });
ASSERT(!it.is_end());
VERIFY(!it.is_end());
found_option = &*it;
}
ASSERT(found_option);
VERIFY(found_option);
const char* arg = found_option->requires_argument ? optarg : nullptr;
if (!found_option->accept_value(arg)) {
@ -264,7 +264,7 @@ void ArgsParser::add_option(bool& value, const char* help_string, const char* lo
short_name,
nullptr,
[&value](const char* s) {
ASSERT(s == nullptr);
VERIFY(s == nullptr);
value = true;
return true;
}

View file

@ -56,11 +56,11 @@ String command(const String& program, const Vector<String>& arguments, Optional<
int stderr_pipe[2] = {};
if (pipe2(stdout_pipe, O_CLOEXEC)) {
perror("pipe2");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (pipe2(stderr_pipe, O_CLOEXEC)) {
perror("pipe2");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
auto close_pipes = ScopeGuard([stderr_pipe, stdout_pipe] {
@ -88,7 +88,7 @@ String command(const String& program, const Vector<String>& arguments, Optional<
pid_t pid;
if ((errno = posix_spawnp(&pid, program.characters(), &action, nullptr, const_cast<char**>(argv), environ))) {
perror("posix_spawn");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
int wstatus;
waitpid(pid, &wstatus, 0);
@ -102,7 +102,7 @@ String command(const String& program, const Vector<String>& arguments, Optional<
auto result_file = Core::File::construct();
if (!result_file->open(pipe[0], Core::IODevice::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) {
perror("open");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
return String::copy(result_file->read_all());
};

View file

@ -43,7 +43,7 @@ void ElapsedTimer::start()
int ElapsedTimer::elapsed() const
{
ASSERT(is_valid());
VERIFY(is_valid());
struct timeval now;
timespec now_spec;
clock_gettime(m_precise ? CLOCK_MONOTONIC : CLOCK_MONOTONIC_COARSE, &now_spec);

View file

@ -160,7 +160,7 @@ public:
shutdown();
return;
}
ASSERT(nread == sizeof(length));
VERIFY(nread == sizeof(length));
auto request = m_socket->read(length);
auto request_json = JsonValue::from_string(request);
@ -296,7 +296,7 @@ EventLoop::EventLoop()
fcntl(s_wake_pipe_fds[1], F_SETFD, FD_CLOEXEC);
#endif
ASSERT(rc == 0);
VERIFY(rc == 0);
s_event_loop_stack->append(this);
#ifdef __serenity__
@ -326,20 +326,20 @@ bool EventLoop::start_rpc_server()
};
return s_rpc_server->listen(String::formatted("/tmp/rpc/{}", getpid()));
#else
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
#endif
}
EventLoop& EventLoop::main()
{
ASSERT(s_main_event_loop);
VERIFY(s_main_event_loop);
return *s_main_event_loop;
}
EventLoop& EventLoop::current()
{
EventLoop* event_loop = s_event_loop_stack->last();
ASSERT(event_loop != nullptr);
VERIFY(event_loop != nullptr);
return *event_loop;
}
@ -391,7 +391,7 @@ int EventLoop::exec()
return m_exit_code;
pump();
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void EventLoop::pump(WaitMode mode)
@ -415,7 +415,7 @@ void EventLoop::pump(WaitMode mode)
if (!receiver) {
switch (event.type()) {
case Event::Quit:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
return;
default:
#if EVENTLOOP_DEBUG
@ -485,7 +485,7 @@ void SignalHandlers::dispatch()
for (auto& handler : m_handlers_pending) {
if (handler.value) {
auto result = m_handlers.set(handler.key, move(handler.value));
ASSERT(result == AK::HashSetResult::InsertedNewEntry);
VERIFY(result == AK::HashSetResult::InsertedNewEntry);
} else {
m_handlers.remove(handler.key);
}
@ -506,7 +506,7 @@ int SignalHandlers::add(Function<void(int)>&& handler)
bool SignalHandlers::remove(int handler_id)
{
ASSERT(handler_id != 0);
VERIFY(handler_id != 0);
if (m_calling_handlers) {
auto it = m_handlers.find(handler_id);
if (it != m_handlers.end()) {
@ -544,7 +544,7 @@ void EventLoop::dispatch_signal(int signo)
void EventLoop::handle_signal(int signo)
{
ASSERT(signo != 0);
VERIFY(signo != 0);
// We MUST check if the current pid still matches, because there
// is a window between fork() and exec() where a signal delivered
// to our fork could be inadvertedly routed to the parent process!
@ -552,7 +552,7 @@ void EventLoop::handle_signal(int signo)
int nwritten = write(s_wake_pipe_fds[1], &signo, sizeof(signo));
if (nwritten < 0) {
perror("EventLoop::register_signal: write");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
} else {
// We're a fork who received a signal, reset s_pid
@ -562,7 +562,7 @@ void EventLoop::handle_signal(int signo)
int EventLoop::register_signal(int signo, Function<void(int)> handler)
{
ASSERT(signo != 0);
VERIFY(signo != 0);
auto& info = *signals_info();
auto handlers = info.signal_handlers.find(signo);
if (handlers == info.signal_handlers.end()) {
@ -577,7 +577,7 @@ int EventLoop::register_signal(int signo, Function<void(int)> handler)
void EventLoop::unregister_signal(int handler_id)
{
ASSERT(handler_id != 0);
VERIFY(handler_id != 0);
int remove_signo = 0;
auto& info = *signals_info();
for (auto& h : info.signal_handlers) {
@ -612,7 +612,7 @@ void EventLoop::notify_forked(ForkEvent event)
return;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void EventLoop::wait_for_event(WaitMode mode)
@ -639,7 +639,7 @@ retry:
if (notifier->event_mask() & Notifier::Write)
add_fd_to_set(notifier->fd(), wfds);
if (notifier->event_mask() & Notifier::Exceptional)
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
bool queued_events_is_empty;
@ -681,16 +681,16 @@ try_select_again:
dbgln("Core::EventLoop::wait_for_event: {} ({}: {})", marked_fd_count, saved_errno, strerror(saved_errno));
#endif
// Blow up, similar to Core::safe_syscall.
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
if (FD_ISSET(s_wake_pipe_fds[0], &rfds)) {
int wake_events[8];
auto nread = read(s_wake_pipe_fds[0], wake_events, sizeof(wake_events));
if (nread < 0) {
perror("read from wake pipe");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
ASSERT(nread > 0);
VERIFY(nread > 0);
bool wake_requested = false;
int event_count = nread / sizeof(wake_events[0]);
for (int i = 0; i < event_count; i++) {
@ -729,7 +729,7 @@ try_select_again:
timer.reload(now);
} else {
// FIXME: Support removing expired timers that don't want to reload.
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -778,7 +778,7 @@ Optional<struct timeval> EventLoop::get_next_timer_expiration()
int EventLoop::register_timer(Object& object, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible fire_when_not_visible)
{
ASSERT(milliseconds >= 0);
VERIFY(milliseconds >= 0);
auto timer = make<EventLoopTimer>();
timer->owner = object;
timer->interval = milliseconds;
@ -822,7 +822,7 @@ void EventLoop::wake()
int nwritten = write(s_wake_pipe_fds[1], &wake_event, sizeof(wake_event));
if (nwritten < 0) {
perror("EventLoop::wake: write");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -81,7 +81,7 @@ bool File::open(IODevice::OpenMode mode)
bool File::open_impl(IODevice::OpenMode mode, mode_t permissions)
{
ASSERT(!m_filename.is_null());
VERIFY(!m_filename.is_null());
int flags = 0;
if ((mode & IODevice::ReadWrite) == IODevice::ReadWrite) {
flags |= O_RDWR | O_CREAT;
@ -144,7 +144,7 @@ String File::real_path_for(const String& filename)
bool File::ensure_parent_directories(const String& path)
{
ASSERT(path.starts_with("/"));
VERIFY(path.starts_with("/"));
int saved_errno = 0;
ScopeGuard restore_errno = [&saved_errno] { errno = saved_errno; };
@ -365,7 +365,7 @@ Result<void, File::CopyError> File::copy_file(const String& dst_path, const stru
if (nwritten < 0)
return CopyError { OSError(errno), false };
ASSERT(nwritten > 0);
VERIFY(nwritten > 0);
remaining_to_write -= nwritten;
bufptr += nwritten;
}

View file

@ -42,7 +42,7 @@ public:
static Result<InputFileStream, String> open(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::ReadOnly, mode_t permissions = 0644)
{
ASSERT((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite);
VERIFY((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite);
auto file_result = File::open(filename, mode, permissions);
@ -54,7 +54,7 @@ public:
static Result<Buffered<InputFileStream>, String> open_buffered(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::ReadOnly, mode_t permissions = 0644)
{
ASSERT((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite);
VERIFY((mode & 0xf) == IODevice::OpenMode::ReadOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite);
auto file_result = File::open(filename, mode, permissions);
@ -106,7 +106,7 @@ public:
static Result<OutputFileStream, String> open(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::WriteOnly, mode_t permissions = 0644)
{
ASSERT((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite);
VERIFY((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite);
auto file_result = File::open(filename, mode, permissions);
@ -118,7 +118,7 @@ public:
static Result<Buffered<OutputFileStream>, String> open_buffered(StringView filename, IODevice::OpenMode mode = IODevice::OpenMode::WriteOnly, mode_t permissions = 0644)
{
ASSERT((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite);
VERIFY((mode & 0xf) == IODevice::OpenMode::WriteOnly || (mode & 0xf) == IODevice::OpenMode::ReadWrite);
auto file_result = File::open(filename, mode, permissions);

View file

@ -72,7 +72,7 @@ BlockingFileWatcher::BlockingFileWatcher(const String& path)
: m_path(path)
{
m_watcher_fd = watch_file(path.characters(), path.length());
ASSERT(m_watcher_fd != -1);
VERIFY(m_watcher_fd != -1);
}
BlockingFileWatcher::~BlockingFileWatcher()

View file

@ -58,7 +58,7 @@ Result<String, OSError> get_password(const StringView& prompt)
if (line_length < 0)
return OSError(saved_errno);
ASSERT(line_length != 0);
VERIFY(line_length != 0);
// Remove trailing '\n' read by getline().
password[line_length - 1] = '\0';

View file

@ -46,7 +46,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
size_t current = 0;
auto read_byte = [&]() {
if (current >= data.size()) {
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
return (u8)0;
}
return data[current++];
@ -108,7 +108,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
{
ASSERT(is_compressed(data));
VERIFY(is_compressed(data));
dbgln_if(GZIP_DEBUG, "Gzip::decompress: Decompressing gzip compressed data. size={}", data.size());
auto optional_payload = get_gzip_payload(data);
@ -150,7 +150,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
destination.grow(destination.size() * 2);
} else {
dbgln("Gzip::decompress: Error. puff() returned: {}", puff_ret);
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -47,7 +47,7 @@ public:
IODeviceStreamReader& operator>>(T& value)
{
int nread = m_device.read((u8*)&value, sizeof(T));
ASSERT(nread == sizeof(T));
VERIFY(nread == sizeof(T));
if (nread != sizeof(T))
m_had_failure = true;
return *this;

View file

@ -112,12 +112,12 @@ bool LocalServer::listen(const String& address)
ioctl(m_fd, FIONBIO, &option);
fcntl(m_fd, F_SETFD, FD_CLOEXEC);
#endif
ASSERT(m_fd >= 0);
VERIFY(m_fd >= 0);
#ifndef __APPLE__
rc = fchmod(m_fd, 0600);
if (rc < 0) {
perror("fchmod");
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
#endif
@ -147,7 +147,7 @@ bool LocalServer::listen(const String& address)
RefPtr<LocalSocket> LocalServer::accept()
{
ASSERT(m_listening);
VERIFY(m_listening);
sockaddr_un un;
socklen_t un_size = sizeof(un);
int accepted_fd = ::accept(m_fd, (sockaddr*)&un, &un_size);

View file

@ -55,7 +55,7 @@ void NetworkJob::did_finish(NonnullRefPtr<NetworkResponse>&& response)
m_response = move(response);
dbgln_if(CNETWORKJOB_DEBUG, "{} job did_finish", *this);
ASSERT(on_finish);
VERIFY(on_finish);
on_finish(true);
shutdown();
}
@ -68,7 +68,7 @@ void NetworkJob::did_fail(Error error)
m_error = error;
dbgln_if(CNETWORKJOB_DEBUG, "{}{{{:p}}} job did_fail! error: {} ({})", class_name(), this, (unsigned)error, to_string(error));
ASSERT(on_finish);
VERIFY(on_finish);
on_finish(false);
shutdown();
}

View file

@ -84,7 +84,7 @@ void Object::event(Core::Event& event)
case Core::Event::ChildRemoved:
return child_event(static_cast<ChildEvent&>(event));
case Core::Event::Invalid:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
break;
case Core::Event::Custom:
return custom_event(static_cast<CustomEvent&>(event));
@ -96,7 +96,7 @@ void Object::event(Core::Event& event)
void Object::add_child(Object& object)
{
// FIXME: Should we support reparenting objects?
ASSERT(!object.parent() || object.parent() == this);
VERIFY(!object.parent() || object.parent() == this);
object.m_parent = this;
m_children.append(object);
Core::ChildEvent child_event(Core::Event::ChildAdded, object);
@ -106,7 +106,7 @@ void Object::add_child(Object& object)
void Object::insert_child_before(Object& new_child, Object& before_child)
{
// FIXME: Should we support reparenting objects?
ASSERT(!new_child.parent() || new_child.parent() == this);
VERIFY(!new_child.parent() || new_child.parent() == this);
new_child.m_parent = this;
m_children.insert_before_matching(new_child, [&](auto& existing_child) { return existing_child.ptr() == &before_child; });
Core::ChildEvent child_event(Core::Event::ChildAdded, new_child, &before_child);
@ -126,7 +126,7 @@ void Object::remove_child(Object& object)
return;
}
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void Object::remove_all_children()
@ -151,7 +151,7 @@ void Object::start_timer(int ms, TimerShouldFireWhenNotVisible fire_when_not_vis
{
if (m_timer_id) {
dbgln("{} {:p} already has a timer!", class_name(), this);
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
m_timer_id = Core::EventLoop::register_timer(*this, ms, true, fire_when_not_visible);
@ -162,7 +162,7 @@ void Object::stop_timer()
if (!m_timer_id)
return;
bool success = Core::EventLoop::unregister_timer(m_timer_id);
ASSERT(success);
VERIFY(success);
m_timer_id = 0;
}
@ -224,7 +224,7 @@ bool Object::is_ancestor_of(const Object& other) const
void Object::dispatch_event(Core::Event& e, Object* stay_within)
{
ASSERT(!stay_within || stay_within == this || stay_within->is_ancestor_of(*this));
VERIFY(!stay_within || stay_within == this || stay_within->is_ancestor_of(*this));
auto* target = this;
do {
target->event(e);

View file

@ -86,21 +86,21 @@ bool Socket::connect(const String& hostname, int port)
void Socket::set_blocking(bool blocking)
{
int flags = fcntl(fd(), F_GETFL, 0);
ASSERT(flags >= 0);
VERIFY(flags >= 0);
if (blocking)
flags = fcntl(fd(), F_SETFL, flags & ~O_NONBLOCK);
else
flags = fcntl(fd(), F_SETFL, flags | O_NONBLOCK);
ASSERT(flags == 0);
VERIFY(flags == 0);
}
bool Socket::connect(const SocketAddress& address, int port)
{
ASSERT(!is_connected());
ASSERT(address.type() == SocketAddress::Type::IPv4);
VERIFY(!is_connected());
VERIFY(address.type() == SocketAddress::Type::IPv4);
dbgln_if(CSOCKET_DEBUG, "{} connecting to {}...", *this, address);
ASSERT(port > 0 && port <= 65535);
VERIFY(port > 0 && port <= 65535);
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
@ -117,8 +117,8 @@ bool Socket::connect(const SocketAddress& address, int port)
bool Socket::connect(const SocketAddress& address)
{
ASSERT(!is_connected());
ASSERT(address.type() == SocketAddress::Type::Local);
VERIFY(!is_connected());
VERIFY(address.type() == SocketAddress::Type::Local);
dbgln_if(CSOCKET_DEBUG, "{} connecting to {}...", *this, address);
sockaddr_un saddr;
@ -183,7 +183,7 @@ bool Socket::send(ReadonlyBytes data)
set_error(errno);
return false;
}
ASSERT(static_cast<size_t>(nsent) == data.size());
VERIFY(static_cast<size_t>(nsent) == data.size());
return true;
}
@ -204,13 +204,13 @@ void Socket::did_update_fd(int fd)
ensure_read_notifier();
} else {
// I don't think it would be right if we updated the fd while not connected *but* while having a notifier..
ASSERT(!m_read_notifier);
VERIFY(!m_read_notifier);
}
}
void Socket::ensure_read_notifier()
{
ASSERT(m_connected);
VERIFY(m_connected);
m_read_notifier = Notifier::construct(fd(), Notifier::Event::Read, this);
m_read_notifier->on_ready_to_read = [this] {
if (!can_read())

View file

@ -78,7 +78,7 @@ protected:
virtual bool common_connect(const struct sockaddr*, socklen_t);
private:
virtual bool open(IODevice::OpenMode) override { ASSERT_NOT_REACHED(); }
virtual bool open(IODevice::OpenMode) override { VERIFY_NOT_REACHED(); }
void ensure_read_notifier();
Type m_type { Type::Invalid };

View file

@ -84,7 +84,7 @@ public:
Optional<sockaddr_un> to_sockaddr_un() const
{
ASSERT(type() == Type::Local);
VERIFY(type() == Type::Local);
sockaddr_un address;
address.sun_family = AF_LOCAL;
bool fits = m_local_address.copy_characters_to_buffer(address.sun_path, sizeof(address.sun_path));
@ -95,7 +95,7 @@ public:
sockaddr_in to_sockaddr_in() const
{
ASSERT(type() == Type::IPv4);
VERIFY(type() == Type::IPv4);
sockaddr_in address {};
address.sin_family = AF_INET;
address.sin_addr.s_addr = m_ipv4_address.to_in_addr_t();

View file

@ -49,7 +49,7 @@ inline int safe_syscall(Syscall syscall, Args&&... args)
if (errno == EINTR)
continue;
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
return sysret;
}

View file

@ -49,7 +49,7 @@ TCPServer::TCPServer(Object* parent)
ioctl(m_fd, FIONBIO, &option);
fcntl(m_fd, F_SETFD, FD_CLOEXEC);
#endif
ASSERT(m_fd >= 0);
VERIFY(m_fd >= 0);
}
TCPServer::~TCPServer()
@ -85,7 +85,7 @@ bool TCPServer::listen(const IPv4Address& address, u16 port)
RefPtr<TCPSocket> TCPServer::accept()
{
ASSERT(m_listening);
VERIFY(m_listening);
sockaddr_in in;
socklen_t in_size = sizeof(in);
int accepted_fd = ::accept(m_fd, (sockaddr*)&in, &in_size);

View file

@ -50,7 +50,7 @@ UDPServer::UDPServer(Object* parent)
ioctl(m_fd, FIONBIO, &option);
fcntl(m_fd, F_SETFD, FD_CLOEXEC);
#endif
ASSERT(m_fd >= 0);
VERIFY(m_fd >= 0);
}
UDPServer::~UDPServer()