Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: fusl/src/stdio/__stdio_read.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "stdio_impl.h" 1 #include "stdio_impl.h"
2 #include <sys/uio.h> 2 #include <sys/uio.h>
3 3
4 size_t __stdio_read(FILE *f, unsigned char *buf, size_t len) 4 size_t __stdio_read(FILE* f, unsigned char* buf, size_t len) {
5 { 5 struct iovec iov[2] = {{.iov_base = buf, .iov_len = len - !!f->buf_size},
6 » struct iovec iov[2] = { 6 {.iov_base = f->buf, .iov_len = f->buf_size}};
7 » » { .iov_base = buf, .iov_len = len - !!f->buf_size }, 7 ssize_t cnt;
8 » » { .iov_base = f->buf, .iov_len = f->buf_size }
9 » };
10 » ssize_t cnt;
11 8
12 » cnt = syscall(SYS_readv, f->fd, iov, 2); 9 cnt = syscall(SYS_readv, f->fd, iov, 2);
13 » if (cnt <= 0) { 10 if (cnt <= 0) {
14 » » f->flags |= F_EOF ^ ((F_ERR^F_EOF) & cnt); 11 f->flags |= F_EOF ^ ((F_ERR ^ F_EOF) & cnt);
15 » » return cnt; 12 return cnt;
16 » } 13 }
17 » if (cnt <= iov[0].iov_len) return cnt; 14 if (cnt <= iov[0].iov_len)
18 » cnt -= iov[0].iov_len; 15 return cnt;
19 » f->rpos = f->buf; 16 cnt -= iov[0].iov_len;
20 » f->rend = f->buf + cnt; 17 f->rpos = f->buf;
21 » if (f->buf_size) buf[len-1] = *f->rpos++; 18 f->rend = f->buf + cnt;
22 » return len; 19 if (f->buf_size)
20 buf[len - 1] = *f->rpos++;
21 return len;
23 } 22 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698