diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-30 08:57:01 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-30 08:57:01 +0200 |
commit | 8f45a259fc9f8180b366cbaccac1af6d368e3b3a (patch) | |
tree | 5045baec395404f39728611190925f4ce39c2ae4 /Userland | |
parent | dd696e7c75c5fb630d10d0ce37e53d88fecb58a0 (diff) | |
download | serenity-8f45a259fc9f8180b366cbaccac1af6d368e3b3a.zip |
ByteBuffer: Remove pointer() in favor of data()
We had two ways to get the data inside a ByteBuffer. That was silly.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/disk_benchmark.cpp | 4 | ||||
-rw-r--r-- | Userland/sysctl.cpp | 2 | ||||
-rw-r--r-- | Userland/tail.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/Userland/disk_benchmark.cpp b/Userland/disk_benchmark.cpp index e6f09fe441..65c9acbe3f 100644 --- a/Userland/disk_benchmark.cpp +++ b/Userland/disk_benchmark.cpp @@ -129,7 +129,7 @@ Result benchmark(const String& filename, int file_size, int block_size, ByteBuff timer.start(); int nwrote = 0; for (int j = 0; j < file_size; j += block_size) { - int n = write(fd, buffer.pointer(), block_size); + int n = write(fd, buffer.data(), block_size); if (n < 0) { perror("write"); cleanup_and_exit(); @@ -146,7 +146,7 @@ Result benchmark(const String& filename, int file_size, int block_size, ByteBuff timer.start(); int nread = 0; while (nread < file_size) { - int n = read(fd, buffer.pointer(), block_size); + int n = read(fd, buffer.data(), block_size); if (n < 0) { perror("read"); cleanup_and_exit(); diff --git a/Userland/sysctl.cpp b/Userland/sysctl.cpp index ce11eb1921..aaac957537 100644 --- a/Userland/sysctl.cpp +++ b/Userland/sysctl.cpp @@ -27,7 +27,7 @@ static String read_var(const String& name) fprintf(stderr, "read: %s", f->error_string()); exit(1); } - return String((const char*)b.pointer(), b.size(), Chomp); + return String((const char*)b.data(), b.size(), Chomp); } static void write_var(const String& name, const String& value) diff --git a/Userland/tail.cpp b/Userland/tail.cpp index 1822d9705e..ac623f46ed 100644 --- a/Userland/tail.cpp +++ b/Userland/tail.cpp @@ -28,7 +28,7 @@ int tail_from_pos(CFile& file, off_t startline, bool want_follow) } } - if (write(STDOUT_FILENO, b.pointer(), b.size()) < 0) + if (write(STDOUT_FILENO, b.data(), b.size()) < 0) return 1; } @@ -57,7 +57,7 @@ off_t find_seek_pos(CFile& file, int wanted_lines) // Presumably the file got truncated? // Keep trying to read backwards... } else { - if (*ch.pointer() == '\n' && (end - pos) > 1) { + if (*ch.data() == '\n' && (end - pos) > 1) { lines++; if (lines == wanted_lines) break; |