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

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

Issue 733693003: Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Simplified GetAttrValue to just assign *pValue and to share code. Created 6 years 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/javascript/app.cpp ('k') | no next file » | 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 "../../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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 v8::Local<v8::Context> context = pObj->CreationContext(); 335 v8::Local<v8::Context> context = pObj->CreationContext();
336 v8::Isolate* isolate = context->GetIsolate(); 336 v8::Isolate* isolate = context->GetIsolate();
337 337
338 for (int i=0; i<nObjElements; i++) 338 for (int i=0; i<nObjElements; i++)
339 { 339 {
340 340
341 CFX_WideString ws = JS_ToString(JS_GetArrayElemnet(pKeyList, i)) ; 341 CFX_WideString ws = JS_ToString(JS_GetArrayElemnet(pKeyList, i)) ;
342 CFX_ByteString sKey = ws.UTF8Encode(); 342 CFX_ByteString sKey = ws.UTF8Encode();
343 343
344 » » v8::Handle<v8::Value> v = JS_GetObjectElement(isolate, pObj, (FX _LPCWSTR)ws); 344 » » v8::Handle<v8::Value> v = JS_GetObjectElement(isolate, pObj, ws. c_str());
345 FXJSVALUETYPE vt = GET_VALUE_TYPE(v); 345 FXJSVALUETYPE vt = GET_VALUE_TYPE(v);
346 switch (vt) 346 switch (vt)
347 { 347 {
348 case VT_number: 348 case VT_number:
349 { 349 {
350 CJS_KeyValue* pObjElement = new CJS_KeyValue; 350 CJS_KeyValue* pObjElement = new CJS_KeyValue;
351 pObjElement->nType = JS_GLOBALDATA_TYPE_NUMBER; 351 pObjElement->nType = JS_GLOBALDATA_TYPE_NUMBER;
352 pObjElement->sKey = sKey; 352 pObjElement->sKey = sKey;
353 pObjElement->dData = JS_ToNumber(v); 353 pObjElement->dData = JS_ToNumber(v);
354 array.Add(pObjElement); 354 array.Add(pObjElement);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 541 }
542 break; 542 break;
543 default: 543 default:
544 return FALSE; 544 return FALSE;
545 } 545 }
546 546
547 m_mapGlobal.SetAt(propname, (FX_LPVOID)pNewData); 547 m_mapGlobal.SetAt(propname, (FX_LPVOID)pNewData);
548 548
549 return TRUE; 549 return TRUE;
550 } 550 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/app.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698