| 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 "../../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_GlobalData.h" | 9 #include "../../include/javascript/JS_GlobalData.h" |
| 10 | 10 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 CJS_GlobalData_Element* CJS_GlobalData::GetAt(int index) const | 346 CJS_GlobalData_Element* CJS_GlobalData::GetAt(int index) const |
| 347 { | 347 { |
| 348 return m_arrayGlobalData.GetAt(index); | 348 return m_arrayGlobalData.GetAt(index); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void CJS_GlobalData::LoadGlobalPersistentVariables() | 351 void CJS_GlobalData::LoadGlobalPersistentVariables() |
| 352 { | 352 { |
| 353 FX_LPBYTE pBuffer = NULL; | 353 FX_LPBYTE pBuffer = NULL; |
| 354 FX_INT32 nLength = 0; | 354 FX_INT32 nLength = 0; |
| 355 | 355 |
| 356 » LoadFileBuffer(m_sFilePath, pBuffer, nLength); | 356 » LoadFileBuffer(m_sFilePath.c_str(), pBuffer, nLength); |
| 357 | |
| 358 CRYPT_ArcFourCryptBlock(pBuffer, nLength, JS_RC4KEY, sizeof(JS_RC4KEY)); | 357 CRYPT_ArcFourCryptBlock(pBuffer, nLength, JS_RC4KEY, sizeof(JS_RC4KEY)); |
| 359 | 358 |
| 360 if (pBuffer) | 359 if (pBuffer) |
| 361 { | 360 { |
| 362 FX_LPBYTE p = pBuffer; | 361 FX_LPBYTE p = pBuffer; |
| 363 FX_WORD wType = *((FX_WORD*)p); | 362 FX_WORD wType = *((FX_WORD*)p); |
| 364 p += sizeof(FX_WORD); | 363 p += sizeof(FX_WORD); |
| 365 | 364 |
| 366 //FX_WORD wTemp = (FX_WORD)(('X' << 8) | 'F'); | 365 //FX_WORD wTemp = (FX_WORD)(('X' << 8) | 'F'); |
| 367 | 366 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 sFile.AppendBlock(&wType, sizeof(FX_WORD)); | 501 sFile.AppendBlock(&wType, sizeof(FX_WORD)); |
| 503 FX_WORD wVersion = 2; | 502 FX_WORD wVersion = 2; |
| 504 sFile.AppendBlock(&wVersion, sizeof(FX_WORD)); | 503 sFile.AppendBlock(&wVersion, sizeof(FX_WORD)); |
| 505 sFile.AppendBlock(&nCount, sizeof(FX_DWORD)); | 504 sFile.AppendBlock(&nCount, sizeof(FX_DWORD)); |
| 506 FX_DWORD dwSize = sData.GetSize(); | 505 FX_DWORD dwSize = sData.GetSize(); |
| 507 sFile.AppendBlock(&dwSize, sizeof(FX_DWORD)); | 506 sFile.AppendBlock(&dwSize, sizeof(FX_DWORD)); |
| 508 | 507 |
| 509 sFile.AppendBlock(sData.GetBuffer(), sData.GetSize()); | 508 sFile.AppendBlock(sData.GetBuffer(), sData.GetSize()); |
| 510 | 509 |
| 511 CRYPT_ArcFourCryptBlock(sFile.GetBuffer(), sFile.GetSize(), JS_RC4KEY, s
izeof(JS_RC4KEY)); | 510 CRYPT_ArcFourCryptBlock(sFile.GetBuffer(), sFile.GetSize(), JS_RC4KEY, s
izeof(JS_RC4KEY)); |
| 512 » WriteFileBuffer(m_sFilePath, (FX_LPCSTR)sFile.GetBuffer(), sFile.GetSize
()); | 511 » WriteFileBuffer(m_sFilePath.c_str(), (FX_LPCSTR)sFile.GetBuffer(), sFile
.GetSize()); |
| 513 } | 512 } |
| 514 | 513 |
| 515 void CJS_GlobalData::LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX
_INT32& nLength) | 514 void CJS_GlobalData::LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX
_INT32& nLength) |
| 516 { | 515 { |
| 517 //UnSupport. | 516 //UnSupport. |
| 518 } | 517 } |
| 519 | 518 |
| 520 void CJS_GlobalData::WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX
_INT32 nLength) | 519 void CJS_GlobalData::WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX
_INT32 nLength) |
| 521 { | 520 { |
| 522 //UnSupport. | 521 //UnSupport. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 sData.AppendString(name); | 571 sData.AppendString(name); |
| 573 | 572 |
| 574 sData.AppendBlock(&wType, sizeof(FX_DWORD)); | 573 sData.AppendBlock(&wType, sizeof(FX_DWORD)); |
| 575 } | 574 } |
| 576 break; | 575 break; |
| 577 default: | 576 default: |
| 578 break; | 577 break; |
| 579 } | 578 } |
| 580 } | 579 } |
| 581 | 580 |
| OLD | NEW |