OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 char perm[4]; | 26 char perm[4]; |
27 char* p = perm; | 27 char* p = perm; |
28 | 28 |
29 if (flags & kRead_SkFILE_Flag) | 29 if (flags & kRead_SkFILE_Flag) |
30 *p++ = 'r'; | 30 *p++ = 'r'; |
31 if (flags & kWrite_SkFILE_Flag) | 31 if (flags & kWrite_SkFILE_Flag) |
32 *p++ = 'w'; | 32 *p++ = 'w'; |
33 *p++ = 'b'; | 33 *p++ = 'b'; |
34 *p = 0; | 34 *p = 0; |
35 | 35 |
| 36 //TODO: on Windows fopen is just ASCII or the current code page, |
| 37 //convert to utf16 and use _wfopen |
36 SkFILE* f = (SkFILE*)::fopen(path, perm); | 38 SkFILE* f = (SkFILE*)::fopen(path, perm); |
37 #if 0 | 39 #if 0 |
38 if (NULL == f) | 40 if (NULL == f) |
39 SkDebugf("sk_fopen failed for %s (%s), errno=%s\n", path, perm, strerror
(errno)); | 41 SkDebugf("sk_fopen failed for %s (%s), errno=%s\n", path, perm, strerror
(errno)); |
40 #endif | 42 #endif |
41 return f; | 43 return f; |
42 } | 44 } |
43 | 45 |
44 char* sk_fgets(char* str, int size, SkFILE* f) { | 46 char* sk_fgets(char* str, int size, SkFILE* f) { |
45 return ::fgets(str, size, (FILE *)f); | 47 return ::fgets(str, size, (FILE *)f); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 #else | 155 #else |
154 retval = mkdir(path, 0777); | 156 retval = mkdir(path, 0777); |
155 #endif | 157 #endif |
156 if (0 == retval) { | 158 if (0 == retval) { |
157 return true; | 159 return true; |
158 } else { | 160 } else { |
159 fprintf(stderr, "sk_mkdir: error %d creating dir '%s'\n", errno, path); | 161 fprintf(stderr, "sk_mkdir: error %d creating dir '%s'\n", errno, path); |
160 return false; | 162 return false; |
161 } | 163 } |
162 } | 164 } |
OLD | NEW |