Chromium Code Reviews| 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 799 this->reset(); | 799 this->reset(); |
| 800 return stream; | 800 return stream; |
| 801 } | 801 } |
| 802 | 802 |
| 803 /////////////////////////////////////////////////////////////////////////////// | 803 /////////////////////////////////////////////////////////////////////////////// |
| 804 | 804 |
| 805 void SkDebugWStream::newline() | 805 void SkDebugWStream::newline() |
| 806 { | 806 { |
| 807 #if defined(SK_DEBUG) || defined(SK_DEVELOPER) | 807 #if defined(SK_DEBUG) || defined(SK_DEVELOPER) |
| 808 SkDebugf("\n"); | 808 SkDebugf("\n"); |
| 809 fBytesWritten++; | |
| 809 #endif | 810 #endif |
| 810 } | 811 } |
| 811 | 812 |
| 812 bool SkDebugWStream::write(const void* buffer, size_t size) | 813 bool SkDebugWStream::write(const void* buffer, size_t size) |
| 813 { | 814 { |
| 814 #if defined(SK_DEBUG) || defined(SK_DEVELOPER) | 815 #if defined(SK_DEBUG) || defined(SK_DEVELOPER) |
| 815 char* s = new char[size+1]; | 816 char* s = new char[size+1]; |
| 816 memcpy(s, buffer, size); | 817 memcpy(s, buffer, size); |
| 817 s[size] = 0; | 818 s[size] = 0; |
| 818 SkDebugf("%s", s); | 819 SkDebugf("%s", s); |
| 819 delete[] s; | 820 delete[] s; |
| 821 fBytesWritten += size+1; | |
| 820 #endif | 822 #endif |
|
hal.canary
2014/03/06 18:23:45
are you sure this isn't just size? printf doesn't
mtklein
2014/03/06 18:28:11
Oh, good catch. This should be += size.
It seems
| |
| 821 return true; | 823 return true; |
| 822 } | 824 } |
| 823 | 825 |
| 824 /////////////////////////////////////////////////////////////////////////////// | 826 /////////////////////////////////////////////////////////////////////////////// |
| 825 /////////////////////////////////////////////////////////////////////////////// | 827 /////////////////////////////////////////////////////////////////////////////// |
| 826 | 828 |
| 827 | 829 |
| 828 static SkData* mmap_filename(const char path[]) { | 830 static SkData* mmap_filename(const char path[]) { |
| 829 SkFILE* file = sk_fopen(path, kRead_SkFILE_Flag); | 831 SkFILE* file = sk_fopen(path, kRead_SkFILE_Flag); |
| 830 if (NULL == file) { | 832 if (NULL == file) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 844 | 846 |
| 845 // If we get here, then our attempt at using mmap failed, so try normal | 847 // If we get here, then our attempt at using mmap failed, so try normal |
| 846 // file access. | 848 // file access. |
| 847 SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path)); | 849 SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path)); |
| 848 if (!stream->isValid()) { | 850 if (!stream->isValid()) { |
| 849 stream->unref(); | 851 stream->unref(); |
| 850 stream = NULL; | 852 stream = NULL; |
| 851 } | 853 } |
| 852 return stream; | 854 return stream; |
| 853 } | 855 } |
| OLD | NEW |