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

Side by Side Diff: xfa/fxfa/app/xfa_ffdoc.cpp

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 8 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 | « xfa/fxfa/app/xfa_ffbarcode.cpp ('k') | xfa/fxfa/app/xfa_fontmgr.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 "xfa/include/fxfa/xfa_ffdoc.h" 7 #include "xfa/include/fxfa/xfa_ffdoc.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return m_pPDFDoc; 320 return m_pPDFDoc;
321 } 321 }
322 322
323 CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, 323 CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName,
324 int32_t& iImageXDpi, 324 int32_t& iImageXDpi,
325 int32_t& iImageYDpi) { 325 int32_t& iImageYDpi) {
326 if (!m_pPDFDoc) 326 if (!m_pPDFDoc)
327 return nullptr; 327 return nullptr;
328 328
329 uint32_t dwHash = 329 uint32_t dwHash =
330 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength(), FALSE); 330 FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength(), FALSE);
331 FX_IMAGEDIB_AND_DPI* imageDIBDpi = nullptr; 331 FX_IMAGEDIB_AND_DPI* imageDIBDpi = nullptr;
332 if (m_mapNamedImages.Lookup((void*)(uintptr_t)dwHash, (void*&)imageDIBDpi)) { 332 if (m_mapNamedImages.Lookup((void*)(uintptr_t)dwHash, (void*&)imageDIBDpi)) {
333 iImageXDpi = imageDIBDpi->iImageXDpi; 333 iImageXDpi = imageDIBDpi->iImageXDpi;
334 iImageYDpi = imageDIBDpi->iImageYDpi; 334 iImageYDpi = imageDIBDpi->iImageYDpi;
335 return static_cast<CFX_DIBitmap*>(imageDIBDpi->pDibSource); 335 return static_cast<CFX_DIBitmap*>(imageDIBDpi->pDibSource);
336 } 336 }
337 337
338 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); 338 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
339 if (!pRoot) 339 if (!pRoot)
340 return nullptr; 340 return nullptr;
341 341
342 CPDF_Dictionary* pNames = pRoot->GetDictBy("Names"); 342 CPDF_Dictionary* pNames = pRoot->GetDictBy("Names");
343 if (!pNames) 343 if (!pNames)
344 return nullptr; 344 return nullptr;
345 345
346 CPDF_Dictionary* pXFAImages = pNames->GetDictBy("XFAImages"); 346 CPDF_Dictionary* pXFAImages = pNames->GetDictBy("XFAImages");
347 if (!pXFAImages) 347 if (!pXFAImages)
348 return nullptr; 348 return nullptr;
349 349
350 CPDF_NameTree nametree(pXFAImages); 350 CPDF_NameTree nametree(pXFAImages);
351 CFX_ByteString bsName = PDF_EncodeText(wsName.GetPtr(), wsName.GetLength()); 351 CFX_ByteString bsName = PDF_EncodeText(wsName.raw_str(), wsName.GetLength());
352 CPDF_Object* pObject = nametree.LookupValue(bsName); 352 CPDF_Object* pObject = nametree.LookupValue(bsName);
353 if (!pObject) { 353 if (!pObject) {
354 int32_t iCount = nametree.GetCount(); 354 int32_t iCount = nametree.GetCount();
355 for (int32_t i = 0; i < iCount; i++) { 355 for (int32_t i = 0; i < iCount; i++) {
356 CFX_ByteString bsTemp; 356 CFX_ByteString bsTemp;
357 CPDF_Object* pTempObject = nametree.LookupValue(i, bsTemp); 357 CPDF_Object* pTempObject = nametree.LookupValue(i, bsTemp);
358 if (bsTemp == bsName) { 358 if (bsTemp == bsName) {
359 pObject = pTempObject; 359 pObject = pTempObject;
360 break; 360 break;
361 } 361 }
(...skipping 17 matching lines...) Expand all
379 imageDIBDpi->iImageXDpi = iImageXDpi; 379 imageDIBDpi->iImageXDpi = iImageXDpi;
380 imageDIBDpi->iImageYDpi = iImageYDpi; 380 imageDIBDpi->iImageYDpi = iImageYDpi;
381 pImageFileRead->Release(); 381 pImageFileRead->Release();
382 } 382 }
383 m_mapNamedImages.SetAt((void*)(uintptr_t)dwHash, imageDIBDpi); 383 m_mapNamedImages.SetAt((void*)(uintptr_t)dwHash, imageDIBDpi);
384 return (CFX_DIBitmap*)imageDIBDpi->pDibSource; 384 return (CFX_DIBitmap*)imageDIBDpi->pDibSource;
385 } 385 }
386 386
387 CFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) { 387 CFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) {
388 uint32_t packetHash = 388 uint32_t packetHash =
389 FX_HashCode_String_GetW(wsPackage.GetPtr(), wsPackage.GetLength()); 389 FX_HashCode_String_GetW(wsPackage.raw_str(), wsPackage.GetLength());
390 CXFA_Node* pNode = ToNode(m_pDocument->GetXFAObject(packetHash)); 390 CXFA_Node* pNode = ToNode(m_pDocument->GetXFAObject(packetHash));
391 if (!pNode) { 391 if (!pNode) {
392 return NULL; 392 return NULL;
393 } 393 }
394 CFDE_XMLNode* pXMLNode = pNode->GetXMLMappingNode(); 394 CFDE_XMLNode* pXMLNode = pNode->GetXMLMappingNode();
395 return (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) 395 return (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element)
396 ? static_cast<CFDE_XMLElement*>(pXMLNode) 396 ? static_cast<CFDE_XMLElement*>(pXMLNode)
397 : NULL; 397 : NULL;
398 } 398 }
399 FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, 399 FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage,
400 IFX_FileWrite* pFile, 400 IFX_FileWrite* pFile,
401 CXFA_ChecksumContext* pCSContext) { 401 CXFA_ChecksumContext* pCSContext) {
402 CXFA_DataExporter* pExport = new CXFA_DataExporter(m_pDocument); 402 CXFA_DataExporter* pExport = new CXFA_DataExporter(m_pDocument);
403 uint32_t packetHash = 403 uint32_t packetHash =
404 FX_HashCode_String_GetW(wsPackage.GetPtr(), wsPackage.GetLength()); 404 FX_HashCode_String_GetW(wsPackage.raw_str(), wsPackage.GetLength());
405 CXFA_Node* pNode = NULL; 405 CXFA_Node* pNode = NULL;
406 if (packetHash == XFA_HASHCODE_Xfa) { 406 if (packetHash == XFA_HASHCODE_Xfa) {
407 pNode = m_pDocument->GetRoot(); 407 pNode = m_pDocument->GetRoot();
408 } else { 408 } else {
409 pNode = ToNode(m_pDocument->GetXFAObject(packetHash)); 409 pNode = ToNode(m_pDocument->GetXFAObject(packetHash));
410 } 410 }
411 FX_BOOL bFlags = FALSE; 411 FX_BOOL bFlags = FALSE;
412 if (pNode) { 412 if (pNode) {
413 CFX_ByteString bsChecksum; 413 CFX_ByteString bsChecksum;
414 if (pCSContext) { 414 if (pCSContext) {
415 pCSContext->GetChecksum(bsChecksum); 415 pCSContext->GetChecksum(bsChecksum);
416 } 416 }
417 bFlags = pExport->Export(pFile, pNode, 0, bsChecksum.GetLength() 417 bFlags = pExport->Export(pFile, pNode, 0, bsChecksum.GetLength()
418 ? (const FX_CHAR*)bsChecksum 418 ? (const FX_CHAR*)bsChecksum
419 : NULL); 419 : NULL);
420 } else { 420 } else {
421 bFlags = pExport->Export(pFile); 421 bFlags = pExport->Export(pFile);
422 } 422 }
423 pExport->Release(); 423 pExport->Release();
424 return bFlags; 424 return bFlags;
425 } 425 }
426 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { 426 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) {
427 std::unique_ptr<CXFA_DataImporter, ReleaseDeleter<CXFA_DataImporter>> 427 std::unique_ptr<CXFA_DataImporter, ReleaseDeleter<CXFA_DataImporter>>
428 importer(new CXFA_DataImporter(m_pDocument)); 428 importer(new CXFA_DataImporter(m_pDocument));
429 429
430 return importer->ImportData(pStream); 430 return importer->ImportData(pStream);
431 } 431 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffbarcode.cpp ('k') | xfa/fxfa/app/xfa_fontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698