mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +00:00
ByteBuffer: Remove pointer() in favor of data()
We had two ways to get the data inside a ByteBuffer. That was silly.
This commit is contained in:
parent
dd696e7c75
commit
8f45a259fc
30 changed files with 89 additions and 92 deletions
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue