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

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

Issue 1530783003: add fsync to try to get complete skps from webpage picture capture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: exclude android and friends that may not define fileno Created 5 years 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/core/SkStream.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 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
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 sk_fflush(f);
148 #if !defined(_WIN32) && !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) \
mtklein 2015/12/16 15:30:10 If we want to try Windows too, I think it's someth
149 && !defined(_NEWLIB_VERSION)
150 int fd = ::fileno(f);
151 ::fsync(fd);
152 #endif
153 }
154
146 bool sk_fseek(FILE* f, size_t byteCount) { 155 bool sk_fseek(FILE* f, size_t byteCount) {
147 int err = ::fseek(f, (long)byteCount, SEEK_SET); 156 int err = ::fseek(f, (long)byteCount, SEEK_SET);
148 return err == 0; 157 return err == 0;
149 } 158 }
150 159
151 bool sk_fmove(FILE* f, long byteCount) { 160 bool sk_fmove(FILE* f, long byteCount) {
152 int err = ::fseek(f, byteCount, SEEK_CUR); 161 int err = ::fseek(f, byteCount, SEEK_CUR);
153 return err == 0; 162 return err == 0;
154 } 163 }
155 164
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 #else 200 #else
192 retval = mkdir(path, 0777); 201 retval = mkdir(path, 0777);
193 #endif 202 #endif
194 if (0 == retval) { 203 if (0 == retval) {
195 return true; 204 return true;
196 } else { 205 } else {
197 fprintf(stderr, "sk_mkdir: error %d creating dir '%s'\n", errno, path); 206 fprintf(stderr, "sk_mkdir: error %d creating dir '%s'\n", errno, path);
198 return false; 207 return false;
199 } 208 }
200 } 209 }
OLDNEW
« no previous file with comments | « src/core/SkStream.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698