| 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 "SkStream.h" | 10 #include "SkStream.h" |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 return true; | 456 return true; |
| 457 } | 457 } |
| 458 | 458 |
| 459 void SkFILEWStream::flush() | 459 void SkFILEWStream::flush() |
| 460 { | 460 { |
| 461 if (fFILE) { | 461 if (fFILE) { |
| 462 sk_fflush(fFILE); | 462 sk_fflush(fFILE); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 void SkFILEWStream::fsync() |
| 467 { |
| 468 flush(); |
| 469 if (fFILE) { |
| 470 sk_fsync(fFILE); |
| 471 } |
| 472 } |
| 473 |
| 466 //////////////////////////////////////////////////////////////////////// | 474 //////////////////////////////////////////////////////////////////////// |
| 467 | 475 |
| 468 SkMemoryWStream::SkMemoryWStream(void* buffer, size_t size) | 476 SkMemoryWStream::SkMemoryWStream(void* buffer, size_t size) |
| 469 : fBuffer((char*)buffer), fMaxLength(size), fBytesWritten(0) | 477 : fBuffer((char*)buffer), fMaxLength(size), fBytesWritten(0) |
| 470 { | 478 { |
| 471 } | 479 } |
| 472 | 480 |
| 473 bool SkMemoryWStream::write(const void* buffer, size_t size) { | 481 bool SkMemoryWStream::write(const void* buffer, size_t size) { |
| 474 size = SkTMin(size, fMaxLength - fBytesWritten); | 482 size = SkTMin(size, fMaxLength - fBytesWritten); |
| 475 if (size > 0) { | 483 if (size > 0) { |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 while (true) { | 977 while (true) { |
| 970 count = input->read(scratch, sizeof(scratch)); | 978 count = input->read(scratch, sizeof(scratch)); |
| 971 if (0 == count) { | 979 if (0 == count) { |
| 972 return true; | 980 return true; |
| 973 } | 981 } |
| 974 if (!out->write(scratch, count)) { | 982 if (!out->write(scratch, count)) { |
| 975 return false; | 983 return false; |
| 976 } | 984 } |
| 977 } | 985 } |
| 978 } | 986 } |
| OLD | NEW |