mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:17:35 +00:00
LibCore: Convert CFile to ObjectPtr
This commit is contained in:
parent
31b38ed88f
commit
8d550c174e
30 changed files with 135 additions and 134 deletions
|
@ -4,14 +4,14 @@
|
|||
#include <limits>
|
||||
|
||||
ASMixer::ASMixer()
|
||||
: m_device("/dev/audio", this)
|
||||
: m_device(CFile::construct("/dev/audio", this))
|
||||
, m_sound_thread([this] {
|
||||
mix();
|
||||
return 0;
|
||||
})
|
||||
{
|
||||
if (!m_device.open(CIODevice::WriteOnly)) {
|
||||
dbgprintf("Can't open audio device: %s\n", m_device.error_string());
|
||||
if (!m_device->open(CIODevice::WriteOnly)) {
|
||||
dbgprintf("Can't open audio device: %s\n", m_device->error_string());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void ASMixer::mix()
|
|||
|
||||
if (stream.offset() != 0) {
|
||||
buffer.trim(stream.offset());
|
||||
m_device.write(buffer);
|
||||
m_device->write(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
private:
|
||||
Vector<NonnullRefPtr<ASBufferQueue>> m_pending_mixing;
|
||||
|
||||
CFile m_device;
|
||||
ObjectPtr<CFile> m_device;
|
||||
LibThread::Lock m_lock;
|
||||
|
||||
LibThread::Thread m_sound_thread;
|
||||
|
|
|
@ -35,11 +35,11 @@ static String parse_dns_name(const u8*, int& offset, int max_offset);
|
|||
static void load_etc_hosts()
|
||||
{
|
||||
dbgprintf("LookupServer: Loading hosts from /etc/hosts\n");
|
||||
CFile file("/etc/hosts");
|
||||
if (!file.open(CIODevice::ReadOnly))
|
||||
auto file = CFile::construct("/etc/hosts");
|
||||
if (!file->open(CIODevice::ReadOnly))
|
||||
return;
|
||||
while (!file.eof()) {
|
||||
auto line = file.read_line(1024);
|
||||
while (!file->eof()) {
|
||||
auto line = file->read_line(1024);
|
||||
if (line.is_empty())
|
||||
break;
|
||||
auto str_line = String((const char*)line.pointer(), line.size() - 1, Chomp);
|
||||
|
|
|
@ -58,12 +58,12 @@ void start_process(const String& program, const Vector<String>& arguments, int p
|
|||
|
||||
static void check_for_test_mode()
|
||||
{
|
||||
CFile f("/proc/cmdline");
|
||||
if (!f.open(CIODevice::ReadOnly)) {
|
||||
dbg() << "Failed to read command line: " << f.error_string();
|
||||
auto f = CFile::construct("/proc/cmdline");
|
||||
if (!f->open(CIODevice::ReadOnly)) {
|
||||
dbg() << "Failed to read command line: " << f->error_string();
|
||||
ASSERT(false);
|
||||
}
|
||||
const String cmd = String::copy(f.read_all());
|
||||
const String cmd = String::copy(f->read_all());
|
||||
dbg() << "Read command line: " << cmd;
|
||||
if (cmd.matches("*testmode=1*")) {
|
||||
// Eventually, we should run a test binary and wait for it to finish
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue