From 35425896b07b5124651c249d6ce29285cf71ea3b Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 5 Feb 2015 10:03:18 -0800 Subject: Merge to XFA: Add namespace and-re-arrange PDFium's local copy of /base. Original revieww URL: https://codereview.chromium.org/900753002 TBR=jam@chromium.org Review URL: https://codereview.chromium.org/880603004 --- core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 2 +- core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 12 ++++++------ core/src/fxcrt/fx_basic_array.cpp | 8 ++++---- core/src/fxcrt/fx_basic_bstring.cpp | 4 ++-- core/src/fxcrt/fx_basic_wstring.cpp | 6 +++--- core/src/fxcrt/fx_safe_types.h | 10 +++++----- 6 files changed, 21 insertions(+), 21 deletions(-) (limited to 'core/src') diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index 4ba0489ee4..b57272d35e 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -9,7 +9,7 @@ #include "../../../include/fpdfapi/fpdf_page.h" #include "../../../include/fpdfapi/fpdf_module.h" #include "../../../src/fxcrt/fx_safe_types.h" -#include "../../../third_party/numerics/safe_conversions_impl.h" +#include "../../../third_party/base/numerics/safe_conversions_impl.h" #include "pageint.h" class CPDF_PSEngine; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index eaecb0fe9f..d99390d4e2 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -1076,8 +1076,8 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL if (startnum < 0) { continue; } - m_dwXrefStartObjNum = base::checked_cast (startnum); - FX_DWORD count = base::checked_cast (arrIndex[i].second); + m_dwXrefStartObjNum = pdfium::base::checked_cast (startnum); + FX_DWORD count = pdfium::base::checked_cast (arrIndex[i].second); FX_SAFE_DWORD dwCaculatedSize = segindex; dwCaculatedSize += count; dwCaculatedSize *= totalWidth; @@ -1087,7 +1087,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL FX_LPCBYTE segstart = pData + segindex * totalWidth; FX_SAFE_DWORD dwMaxObjNum = startnum; dwMaxObjNum += count; - FX_DWORD dwV5Size = base::checked_cast (m_V5Type.GetSize()); + FX_DWORD dwV5Size = pdfium::base::checked_cast (m_V5Type.GetSize()); if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size) { continue; } @@ -2443,7 +2443,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT CPDF_CryptoHandler* pCryptoHandler = objnum == (FX_DWORD)m_MetadataObjnum ? NULL : m_pCryptoHandler; if (pCryptoHandler == NULL) { - base::CheckedNumeric pos = m_Pos; + pdfium::base::CheckedNumeric pos = m_Pos; pos += len; if (pos.IsValid() && pos.ValueOrDie() < m_FileLen) { m_Pos = pos.ValueOrDie(); @@ -3080,7 +3080,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa FX_DWORD dwNum = pRef->GetRefObjNum(); FX_FILESIZE offset; FX_DWORD original_size = GetObjectSize(dwNum, offset); - base::CheckedNumeric size = original_size; + pdfium::base::CheckedNumeric size = original_size; if (size.ValueOrDefault(0) == 0 || offset < 0 || offset >= m_dwFileLen) { break; } @@ -3307,7 +3307,7 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, IFX_DownloadHints* pHint pParser = (CPDF_Parser *)(m_pDocument->GetParser()); } - base::CheckedNumeric size = original_size; + pdfium::base::CheckedNumeric size = original_size; if (size.ValueOrDefault(0) == 0 || offset < 0 || offset >= m_dwFileLen) { if (pExistInFile) *pExistInFile = FALSE; diff --git a/core/src/fxcrt/fx_basic_array.cpp b/core/src/fxcrt/fx_basic_array.cpp index 0694cf9cbd..9bdc607bfe 100644 --- a/core/src/fxcrt/fx_basic_array.cpp +++ b/core/src/fxcrt/fx_basic_array.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxcrt/fx_basic.h" -#include "../../../third_party/numerics/safe_math.h" +#include "../../../third_party/base/numerics/safe_math.h" CFX_BasicArray::CFX_BasicArray(int unit_size) : m_pData(NULL) @@ -32,7 +32,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) } if (m_pData == NULL) { - base::CheckedNumeric totalSize = nNewSize; + pdfium::base::CheckedNumeric totalSize = nNewSize; totalSize *= m_nUnitSize; if (!totalSize.IsValid()) { m_nSize = m_nMaxSize = 0; @@ -51,7 +51,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) m_nSize = nNewSize; } else { int nNewMax = nNewSize < m_nMaxSize ? m_nMaxSize : nNewSize; - base::CheckedNumeric totalSize = nNewMax; + pdfium::base::CheckedNumeric totalSize = nNewMax; totalSize *= m_nUnitSize; if (!totalSize.IsValid() || nNewMax < m_nSize) { return FALSE; @@ -70,7 +70,7 @@ FX_BOOL CFX_BasicArray::SetSize(int nNewSize) FX_BOOL CFX_BasicArray::Append(const CFX_BasicArray& src) { int nOldSize = m_nSize; - base::CheckedNumeric newSize = m_nSize; + pdfium::base::CheckedNumeric newSize = m_nSize; newSize += src.m_nSize; if (m_nUnitSize != src.m_nUnitSize || !newSize.IsValid() || !SetSize(newSize.ValueOrDie())) { return FALSE; diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 0d4f860b32..39104e29f6 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxcrt/fx_basic.h" -#include "../../../third_party/numerics/safe_math.h" +#include "../../../third_party/base/numerics/safe_math.h" static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) { @@ -52,7 +52,7 @@ static CFX_StringData* FX_AllocString(int nLen) if (nLen == 0 || nLen < 0) { return NULL; } - base::CheckedNumeric nSize = nLen; + pdfium::base::CheckedNumeric nSize = nLen; nSize += sizeof(long) * 3 + 1; CFX_StringData* pData = (CFX_StringData*)FX_Alloc(FX_BYTE, nSize.ValueOrDie()); if (!pData) { diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index 0945d2f1c5..dfdbef8bd6 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxcrt/fx_basic.h" -#include "../../../third_party/numerics/safe_math.h" +#include "../../../third_party/base/numerics/safe_math.h" static CFX_StringDataW* FX_AllocStringW(int nLen) { @@ -13,7 +13,7 @@ static CFX_StringDataW* FX_AllocStringW(int nLen) return NULL; } - base::CheckedNumeric iSize = static_cast(sizeof(FX_WCHAR)); + pdfium::base::CheckedNumeric iSize = static_cast(sizeof(FX_WCHAR)); iSize *= nLen + 1; iSize += sizeof(long) * 3; CFX_StringDataW* pData = (CFX_StringDataW*)FX_Alloc(FX_BYTE, iSize.ValueOrDie()); @@ -435,7 +435,7 @@ void CFX_WideString::AllocCopy(CFX_WideString& dest, FX_STRSIZE nCopyLen, FX_STR if (nCopyLen == 0 || nCopyLen < 0) { return; } - base::CheckedNumeric iSize = static_cast(sizeof(FX_WCHAR)); + pdfium::base::CheckedNumeric iSize = static_cast(sizeof(FX_WCHAR)); iSize *= nCopyLen; ASSERT(dest.m_pData == NULL); dest.m_pData = FX_AllocStringW(nCopyLen); diff --git a/core/src/fxcrt/fx_safe_types.h b/core/src/fxcrt/fx_safe_types.h index 794e1f19dc..5772fd0e3c 100644 --- a/core/src/fxcrt/fx_safe_types.h +++ b/core/src/fxcrt/fx_safe_types.h @@ -7,11 +7,11 @@ #include // For size_t. -#include "../../../third_party/numerics/safe_math.h" +#include "../../../third_party/base/numerics/safe_math.h" -typedef base::CheckedNumeric FX_SAFE_DWORD; -typedef base::CheckedNumeric FX_SAFE_INT32; -typedef base::CheckedNumeric FX_SAFE_SIZE_T; -typedef base::CheckedNumeric FX_SAFE_FILESIZE; +typedef pdfium::base::CheckedNumeric FX_SAFE_DWORD; +typedef pdfium::base::CheckedNumeric FX_SAFE_INT32; +typedef pdfium::base::CheckedNumeric FX_SAFE_SIZE_T; +typedef pdfium::base::CheckedNumeric FX_SAFE_FILESIZE; #endif // FX_SAFE_TYPES_H_ -- cgit v1.2.3