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

Side by Side Diff: fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp

Issue 1773733002: Review and cleanup lint warnings. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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 | « fpdfsdk/src/fpdfsave.cpp ('k') | fpdfsdk/src/fpdfxfa/fpdfxfa_util.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 "core/include/fpdfapi/cpdf_document.h" 7 #include "core/include/fpdfapi/cpdf_document.h"
8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" 8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
9 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 9 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" 10 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 CFPDF_FileStream fileWrite(pFileHandler); 627 CFPDF_FileStream fileWrite(pFileHandler);
628 628
629 IXFA_DocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler(); 629 IXFA_DocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler();
630 CFX_ByteString content; 630 CFX_ByteString content;
631 if (fileType == FXFA_SAVEAS_XML) { 631 if (fileType == FXFA_SAVEAS_XML) {
632 content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; 632 content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
633 fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(), 633 fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(),
634 content.GetLength()); 634 content.GetLength());
635 CFX_WideStringC data(L"data"); 635 CFX_WideStringC data(L"data");
636 if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) { 636 if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) {
637 // TODO: Maybe report error. 637 // Ignoring error.
638 } 638 }
639 } else if (fileType == FXFA_SAVEAS_XDP) { 639 } else if (fileType == FXFA_SAVEAS_XDP) {
640 if (m_pPDFDoc == NULL) 640 if (m_pPDFDoc == NULL)
641 return; 641 return;
642 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); 642 CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot();
643 if (pRoot == NULL) 643 if (pRoot == NULL)
644 return; 644 return;
645 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); 645 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm");
646 if (NULL == pAcroForm) 646 if (NULL == pAcroForm)
647 return; 647 return;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 CPDF_Stream* pStream = (CPDF_Stream*)pDirectObj; 687 CPDF_Stream* pStream = (CPDF_Stream*)pDirectObj;
688 CPDF_StreamAcc* pAcc = new CPDF_StreamAcc; 688 CPDF_StreamAcc* pAcc = new CPDF_StreamAcc;
689 pAcc->LoadAllData(pStream); 689 pAcc->LoadAllData(pStream);
690 fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(), 690 fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(),
691 pAcc->GetSize()); 691 pAcc->GetSize());
692 delete pAcc; 692 delete pAcc;
693 } 693 }
694 } 694 }
695 } 695 }
696 if (!fileWrite.Flush()) { 696 if (!fileWrite.Flush()) {
697 // TODO: Report error. 697 // Ignoring flush error.
698 } 698 }
699 } 699 }
700 void CPDFXFA_Document::ImportData(IXFA_Doc* hDoc, 700 void CPDFXFA_Document::ImportData(IXFA_Doc* hDoc,
701 const CFX_WideStringC& wsFilePath) { 701 const CFX_WideStringC& wsFilePath) {
702 // TODO ...
703 } 702 }
704 703
705 void CPDFXFA_Document::GotoURL(IXFA_Doc* hDoc, 704 void CPDFXFA_Document::GotoURL(IXFA_Doc* hDoc,
706 const CFX_WideStringC& bsURL, 705 const CFX_WideStringC& bsURL,
707 FX_BOOL bAppend) { 706 FX_BOOL bAppend) {
708 if (hDoc != m_pXFADoc) 707 if (hDoc != m_pXFADoc)
709 return; 708 return;
710 709
711 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 710 if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
712 return; 711 return;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 if (pPrePDFObj->GetString() == "form") { 993 if (pPrePDFObj->GetString() == "form") {
995 CFX_WideString ws; 994 CFX_WideString ws;
996 ws.FromLocal("form"); 995 ws.FromLocal("form");
997 pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream); 996 pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream);
998 } else if (pPrePDFObj->GetString() == "datasets") { 997 } else if (pPrePDFObj->GetString() == "datasets") {
999 CFX_WideString ws; 998 CFX_WideString ws;
1000 ws.FromLocal("datasets"); 999 ws.FromLocal("datasets");
1001 pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream); 1000 pDocHandler->SavePackage(m_pXFADoc, ws, &fileStream);
1002 } else { 1001 } else {
1003 // PDF,creator. 1002 // PDF,creator.
1004 // TODO:
1005 } 1003 }
1006 } 1004 }
1007 } 1005 }
1008 return TRUE; 1006 return TRUE;
1009 } 1007 }
1010 1008
1011 void CPDFXFA_Document::_ClearChangeMark() { 1009 void CPDFXFA_Document::_ClearChangeMark() {
1012 if (m_pSDKDoc) 1010 if (m_pSDKDoc)
1013 m_pSDKDoc->ClearChangeMark(); 1011 m_pSDKDoc->ClearChangeMark();
1014 } 1012 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 FPDF_WIDESTRING pSubject = 1183 FPDF_WIDESTRING pSubject =
1186 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength()); 1184 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength());
1187 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength()); 1185 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
1188 pEnv->FFI_EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg); 1186 pEnv->FFI_EmailTo(pFileHandler, pTo, pSubject, pCC, pBcc, pMsg);
1189 bsTo.ReleaseBuffer(); 1187 bsTo.ReleaseBuffer();
1190 bsCC.ReleaseBuffer(); 1188 bsCC.ReleaseBuffer();
1191 bsBcc.ReleaseBuffer(); 1189 bsBcc.ReleaseBuffer();
1192 bsSubject.ReleaseBuffer(); 1190 bsSubject.ReleaseBuffer();
1193 bsMsg.ReleaseBuffer(); 1191 bsMsg.ReleaseBuffer();
1194 } else { 1192 } else {
1195 // http¡¢ftp 1193 // HTTP or FTP
1196 CFX_WideString ws; 1194 CFX_WideString ws;
1197 CFX_ByteString bs = csURL.UTF16LE_Encode(); 1195 CFX_ByteString bs = csURL.UTF16LE_Encode();
1198 int len = bs.GetLength() / sizeof(unsigned short); 1196 int len = bs.GetLength() / sizeof(unsigned short);
1199 pEnv->FFI_UploadTo( 1197 pEnv->FFI_UploadTo(
1200 pFileHandler, fileFlag, 1198 pFileHandler, fileFlag,
1201 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short))); 1199 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)));
1202 bs.ReleaseBuffer(len * sizeof(unsigned short)); 1200 bs.ReleaseBuffer(len * sizeof(unsigned short));
1203 } 1201 }
1204 return bRet; 1202 return bRet;
1205 #else 1203 #else
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 } 1247 }
1250 1248
1251 return _GetHValueByName(szPropName, hValue, 1249 return _GetHValueByName(szPropName, hValue,
1252 m_pSDKDoc->GetEnv()->GetJSRuntime()); 1250 m_pSDKDoc->GetEnv()->GetJSRuntime());
1253 } 1251 }
1254 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, 1252 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name,
1255 FXJSE_HVALUE hValue, 1253 FXJSE_HVALUE hValue,
1256 IJS_Runtime* runTime) { 1254 IJS_Runtime* runTime) {
1257 return runTime->GetHValueByName(utf8Name, hValue); 1255 return runTime->GetHValueByName(utf8Name, hValue);
1258 } 1256 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfsave.cpp ('k') | fpdfsdk/src/fpdfxfa/fpdfxfa_util.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698