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

Side by Side Diff: src/core/SkStream.cpp

Issue 1467533003: Eliminate SkFILE - it always is the same as FILE. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-11-20 (Friday) 14:01:26 EST Created 5 years, 1 month 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/SkData.cpp ('k') | src/ports/SkOSFile_posix.cpp » ('j') | 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 /* 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 return true; 178 return true;
179 } 179 }
180 180
181 /////////////////////////////////////////////////////////////////////////////// 181 ///////////////////////////////////////////////////////////////////////////////
182 182
183 SkFILEStream::SkFILEStream(const char file[]) : fName(file), fOwnership(kCallerP asses_Ownership) { 183 SkFILEStream::SkFILEStream(const char file[]) : fName(file), fOwnership(kCallerP asses_Ownership) {
184 fFILE = file ? sk_fopen(fName.c_str(), kRead_SkFILE_Flag) : nullptr; 184 fFILE = file ? sk_fopen(fName.c_str(), kRead_SkFILE_Flag) : nullptr;
185 } 185 }
186 186
187 SkFILEStream::SkFILEStream(FILE* file, Ownership ownership) 187 SkFILEStream::SkFILEStream(FILE* file, Ownership ownership)
188 : fFILE((SkFILE*)file) 188 : fFILE(file)
189 , fOwnership(ownership) { 189 , fOwnership(ownership) {
190 } 190 }
191 191
192 SkFILEStream::~SkFILEStream() { 192 SkFILEStream::~SkFILEStream() {
193 if (fFILE && fOwnership != kCallerRetains_Ownership) { 193 if (fFILE && fOwnership != kCallerRetains_Ownership) {
194 sk_fclose(fFILE); 194 sk_fclose(fFILE);
195 } 195 }
196 } 196 }
197 197
198 void SkFILEStream::setPath(const char path[]) { 198 void SkFILEStream::setPath(const char path[]) {
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 fBytesWritten += size; 843 fBytesWritten += size;
844 #endif 844 #endif
845 return true; 845 return true;
846 } 846 }
847 847
848 /////////////////////////////////////////////////////////////////////////////// 848 ///////////////////////////////////////////////////////////////////////////////
849 /////////////////////////////////////////////////////////////////////////////// 849 ///////////////////////////////////////////////////////////////////////////////
850 850
851 851
852 static SkData* mmap_filename(const char path[]) { 852 static SkData* mmap_filename(const char path[]) {
853 SkFILE* file = sk_fopen(path, kRead_SkFILE_Flag); 853 FILE* file = sk_fopen(path, kRead_SkFILE_Flag);
854 if (nullptr == file) { 854 if (nullptr == file) {
855 return nullptr; 855 return nullptr;
856 } 856 }
857 857
858 SkData* data = SkData::NewFromFILE(file); 858 SkData* data = SkData::NewFromFILE(file);
859 sk_fclose(file); 859 sk_fclose(file);
860 return data; 860 return data;
861 } 861 }
862 862
863 SkStreamAsset* SkStream::NewFromFile(const char path[]) { 863 SkStreamAsset* SkStream::NewFromFile(const char path[]) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 while (true) { 972 while (true) {
973 count = input->read(scratch, sizeof(scratch)); 973 count = input->read(scratch, sizeof(scratch));
974 if (0 == count) { 974 if (0 == count) {
975 return true; 975 return true;
976 } 976 }
977 if (!out->write(scratch, count)) { 977 if (!out->write(scratch, count)) {
978 return false; 978 return false;
979 } 979 }
980 } 980 }
981 } 981 }
OLDNEW
« no previous file with comments | « src/core/SkData.cpp ('k') | src/ports/SkOSFile_posix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698