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

Side by Side Diff: fusl/src/stdio/__fmodeflags.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 <fcntl.h> 1 #include <fcntl.h>
2 #include <string.h> 2 #include <string.h>
3 3
4 int __fmodeflags(const char *mode) 4 int __fmodeflags(const char* mode) {
5 { 5 int flags;
6 » int flags; 6 if (strchr(mode, '+'))
7 » if (strchr(mode, '+')) flags = O_RDWR; 7 flags = O_RDWR;
8 » else if (*mode == 'r') flags = O_RDONLY; 8 else if (*mode == 'r')
9 » else flags = O_WRONLY; 9 flags = O_RDONLY;
10 » if (strchr(mode, 'x')) flags |= O_EXCL; 10 else
11 » if (strchr(mode, 'e')) flags |= O_CLOEXEC; 11 flags = O_WRONLY;
12 » if (*mode != 'r') flags |= O_CREAT; 12 if (strchr(mode, 'x'))
13 » if (*mode == 'w') flags |= O_TRUNC; 13 flags |= O_EXCL;
14 » if (*mode == 'a') flags |= O_APPEND; 14 if (strchr(mode, 'e'))
15 » return flags; 15 flags |= O_CLOEXEC;
16 if (*mode != 'r')
17 flags |= O_CREAT;
18 if (*mode == 'w')
19 flags |= O_TRUNC;
20 if (*mode == 'a')
21 flags |= O_APPEND;
22 return flags;
16 } 23 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698