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

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

Issue 2031653003: Get rid of NULLs in fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_core
Patch Set: rebase Created 4 years, 6 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 | « fpdfsdk/javascript/JS_EventHandler.cpp ('k') | fpdfsdk/javascript/JS_Object.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/javascript/JS_GlobalData.h" 7 #include "fpdfsdk/javascript/JS_GlobalData.h"
8 8
9 #include "core/fdrm/crypto/include/fx_crypt.h" 9 #include "core/fdrm/crypto/include/fx_crypt.h"
10 #include "third_party/base/stl_util.h" 10 #include "third_party/base/stl_util.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return pdfium::CollectionSize<int32_t>(m_arrayGlobalData); 273 return pdfium::CollectionSize<int32_t>(m_arrayGlobalData);
274 } 274 }
275 275
276 CJS_GlobalData_Element* CJS_GlobalData::GetAt(int index) const { 276 CJS_GlobalData_Element* CJS_GlobalData::GetAt(int index) const {
277 if (index < 0 || index >= GetSize()) 277 if (index < 0 || index >= GetSize())
278 return nullptr; 278 return nullptr;
279 return m_arrayGlobalData[index].get(); 279 return m_arrayGlobalData[index].get();
280 } 280 }
281 281
282 void CJS_GlobalData::LoadGlobalPersistentVariables() { 282 void CJS_GlobalData::LoadGlobalPersistentVariables() {
283 uint8_t* pBuffer = NULL; 283 uint8_t* pBuffer = nullptr;
284 int32_t nLength = 0; 284 int32_t nLength = 0;
285 285
286 LoadFileBuffer(m_sFilePath.c_str(), pBuffer, nLength); 286 LoadFileBuffer(m_sFilePath.c_str(), pBuffer, nLength);
287 CRYPT_ArcFourCryptBlock(pBuffer, nLength, JS_RC4KEY, sizeof(JS_RC4KEY)); 287 CRYPT_ArcFourCryptBlock(pBuffer, nLength, JS_RC4KEY, sizeof(JS_RC4KEY));
288 288
289 if (pBuffer) { 289 if (pBuffer) {
290 uint8_t* p = pBuffer; 290 uint8_t* p = pBuffer;
291 uint16_t wType = *((uint16_t*)p); 291 uint16_t wType = *((uint16_t*)p);
292 p += sizeof(uint16_t); 292 p += sizeof(uint16_t);
293 293
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 case JS_GLOBALDATA_TYPE_NULL: { 446 case JS_GLOBALDATA_TYPE_NULL: {
447 uint32_t dwNameLen = (uint32_t)name.GetLength(); 447 uint32_t dwNameLen = (uint32_t)name.GetLength();
448 sData.AppendBlock(&dwNameLen, sizeof(uint32_t)); 448 sData.AppendBlock(&dwNameLen, sizeof(uint32_t));
449 sData.AppendString(name); 449 sData.AppendString(name);
450 sData.AppendBlock(&wType, sizeof(uint32_t)); 450 sData.AppendBlock(&wType, sizeof(uint32_t));
451 } break; 451 } break;
452 default: 452 default:
453 break; 453 break;
454 } 454 }
455 } 455 }
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/JS_EventHandler.cpp ('k') | fpdfsdk/javascript/JS_Object.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698