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

Side by Side Diff: src/ports/SkOSFile_win.cpp

Issue 384903002: Add file access modes to sk_exists. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Better comment. Created 6 years, 5 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
« no previous file with comments | « src/ports/SkOSFile_stdio.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkOSFile.h" 8 #include "SkOSFile.h"
9 9
10 #include "SkTFitsIn.h" 10 #include "SkTFitsIn.h"
11 11
12 #include <io.h> 12 #include <io.h>
13 #include <stdio.h> 13 #include <stdio.h>
14 #include <sys/stat.h> 14 #include <sys/stat.h>
15 15
16 bool sk_exists(const char *path, SkFILE_Flags flags) {
17 int mode = 0; // existence
18 if (flags & kRead_SkFILE_Flag) {
19 mode |= 4; // read
20 }
21 if (flags & kWrite_SkFILE_Flag) {
22 mode |= 2; // write
23 }
24 return (0 == _access(path, mode));
25 }
26
16 typedef struct { 27 typedef struct {
17 ULONGLONG fVolume; 28 ULONGLONG fVolume;
18 ULONGLONG fLsbSize; 29 ULONGLONG fLsbSize;
19 ULONGLONG fMsbSize; 30 ULONGLONG fMsbSize;
20 } SkFILEID; 31 } SkFILEID;
21 32
22 static bool sk_ino(SkFILE* f, SkFILEID* id) { 33 static bool sk_ino(SkFILE* f, SkFILEID* id) {
23 int fileno = _fileno((FILE*)f); 34 int fileno = _fileno((FILE*)f);
24 if (fileno < 0) { 35 if (fileno < 0) {
25 return false; 36 return false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 113 }
103 114
104 void* sk_fmmap(SkFILE* f, size_t* length) { 115 void* sk_fmmap(SkFILE* f, size_t* length) {
105 int fileno = sk_fileno(f); 116 int fileno = sk_fileno(f);
106 if (fileno < 0) { 117 if (fileno < 0) {
107 return NULL; 118 return NULL;
108 } 119 }
109 120
110 return sk_fdmmap(fileno, length); 121 return sk_fdmmap(fileno, length);
111 } 122 }
OLDNEW
« no previous file with comments | « src/ports/SkOSFile_stdio.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698