| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 size_t sk_fwrite(const void* buffer, size_t byteCount, FILE* f) { | 136 size_t sk_fwrite(const void* buffer, size_t byteCount, FILE* f) { |
| 137 SkASSERT(f); | 137 SkASSERT(f); |
| 138 return ::fwrite(buffer, 1, byteCount, f); | 138 return ::fwrite(buffer, 1, byteCount, f); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void sk_fflush(FILE* f) { | 141 void sk_fflush(FILE* f) { |
| 142 SkASSERT(f); | 142 SkASSERT(f); |
| 143 ::fflush(f); | 143 ::fflush(f); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void sk_fsync(FILE* f) { |
| 147 #if !defined(_WIN32) && !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) \ |
| 148 && !defined(_NEWLIB_VERSION) |
| 149 int fd = ::fileno(f); |
| 150 ::fsync(fd); |
| 151 #endif |
| 152 } |
| 153 |
| 146 bool sk_fseek(FILE* f, size_t byteCount) { | 154 bool sk_fseek(FILE* f, size_t byteCount) { |
| 147 int err = ::fseek(f, (long)byteCount, SEEK_SET); | 155 int err = ::fseek(f, (long)byteCount, SEEK_SET); |
| 148 return err == 0; | 156 return err == 0; |
| 149 } | 157 } |
| 150 | 158 |
| 151 bool sk_fmove(FILE* f, long byteCount) { | 159 bool sk_fmove(FILE* f, long byteCount) { |
| 152 int err = ::fseek(f, byteCount, SEEK_CUR); | 160 int err = ::fseek(f, byteCount, SEEK_CUR); |
| 153 return err == 0; | 161 return err == 0; |
| 154 } | 162 } |
| 155 | 163 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 #else | 199 #else |
| 192 retval = mkdir(path, 0777); | 200 retval = mkdir(path, 0777); |
| 193 #endif | 201 #endif |
| 194 if (0 == retval) { | 202 if (0 == retval) { |
| 195 return true; | 203 return true; |
| 196 } else { | 204 } else { |
| 197 fprintf(stderr, "sk_mkdir: error %d creating dir '%s'\n", errno, path); | 205 fprintf(stderr, "sk_mkdir: error %d creating dir '%s'\n", errno, path); |
| 198 return false; | 206 return false; |
| 199 } | 207 } |
| 200 } | 208 } |
| OLD | NEW |