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

Side by Side Diff: fpdfsdk/fsdk_mgr.cpp

Issue 1862953004: Make CFX_WideString::FromLocal() take a CFX_ByteStringC arg (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use GetConstStringBy(). 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 | « core/fxcrt/include/fx_string.h ('k') | fpdfsdk/javascript/PublicMethods.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 "fpdfsdk/include/fsdk_mgr.h" 7 #include "fpdfsdk/include/fsdk_mgr.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 if (nRequiredLen <= 0) 289 if (nRequiredLen <= 0)
290 return CFX_WideString(); 290 return CFX_WideString();
291 291
292 std::unique_ptr<char[]> pBuff(new char[nRequiredLen]); 292 std::unique_ptr<char[]> pBuff(new char[nRequiredLen]);
293 memset(pBuff.get(), 0, nRequiredLen); 293 memset(pBuff.get(), 0, nRequiredLen);
294 const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse( 294 const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse(
295 m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen); 295 m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen);
296 if (nActualLen <= 0 || nActualLen > nRequiredLen) 296 if (nActualLen <= 0 || nActualLen > nRequiredLen)
297 return CFX_WideString(); 297 return CFX_WideString();
298 298
299 return CFX_WideString::FromLocal(CFX_ByteString(pBuff.get(), nActualLen)); 299 return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff.get(), nActualLen));
300 } 300 }
301 301
302 CFX_WideString CPDFDoc_Environment::JS_docGetFilePath() { 302 CFX_WideString CPDFDoc_Environment::JS_docGetFilePath() {
303 if (!m_pInfo || !m_pInfo->m_pJsPlatform || 303 if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
304 !m_pInfo->m_pJsPlatform->Doc_getFilePath) { 304 !m_pInfo->m_pJsPlatform->Doc_getFilePath) {
305 return CFX_WideString(); 305 return CFX_WideString();
306 } 306 }
307 const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( 307 const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
308 m_pInfo->m_pJsPlatform, nullptr, 0); 308 m_pInfo->m_pJsPlatform, nullptr, 0);
309 if (nRequiredLen <= 0) 309 if (nRequiredLen <= 0)
310 return CFX_WideString(); 310 return CFX_WideString();
311 311
312 std::unique_ptr<char[]> pBuff(new char[nRequiredLen]); 312 std::unique_ptr<char[]> pBuff(new char[nRequiredLen]);
313 memset(pBuff.get(), 0, nRequiredLen); 313 memset(pBuff.get(), 0, nRequiredLen);
314 const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( 314 const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
315 m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen); 315 m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen);
316 if (nActualLen <= 0 || nActualLen > nRequiredLen) 316 if (nActualLen <= 0 || nActualLen > nRequiredLen)
317 return CFX_WideString(); 317 return CFX_WideString();
318 318
319 return CFX_WideString::FromLocal(CFX_ByteString(pBuff.get(), nActualLen)); 319 return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff.get(), nActualLen));
320 } 320 }
321 321
322 void CPDFDoc_Environment::JS_docSubmitForm(void* formData, 322 void CPDFDoc_Environment::JS_docSubmitForm(void* formData,
323 int length, 323 int length,
324 const FX_WCHAR* URL) { 324 const FX_WCHAR* URL) {
325 if (!m_pInfo || !m_pInfo->m_pJsPlatform || 325 if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
326 !m_pInfo->m_pJsPlatform->Doc_submitForm) { 326 !m_pInfo->m_pJsPlatform->Doc_submitForm) {
327 return; 327 return;
328 } 328 }
329 CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode(); 329 CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 CPDF_Document* pPDFDoc = GetPDFDocument(); 469 CPDF_Document* pPDFDoc = GetPDFDocument();
470 CPDF_DocJSActions docJS(pPDFDoc); 470 CPDF_DocJSActions docJS(pPDFDoc);
471 int iCount = docJS.CountJSActions(); 471 int iCount = docJS.CountJSActions();
472 if (iCount < 1) 472 if (iCount < 1)
473 return; 473 return;
474 for (int i = 0; i < iCount; i++) { 474 for (int i = 0; i < iCount; i++) {
475 CFX_ByteString csJSName; 475 CFX_ByteString csJSName;
476 CPDF_Action jsAction = docJS.GetJSAction(i, csJSName); 476 CPDF_Action jsAction = docJS.GetJSAction(i, csJSName);
477 if (m_pEnv->GetActionHander()) 477 if (m_pEnv->GetActionHander())
478 m_pEnv->GetActionHander()->DoAction_JavaScript( 478 m_pEnv->GetActionHander()->DoAction_JavaScript(
479 jsAction, CFX_WideString::FromLocal(csJSName), this); 479 jsAction, CFX_WideString::FromLocal(csJSName.AsByteStringC()), this);
480 } 480 }
481 } 481 }
482 482
483 FX_BOOL CPDFSDK_Document::ProcOpenAction() { 483 FX_BOOL CPDFSDK_Document::ProcOpenAction() {
484 if (!m_pDoc) 484 if (!m_pDoc)
485 return FALSE; 485 return FALSE;
486 486
487 CPDF_Dictionary* pRoot = GetPDFDocument()->GetRoot(); 487 CPDF_Dictionary* pRoot = GetPDFDocument()->GetRoot();
488 if (!pRoot) 488 if (!pRoot)
489 return FALSE; 489 return FALSE;
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); 1199 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot();
1200 if (!pFocusAnnot) 1200 if (!pFocusAnnot)
1201 return nullptr; 1201 return nullptr;
1202 1202
1203 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { 1203 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) {
1204 if (pAnnot == pFocusAnnot) 1204 if (pAnnot == pFocusAnnot)
1205 return pAnnot; 1205 return pAnnot;
1206 } 1206 }
1207 return nullptr; 1207 return nullptr;
1208 } 1208 }
OLDNEW
« no previous file with comments | « core/fxcrt/include/fx_string.h ('k') | fpdfsdk/javascript/PublicMethods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698