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

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

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 5 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/event.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_EditCtrl.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 "global.h" 7 #include "global.h"
8 8
9 #include "JS_Context.h" 9 #include "JS_Context.h"
10 #include "JS_Define.h" 10 #include "JS_Define.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 pData->bPersistent = params[1].ToBool(); 220 pData->bPersistent = params[1].ToBool();
221 return TRUE; 221 return TRUE;
222 } 222 }
223 } 223 }
224 224
225 sError = JSGetStringFromID(pContext, IDS_STRING_JSNOGLOBAL); 225 sError = JSGetStringFromID(pContext, IDS_STRING_JSNOGLOBAL);
226 return FALSE; 226 return FALSE;
227 } 227 }
228 228
229 void JSGlobalAlternate::UpdateGlobalPersistentVariables() { 229 void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
230 ASSERT(m_pGlobalData != NULL);
231
232 for (int i = 0, sz = m_pGlobalData->GetSize(); i < sz; i++) { 230 for (int i = 0, sz = m_pGlobalData->GetSize(); i < sz; i++) {
233 CJS_GlobalData_Element* pData = m_pGlobalData->GetAt(i); 231 CJS_GlobalData_Element* pData = m_pGlobalData->GetAt(i);
234 ASSERT(pData != NULL);
235
236 switch (pData->data.nType) { 232 switch (pData->data.nType) {
237 case JS_GLOBALDATA_TYPE_NUMBER: 233 case JS_GLOBALDATA_TYPE_NUMBER:
238 SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, 234 SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER,
239 pData->data.dData, false, "", 235 pData->data.dData, false, "",
240 v8::Local<v8::Object>(), pData->bPersistent == 1); 236 v8::Local<v8::Object>(), pData->bPersistent == 1);
241 FXJS_PutObjectNumber(NULL, m_pJSObject->ToV8Object(), 237 FXJS_PutObjectNumber(NULL, m_pJSObject->ToV8Object(),
242 pData->data.sKey.UTF8Decode().c_str(), 238 pData->data.sKey.UTF8Decode().c_str(),
243 pData->data.dData); 239 pData->data.dData);
244 break; 240 break;
245 case JS_GLOBALDATA_TYPE_BOOLEAN: 241 case JS_GLOBALDATA_TYPE_BOOLEAN:
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 array.Add(pObjElement); 369 array.Add(pObjElement);
374 } break; 370 } break;
375 default: 371 default:
376 break; 372 break;
377 } 373 }
378 } 374 }
379 } 375 }
380 376
381 void JSGlobalAlternate::PutObjectProperty(v8::Local<v8::Object> pObj, 377 void JSGlobalAlternate::PutObjectProperty(v8::Local<v8::Object> pObj,
382 CJS_KeyValue* pData) { 378 CJS_KeyValue* pData) {
383 ASSERT(pData != NULL);
384
385 for (int i = 0, sz = pData->objData.Count(); i < sz; i++) { 379 for (int i = 0, sz = pData->objData.Count(); i < sz; i++) {
386 CJS_KeyValue* pObjData = pData->objData.GetAt(i); 380 CJS_KeyValue* pObjData = pData->objData.GetAt(i);
387 ASSERT(pObjData != NULL);
388
389 switch (pObjData->nType) { 381 switch (pObjData->nType) {
390 case JS_GLOBALDATA_TYPE_NUMBER: 382 case JS_GLOBALDATA_TYPE_NUMBER:
391 FXJS_PutObjectNumber(NULL, pObj, pObjData->sKey.UTF8Decode().c_str(), 383 FXJS_PutObjectNumber(NULL, pObj, pObjData->sKey.UTF8Decode().c_str(),
392 pObjData->dData); 384 pObjData->dData);
393 break; 385 break;
394 case JS_GLOBALDATA_TYPE_BOOLEAN: 386 case JS_GLOBALDATA_TYPE_BOOLEAN:
395 FXJS_PutObjectBoolean(NULL, pObj, pObjData->sKey.UTF8Decode().c_str(), 387 FXJS_PutObjectBoolean(NULL, pObj, pObjData->sKey.UTF8Decode().c_str(),
396 pObjData->bData == 1); 388 pObjData->bData == 1);
397 break; 389 break;
398 case JS_GLOBALDATA_TYPE_STRING: 390 case JS_GLOBALDATA_TYPE_STRING:
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 return CJS_Value::VT_boolean; 510 return CJS_Value::VT_boolean;
519 if (nHash == JSCONST_nDateHash) 511 if (nHash == JSCONST_nDateHash)
520 return CJS_Value::VT_date; 512 return CJS_Value::VT_date;
521 if (nHash == JSCONST_nObjectHash) 513 if (nHash == JSCONST_nObjectHash)
522 return CJS_Value::VT_object; 514 return CJS_Value::VT_object;
523 if (nHash == JSCONST_nFXobjHash) 515 if (nHash == JSCONST_nFXobjHash)
524 return CJS_Value::VT_fxobject; 516 return CJS_Value::VT_fxobject;
525 517
526 return CJS_Value::VT_unknown; 518 return CJS_Value::VT_unknown;
527 } 519 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/event.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698