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

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

Issue 1979723003: Make CFX_WideString(const CFX_WideString&) explicit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Override Created 4 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/fxcrt/include/fx_string.h ('k') | fpdfsdk/fpdfxfa/include/fpdfxfa_doc.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 "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 return; 607 return;
608 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo(); 608 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo();
609 609
610 if (pInfoDict == NULL) 610 if (pInfoDict == NULL)
611 return; 611 return;
612 612
613 CFX_ByteString csTitle = pInfoDict->GetStringBy("Title"); 613 CFX_ByteString csTitle = pInfoDict->GetStringBy("Title");
614 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); 614 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
615 csTitle.ReleaseBuffer(csTitle.GetLength()); 615 csTitle.ReleaseBuffer(csTitle.GetLength());
616 } 616 }
617
617 void CPDFXFA_Document::SetTitle(CXFA_FFDoc* hDoc, 618 void CPDFXFA_Document::SetTitle(CXFA_FFDoc* hDoc,
618 const CFX_WideStringC& wsTitle) { 619 const CFX_WideString& wsTitle) {
619 if (hDoc != m_pXFADoc) 620 if (hDoc != m_pXFADoc || !m_pPDFDoc)
620 return; 621 return;
621 if (m_pPDFDoc == NULL)
622 return;
623 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo();
624 622
625 if (pInfoDict == NULL) 623 if (CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo())
626 return; 624 pInfoDict->SetAt("Title", new CPDF_String(wsTitle));
627 pInfoDict->SetAt("Title", new CPDF_String(wsTitle));
628 } 625 }
626
629 void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, 627 void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
630 const CFX_WideStringC& wsFilePath, 628 const CFX_WideStringC& wsFilePath,
631 FX_BOOL bXDP) { 629 FX_BOOL bXDP) {
632 if (hDoc != m_pXFADoc) 630 if (hDoc != m_pXFADoc)
633 return; 631 return;
634 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) 632 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA)
635 return; 633 return;
636 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 634 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
637 if (pEnv == NULL) 635 if (pEnv == NULL)
638 return; 636 return;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 return TRUE; 1131 return TRUE;
1134 } 1132 }
1135 1133
1136 FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { 1134 FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) {
1137 #ifdef PDF_ENABLE_XFA 1135 #ifdef PDF_ENABLE_XFA
1138 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 1136 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
1139 if (!pEnv) 1137 if (!pEnv)
1140 return FALSE; 1138 return FALSE;
1141 CFX_WideStringC csURLC; 1139 CFX_WideStringC csURLC;
1142 submit.GetSubmitTarget(csURLC); 1140 submit.GetSubmitTarget(csURLC);
1143 CFX_WideString csURL = csURLC; 1141 CFX_WideString csURL(csURLC);
1144 if (csURL.IsEmpty()) { 1142 if (csURL.IsEmpty()) {
1145 CFX_WideString ws; 1143 CFX_WideString ws;
1146 ws.FromLocal("Submit cancelled."); 1144 ws.FromLocal("Submit cancelled.");
1147 CFX_ByteString bs = ws.UTF16LE_Encode(); 1145 CFX_ByteString bs = ws.UTF16LE_Encode();
1148 int len = bs.GetLength() / sizeof(unsigned short); 1146 int len = bs.GetLength() / sizeof(unsigned short);
1149 pEnv->FFI_Alert((FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), 1147 pEnv->FFI_Alert((FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)),
1150 (FPDF_WIDESTRING)L"", 0, 4); 1148 (FPDF_WIDESTRING)L"", 0, 4);
1151 bs.ReleaseBuffer(len * sizeof(unsigned short)); 1149 bs.ReleaseBuffer(len * sizeof(unsigned short));
1152 return FALSE; 1150 return FALSE;
1153 } 1151 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 } 1274 }
1277 1275
1278 return _GetHValueByName(szPropName, hValue, 1276 return _GetHValueByName(szPropName, hValue,
1279 m_pSDKDoc->GetEnv()->GetJSRuntime()); 1277 m_pSDKDoc->GetEnv()->GetJSRuntime());
1280 } 1278 }
1281 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, 1279 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name,
1282 FXJSE_HVALUE hValue, 1280 FXJSE_HVALUE hValue,
1283 IJS_Runtime* runTime) { 1281 IJS_Runtime* runTime) {
1284 return runTime->GetHValueByName(utf8Name, hValue); 1282 return runTime->GetHValueByName(utf8Name, hValue);
1285 } 1283 }
OLDNEW
« no previous file with comments | « core/fxcrt/include/fx_string.h ('k') | fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698