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

Side by Side Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp

Issue 372473003: Remove custom memory manager (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Change malloc to calloc Created 6 years, 5 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/include/fxcrt/fx_xml.h ('k') | core/src/fpdfapi/fpdf_font/fpdf_font_cid.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 "../../../include/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../fpdf_page/pageint.h" 9 #include "../fpdf_page/pageint.h"
10 #include <limits.h> 10 #include <limits.h>
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 iLength = FXSYS_strlen(pLang); 536 iLength = FXSYS_strlen(pLang);
537 } 537 }
538 FX_UINT32 uHash = FX_GetLangHashCode(pLang); 538 FX_UINT32 uHash = FX_GetLangHashCode(pLang);
539 return FX_GetCsFromLangCode(uHash); 539 return FX_GetCsFromLangCode(uHash);
540 } 540 }
541 static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest) 541 static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest)
542 { 542 {
543 SInt32 len = CFStringGetLength(src); 543 SInt32 len = CFStringGetLength(src);
544 CFRange range = CFRangeMake(0, len); 544 CFRange range = CFRangeMake(0, len);
545 CFIndex used = 0; 545 CFIndex used = 0;
546 UInt8* pBuffer = (UInt8*)malloc(sizeof(UInt8) * (len + 1)); 546 UInt8* pBuffer = (UInt8*)calloc(len+1, sizeof(UInt8));
547 FXSYS_memset32(pBuffer, 0, sizeof(UInt8) * (len + 1));
548 CFStringGetBytes(src, range, kCFStringEncodingASCII, 0, false, pBuffer, len, &used); 547 CFStringGetBytes(src, range, kCFStringEncodingASCII, 0, false, pBuffer, len, &used);
549 dest = (FX_LPSTR)pBuffer; 548 dest = (FX_LPSTR)pBuffer;
550 free(pBuffer); 549 free(pBuffer);
551 } 550 }
552 FX_BOOL IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets) 551 FX_BOOL IsHasCharSet(CFArrayRef languages, const CFX_DWordArray &charSets)
553 { 552 {
554 int iCount = charSets.GetSize(); 553 int iCount = charSets.GetSize();
555 for (int i = 0; i < CFArrayGetCount(languages); ++i) { 554 for (int i = 0; i < CFArrayGetCount(languages); ++i) {
556 CFStringRef language = (CFStringRef)CFArrayGetValueAtIndex(languages, i) ; 555 CFStringRef language = (CFStringRef)CFArrayGetValueAtIndex(languages, i) ;
557 FX_DWORD CharSet = FX_GetCharsetFromLang(CFStringGetCStringPtr(language, kCFStringEncodingMacRoman), -1); 556 FX_DWORD CharSet = FX_GetCharsetFromLang(CFStringGetCStringPtr(language, kCFStringEncodingMacRoman), -1);
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name) 1195 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name)
1197 { 1196 {
1198 if (pPageDict->KeyExist(name)) { 1197 if (pPageDict->KeyExist(name)) {
1199 return; 1198 return;
1200 } 1199 }
1201 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); 1200 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name);
1202 if (pObj) { 1201 if (pObj) {
1203 pPageDict->SetAt(name, pObj->Clone()); 1202 pPageDict->SetAt(name, pObj->Clone());
1204 } 1203 }
1205 } 1204 }
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_xml.h ('k') | core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698