| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |