OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 #include "SkTypes.h" | 9 #include "SkTypes.h" |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 bool sk_frewind(SkFILE* f) { | 65 bool sk_frewind(SkFILE* f) { |
66 SkASSERT(f); | 66 SkASSERT(f); |
67 ::rewind((FILE*)f); | 67 ::rewind((FILE*)f); |
68 return true; | 68 return true; |
69 } | 69 } |
70 | 70 |
71 size_t sk_fread(void* buffer, size_t byteCount, SkFILE* f) { | 71 size_t sk_fread(void* buffer, size_t byteCount, SkFILE* f) { |
72 SkASSERT(f); | 72 SkASSERT(f); |
73 if (buffer == NULL) { | 73 if (buffer == nullptr) { |
74 size_t curr = ::ftell((FILE*)f); | 74 size_t curr = ::ftell((FILE*)f); |
75 if ((long)curr == -1) { | 75 if ((long)curr == -1) { |
76 SkDEBUGF(("sk_fread: ftell(%p) returned -1 feof:%d ferror:%d\n", f,
feof((FILE*)f), ferror((FILE*)f))); | 76 SkDEBUGF(("sk_fread: ftell(%p) returned -1 feof:%d ferror:%d\n", f,
feof((FILE*)f), ferror((FILE*)f))); |
77 return 0; | 77 return 0; |
78 } | 78 } |
79 int err = ::fseek((FILE*)f, (long)byteCount, SEEK_CUR); | 79 int err = ::fseek((FILE*)f, (long)byteCount, SEEK_CUR); |
80 if (err != 0) { | 80 if (err != 0) { |
81 SkDEBUGF(("sk_fread: fseek(%d) tell:%d failed with feof:%d ferror:%d
returned:%d\n", | 81 SkDEBUGF(("sk_fread: fseek(%d) tell:%d failed with feof:%d ferror:%d
returned:%d\n", |
82 byteCount, curr, feof((FILE*)f), ferror((FILE*)f), err))
; | 82 byteCount, curr, feof((FILE*)f), ferror((FILE*)f), err))
; |
83 return 0; | 83 return 0; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 #else | 146 #else |
147 retval = mkdir(path, 0777); | 147 retval = mkdir(path, 0777); |
148 #endif | 148 #endif |
149 if (0 == retval) { | 149 if (0 == retval) { |
150 return true; | 150 return true; |
151 } else { | 151 } else { |
152 fprintf(stderr, "sk_mkdir: error %d creating dir '%s'\n", errno, path); | 152 fprintf(stderr, "sk_mkdir: error %d creating dir '%s'\n", errno, path); |
153 return false; | 153 return false; |
154 } | 154 } |
155 } | 155 } |
OLD | NEW |