mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:57:45 +00:00
LibCore+Everywhere: Move OpenMode out of IODevice
...and make it an enum class so people don't omit "OpenMode".
This commit is contained in:
parent
422ef7904e
commit
a91a49337c
113 changed files with 180 additions and 177 deletions
|
@ -23,7 +23,7 @@ Mixer::Mixer()
|
|||
},
|
||||
"AudioServer[mixer]"))
|
||||
{
|
||||
if (!m_device->open(Core::IODevice::WriteOnly)) {
|
||||
if (!m_device->open(Core::OpenMode::WriteOnly)) {
|
||||
dbgln("Can't open audio device: {}", m_device->error_string());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ static bool compress_coredump(const String& coredump_path)
|
|||
return false;
|
||||
}
|
||||
auto output_path = String::formatted("{}.gz", coredump_path);
|
||||
auto output_file_or_error = Core::File::open(output_path, Core::File::WriteOnly);
|
||||
auto output_file_or_error = Core::File::open(output_path, Core::OpenMode::WriteOnly);
|
||||
if (output_file_or_error.is_error()) {
|
||||
dbgln("Could not open '{}' for writing: {}", output_path, output_file_or_error.error());
|
||||
return false;
|
||||
|
|
|
@ -169,7 +169,7 @@ void DHCPv4Client::try_discover_deferred_ifs()
|
|||
Result<DHCPv4Client::Interfaces, String> DHCPv4Client::get_discoverable_interfaces()
|
||||
{
|
||||
auto file = Core::File::construct("/proc/net/adapters");
|
||||
if (!file->open(Core::IODevice::ReadOnly)) {
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
dbgln("Error: Failed to open /proc/net/adapters: {}", file->error_string());
|
||||
return String { file->error_string() };
|
||||
}
|
||||
|
|
|
@ -127,12 +127,12 @@ int perform_copy(const String& source, const String& destination)
|
|||
continue;
|
||||
}
|
||||
VERIFY(item.type == WorkItem::Type::CopyFile);
|
||||
auto source_file_or_error = Core::File::open(item.source, Core::File::ReadOnly);
|
||||
auto source_file_or_error = Core::File::open(item.source, Core::OpenMode::ReadOnly);
|
||||
if (source_file_or_error.is_error()) {
|
||||
report_warning(String::formatted("Failed to open {} for reading: {}", item.source, source_file_or_error.error()));
|
||||
return 1;
|
||||
}
|
||||
auto destination_file_or_error = Core::File::open(item.destination, (Core::IODevice::OpenMode)(Core::File::WriteOnly | Core::File::Truncate));
|
||||
auto destination_file_or_error = Core::File::open(item.destination, (Core::OpenMode)(Core::OpenMode::WriteOnly | Core::OpenMode::Truncate));
|
||||
if (destination_file_or_error.is_error()) {
|
||||
report_warning(String::formatted("Failed to open {} for write: {}", item.destination, destination_file_or_error.error()));
|
||||
return 1;
|
||||
|
|
|
@ -79,7 +79,7 @@ void LookupServer::load_etc_hosts()
|
|||
};
|
||||
|
||||
auto file = Core::File::construct("/etc/hosts");
|
||||
if (!file->open(Core::IODevice::ReadOnly))
|
||||
if (!file->open(Core::OpenMode::ReadOnly))
|
||||
return;
|
||||
while (!file->eof()) {
|
||||
auto line = file->read_line(1024);
|
||||
|
|
|
@ -114,7 +114,7 @@ ssize_t MulticastDNS::emit_packet(const DNSPacket& packet, const sockaddr_in* de
|
|||
Vector<IPv4Address> MulticastDNS::local_addresses() const
|
||||
{
|
||||
auto file = Core::File::construct("/proc/net/adapters");
|
||||
if (!file->open(Core::IODevice::ReadOnly)) {
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
dbgln("Failed to open /proc/net/adapters: {}", file->error_string());
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ static void sigchld_handler(int)
|
|||
static void parse_boot_mode()
|
||||
{
|
||||
auto f = Core::File::construct("/proc/cmdline");
|
||||
if (!f->open(Core::IODevice::ReadOnly)) {
|
||||
if (!f->open(Core::OpenMode::ReadOnly)) {
|
||||
dbgln("Failed to read command line: {}", f->error_string());
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ void Client::handle_request(ReadonlyBytes raw_request)
|
|||
}
|
||||
|
||||
auto file = Core::File::construct(real_path);
|
||||
if (!file->open(Core::File::ReadOnly)) {
|
||||
if (!file->open(Core::OpenMode::ReadOnly)) {
|
||||
send_error_response(404, "Not found!", request);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue