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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 } | 811 } |
812 | 812 |
813 bool SkDebugWStream::write(const void* buffer, size_t size) | 813 bool SkDebugWStream::write(const void* buffer, size_t size) |
814 { | 814 { |
815 #if defined(SK_DEBUG) || defined(SK_DEVELOPER) | 815 #if defined(SK_DEBUG) || defined(SK_DEVELOPER) |
816 char* s = new char[size+1]; | 816 char* s = new char[size+1]; |
817 memcpy(s, buffer, size); | 817 memcpy(s, buffer, size); |
818 s[size] = 0; | 818 s[size] = 0; |
819 SkDebugf("%s", s); | 819 SkDebugf("%s", s); |
820 delete[] s; | 820 delete[] s; |
821 fBytesWritten += size+1; | 821 fBytesWritten += size; |
822 #endif | 822 #endif |
823 return true; | 823 return true; |
824 } | 824 } |
825 | 825 |
826 /////////////////////////////////////////////////////////////////////////////// | 826 /////////////////////////////////////////////////////////////////////////////// |
827 /////////////////////////////////////////////////////////////////////////////// | 827 /////////////////////////////////////////////////////////////////////////////// |
828 | 828 |
829 | 829 |
830 static SkData* mmap_filename(const char path[]) { | 830 static SkData* mmap_filename(const char path[]) { |
831 SkFILE* file = sk_fopen(path, kRead_SkFILE_Flag); | 831 SkFILE* file = sk_fopen(path, kRead_SkFILE_Flag); |
(...skipping 14 matching lines...) Expand all Loading... |
846 | 846 |
847 // 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 |
848 // file access. | 848 // file access. |
849 SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path)); | 849 SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path)); |
850 if (!stream->isValid()) { | 850 if (!stream->isValid()) { |
851 stream->unref(); | 851 stream->unref(); |
852 stream = NULL; | 852 stream = NULL; |
853 } | 853 } |
854 return stream; | 854 return stream; |
855 } | 855 } |
OLD | NEW |