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

Side by Side Diff: core/src/fxcrt/fxcrt_posix.cpp

Issue 1143663008: Merge to XFA: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebased. Created 5 years, 7 months 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 | « core/src/fxcrt/fxcrt_platforms.cpp ('k') | core/src/fxcrt/xml_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/fxcrt/fx_ext.h" 7 #include "../../include/fxcrt/fx_ext.h"
8 #include "fxcrt_posix.h" 8 #include "fxcrt_posix.h"
9 #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || _FXM_PLATFORM_ == _FXM_PLATFORM_AP PLE_ || _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ 9 #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || _FXM_PLATFORM_ == _FXM_PLATFORM_AP PLE_ || _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
10 IFXCRT_FileAccess* FXCRT_FileAccess_Create() 10 IFXCRT_FileAccess* FXCRT_FileAccess_Create()
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 FX_FILESIZE size = src.GetSize(); 159 FX_FILESIZE size = src.GetSize();
160 if (!size) { 160 if (!size) {
161 return FALSE; 161 return FALSE;
162 } 162 }
163 if (!dst.Open(fileNameDst, FX_FILEMODE_Truncate)) { 163 if (!dst.Open(fileNameDst, FX_FILEMODE_Truncate)) {
164 return FALSE; 164 return FALSE;
165 } 165 }
166 size_t num = 0; 166 size_t num = 0;
167 FX_LPBYTE pBuffer = FX_Alloc(FX_BYTE, 32768); 167 FX_LPBYTE pBuffer = FX_Alloc(FX_BYTE, 32768);
168 if (!pBuffer) {
169 return FALSE;
170 }
171 num = src.Read(pBuffer, 32768); 168 num = src.Read(pBuffer, 32768);
172 while (num) { 169 while (num) {
173 if (dst.Write(pBuffer, num) != num) { 170 if (dst.Write(pBuffer, num) != num) {
174 break; 171 break;
175 } 172 }
176 num = src.Read(pBuffer, 32768); 173 num = src.Read(pBuffer, 32768);
177 } 174 }
178 FX_Free(pBuffer); 175 FX_Free(pBuffer);
179 return TRUE; 176 return TRUE;
180 } 177 }
181 FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) 178 FX_BOOL FX_File_Copy(FX_WSTR fileNameSrc, FX_WSTR fileNameDst)
182 { 179 {
183 return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); 180 return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst));
184 } 181 }
185 FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) 182 FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
186 { 183 {
187 return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); 184 return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr());
188 } 185 }
189 FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) 186 FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst)
190 { 187 {
191 return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst)); 188 return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst));
192 } 189 }
193 #endif 190 #endif
OLDNEW
« no previous file with comments | « core/src/fxcrt/fxcrt_platforms.cpp ('k') | core/src/fxcrt/xml_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698