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

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 1142713005: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing FX_Alloc2D, check overflow on add, remove unused enum. 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/fxge/win32/fx_win32_print.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Edit.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 // 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 "../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../third_party/base/nonstd_unique_ptr.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fsdk_mgr.h" 9 #include "../include/fsdk_mgr.h"
10 #include "../include/fsdk_baseannot.h" 10 #include "../include/fsdk_baseannot.h"
(...skipping 2334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2345 CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(c sWValue); 2345 CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(c sWValue);
2346 2346
2347 fdfEncodedData = fdfEncodedData<<name_b.GetBuffer(name_b .GetLength()); 2347 fdfEncodedData = fdfEncodedData<<name_b.GetBuffer(name_b .GetLength());
2348 name_b.ReleaseBuffer(); 2348 name_b.ReleaseBuffer();
2349 fdfEncodedData = fdfEncodedData<<"="; 2349 fdfEncodedData = fdfEncodedData<<"=";
2350 fdfEncodedData = fdfEncodedData<<csValue_b.GetBuffer(csV alue_b.GetLength()); 2350 fdfEncodedData = fdfEncodedData<<csValue_b.GetBuffer(csV alue_b.GetLength());
2351 csValue_b.ReleaseBuffer(); 2351 csValue_b.ReleaseBuffer();
2352 if(i != pFields->GetCount()-1) 2352 if(i != pFields->GetCount()-1)
2353 fdfEncodedData = fdfEncodedData<<"&"; 2353 fdfEncodedData = fdfEncodedData<<"&";
2354 } 2354 }
2355 » » 2355
2356 nBufSize = fdfEncodedData.GetLength(); 2356 nBufSize = fdfEncodedData.GetLength();
2357 pBuf = FX_Alloc(FX_BYTE, nBufSize); 2357 pBuf = FX_Alloc(FX_BYTE, nBufSize);
2358 if(!pBuf)
2359 return FALSE;
2360 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); 2358 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
2361
2362 } 2359 }
2363 return TRUE; 2360 return TRUE;
2364 } 2361 }
2365 2362
2366 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,F X_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf) 2363 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,F X_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf)
2367 { 2364 {
2368 ASSERT(m_pDocument != NULL); 2365 ASSERT(m_pDocument != NULL);
2369 ASSERT(m_pInterForm != NULL); 2366 ASSERT(m_pInterForm != NULL);
2370 2367
2371 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath(),( CFX_PtrArray&)fields, bIncludeOrExclude); 2368 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath(),( CFX_PtrArray&)fields, bIncludeOrExclude);
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2996 2993
2997 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 2994 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
2998 ASSERT(pPDFAnnot != NULL); 2995 ASSERT(pPDFAnnot != NULL);
2999 2996
3000 CPDF_Rect rcAnnot; 2997 CPDF_Rect rcAnnot;
3001 pPDFAnnot->GetRect(rcAnnot); 2998 pPDFAnnot->GetRect(rcAnnot);
3002 2999
3003 return rcAnnot; 3000 return rcAnnot;
3004 } 3001 }
3005 3002
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_print.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Edit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698