Chromium Code Reviews| 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/fxcrt/fx_basic.h" | 7 #include "../../include/fxcrt/fx_basic.h" |
| 8 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf); | 8 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_LPSTR buf); |
| 9 CFX_BinaryBuf::CFX_BinaryBuf() | 9 CFX_BinaryBuf::CFX_BinaryBuf() |
| 10 : m_AllocStep(0) | 10 : m_AllocStep(0) |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 FX_LPSTR buffer = str.GetBuffer(len); | 364 FX_LPSTR buffer = str.GetBuffer(len); |
| 365 FXSYS_memcpy32(buffer, m_pLoadingBuf + m_LoadingPos, len); | 365 FXSYS_memcpy32(buffer, m_pLoadingBuf + m_LoadingPos, len); |
| 366 str.ReleaseBuffer(len); | 366 str.ReleaseBuffer(len); |
| 367 m_LoadingPos += len; | 367 m_LoadingPos += len; |
| 368 return *this; | 368 return *this; |
| 369 } | 369 } |
| 370 CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (CFX_WideString& str) | 370 CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (CFX_WideString& str) |
| 371 { | 371 { |
| 372 CFX_ByteString encoded; | 372 CFX_ByteString encoded; |
| 373 operator >> (encoded); | 373 operator >> (encoded); |
| 374 str = CFX_WideString::FromUTF16LE((const unsigned short*)(FX_LPCSTR)encoded, encoded.GetLength()); | 374 str = CFX_WideString::FromUTF16LE((const unsigned short*)encoded.c_str(), en coded.GetLength()); |
|
Tom Sepez
2014/12/30 22:53:26
nit: This cast is confusing, but let's leave it fo
| |
| 375 return *this; | 375 return *this; |
| 376 } | 376 } |
| 377 FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) | 377 FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) |
| 378 { | 378 { |
| 379 if (m_LoadingPos + dwSize > m_LoadingSize) { | 379 if (m_LoadingPos + dwSize > m_LoadingSize) { |
| 380 return FALSE; | 380 return FALSE; |
| 381 } | 381 } |
| 382 FXSYS_memcpy32(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); | 382 FXSYS_memcpy32(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); |
| 383 m_LoadingPos += dwSize; | 383 m_LoadingPos += dwSize; |
| 384 return TRUE; | 384 return TRUE; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) | 554 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) |
| 555 { | 555 { |
| 556 if (!m_pFile) { | 556 if (!m_pFile) { |
| 557 return FALSE; | 557 return FALSE; |
| 558 } | 558 } |
| 559 if (!pBuf || size < 1) { | 559 if (!pBuf || size < 1) { |
| 560 return TRUE; | 560 return TRUE; |
| 561 } | 561 } |
| 562 return m_pFile->WriteBlock(pBuf, size); | 562 return m_pFile->WriteBlock(pBuf, size); |
| 563 } | 563 } |
| OLD | NEW |