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

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

Issue 1882043004: Remove implicit cast from CFX_WideString to (const wchar_t*) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: win error #2 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
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/javascript/util.h" 7 #include "fpdfsdk/javascript/util.h"
8 8
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 306
307 FX_BOOL util::printx(IJS_Context* cc, 307 FX_BOOL util::printx(IJS_Context* cc,
308 const std::vector<CJS_Value>& params, 308 const std::vector<CJS_Value>& params,
309 CJS_Value& vRet, 309 CJS_Value& vRet,
310 CFX_WideString& sError) { 310 CFX_WideString& sError) {
311 if (params.size() < 2) { 311 if (params.size() < 2) {
312 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); 312 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR);
313 return FALSE; 313 return FALSE;
314 } 314 }
315 vRet = printx(params[0].ToCFXWideString(), params[1].ToCFXWideString()); 315 vRet =
316 printx(params[0].ToCFXWideString(), params[1].ToCFXWideString()).c_str();
316 return TRUE; 317 return TRUE;
317 } 318 }
318 319
319 enum CaseMode { kPreserveCase, kUpperCase, kLowerCase }; 320 enum CaseMode { kPreserveCase, kUpperCase, kLowerCase };
320 321
321 static FX_WCHAR TranslateCase(FX_WCHAR input, CaseMode eMode) { 322 static FX_WCHAR TranslateCase(FX_WCHAR input, CaseMode eMode) {
322 if (eMode == kLowerCase && input >= 'A' && input <= 'Z') 323 if (eMode == kLowerCase && input >= 'A' && input <= 'Z')
323 return input | 0x20; 324 return input | 0x20;
324 if (eMode == kUpperCase && input >= 'a' && input <= 'z') 325 if (eMode == kUpperCase && input >= 'a' && input <= 'z')
325 return input & ~0x20; 326 return input & ~0x20;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 453 }
453 int arg = params[0].ToInt(); 454 int arg = params[0].ToInt();
454 if (arg < 0 || arg > 255) { 455 if (arg < 0 || arg > 255) {
455 sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); 456 sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR);
456 return FALSE; 457 return FALSE;
457 } 458 }
458 CFX_WideString wStr(static_cast<FX_WCHAR>(arg)); 459 CFX_WideString wStr(static_cast<FX_WCHAR>(arg));
459 vRet = wStr.c_str(); 460 vRet = wStr.c_str();
460 return TRUE; 461 return TRUE;
461 } 462 }
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/public_methods_embeddertest.cpp ('k') | xfa/fde/css/fde_cssstyleselector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698