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

Side by Side Diff: fpdfsdk/src/javascript/util.cpp

Issue 809993004: Get rid of FX_LPCSTR cast. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 11 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
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/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 cPurpose = cFormat; 464 cPurpose = cFormat;
465 } 465 }
466 466
467 FX_BOOL util::printx(OBJ_METHOD_PARAMS) 467 FX_BOOL util::printx(OBJ_METHOD_PARAMS)
468 { 468 {
469 int iSize = params.size(); 469 int iSize = params.size();
470 if (iSize<2) 470 if (iSize<2)
471 return FALSE; 471 return FALSE;
472 CFX_WideString sFormat = params[0].operator CFX_WideString(); 472 CFX_WideString sFormat = params[0].operator CFX_WideString();
473 CFX_WideString sSource = params[1].operator CFX_WideString(); 473 CFX_WideString sSource = params[1].operator CFX_WideString();
474 » std::string cFormat = (FX_LPCSTR)CFX_ByteString::FromUnicode(sFormat); 474 std::string cFormat = CFX_ByteString::FromUnicode(sFormat).c_str();
475 » std::string cSource = (FX_LPCSTR)CFX_ByteString::FromUnicode(sSource); 475 std::string cSource = CFX_ByteString::FromUnicode(sSource).c_str();
brucedawson 2014/12/30 23:13:02 Can we get a version of FromUnicode that returns s
Bo Xu 2014/12/31 00:25:24 I agree there are too many conversion here. CFX_By
476 std::string cDest; 476 std::string cDest;
477 printx(cFormat,cSource,cDest); 477 printx(cFormat,cSource,cDest);
478 vRet = cDest.c_str(); 478 vRet = cDest.c_str();
479 return TRUE; 479 return TRUE;
480 } 480 }
481 481
482 void util::printx(const std::string &cFormat,const std::string &cSource2,std::st ring &cPurpose) 482 void util::printx(const std::string &cFormat,const std::string &cSource2,std::st ring &cPurpose)
483 { 483 {
484 std::string cSource(cSource2); 484 std::string cSource(cSource2);
485 if (!cPurpose.empty()) 485 if (!cPurpose.empty())
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 int iSize = params.size(); 640 int iSize = params.size();
641 if (iSize == 0) 641 if (iSize == 0)
642 return FALSE; 642 return FALSE;
643 int nByte = (int)params[0]; 643 int nByte = (int)params[0];
644 unsigned char cByte = (unsigned char)nByte; 644 unsigned char cByte = (unsigned char)nByte;
645 CFX_WideString csValue; 645 CFX_WideString csValue;
646 csValue.Format(L"%c", cByte); 646 csValue.Format(L"%c", cByte);
647 vRet = csValue; 647 vRet = csValue;
648 return TRUE; 648 return TRUE;
649 } 649 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698