summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn2
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp12
-rw-r--r--core/src/fxcrt/fx_basic_array.cpp8
-rw-r--r--core/src/fxcrt/fx_basic_bstring.cpp4
-rw-r--r--core/src/fxcrt/fx_basic_wstring.cpp6
-rw-r--r--core/src/fxcrt/fx_safe_types.h10
-rw-r--r--fpdfsdk/src/fpdfview.cpp6
-rw-r--r--fpdfsdk/src/javascript/Document.cpp6
-rw-r--r--pdfium.gyp2
-rw-r--r--third_party/BUILD.gn18
-rw-r--r--third_party/base/logging.h (renamed from third_party/logging.h)6
-rw-r--r--third_party/base/macros.h (renamed from third_party/macros.h)62
-rw-r--r--third_party/base/numerics/OWNERS (renamed from third_party/numerics/OWNERS)0
-rw-r--r--third_party/base/numerics/safe_conversions.h (renamed from third_party/numerics/safe_conversions.h)8
-rw-r--r--third_party/base/numerics/safe_conversions_impl.h (renamed from third_party/numerics/safe_conversions_impl.h)8
-rw-r--r--third_party/base/numerics/safe_math.h (renamed from third_party/numerics/safe_math.h)9
-rw-r--r--third_party/base/numerics/safe_math_impl.h (renamed from third_party/numerics/safe_math_impl.h)8
-rw-r--r--third_party/base/template_util.h (renamed from third_party/template_util.h)8
-rw-r--r--third_party/third_party.gyp16
20 files changed, 105 insertions, 96 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 0d2f69eb98..7f4bbda500 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -95,7 +95,7 @@ static_library("pdfium") {
deps = [
"third_party:bigint",
- "third_party:safemath",
+ "third_party:pdfium_base",
":fdrm",
":formfiller",
":fpdfapi",
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<FX_DWORD, FX_INT32> (startnum);
- FX_DWORD count = base::checked_cast<FX_DWORD, FX_INT32> (arrIndex[i].second);
+ m_dwXrefStartObjNum = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (startnum);
+ FX_DWORD count = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (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<FX_DWORD, FX_INT32> (m_V5Type.GetSize());
+ FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (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<FX_FILESIZE> pos = m_Pos;
+ pdfium::base::CheckedNumeric<FX_FILESIZE> 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<FX_DWORD> size = original_size;
+ pdfium::base::CheckedNumeric<FX_DWORD> 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<FX_DWORD> size = original_size;
+ pdfium::base::CheckedNumeric<FX_DWORD> 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<int> totalSize = nNewSize;
+ pdfium::base::CheckedNumeric<int> 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<int> totalSize = nNewMax;
+ pdfium::base::CheckedNumeric<int> 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<int> newSize = m_nSize;
+ pdfium::base::CheckedNumeric<int> 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<int> nSize = nLen;
+ pdfium::base::CheckedNumeric<int> 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<int> iSize = static_cast<int>(sizeof(FX_WCHAR));
+ pdfium::base::CheckedNumeric<int> iSize = static_cast<int>(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<FX_STRSIZE> iSize = static_cast<FX_STRSIZE>(sizeof(FX_WCHAR));
+ pdfium::base::CheckedNumeric<FX_STRSIZE> iSize = static_cast<FX_STRSIZE>(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 <stdlib.h> // For size_t.
-#include "../../../third_party/numerics/safe_math.h"
+#include "../../../third_party/base/numerics/safe_math.h"
-typedef base::CheckedNumeric<FX_DWORD> FX_SAFE_DWORD;
-typedef base::CheckedNumeric<FX_INT32> FX_SAFE_INT32;
-typedef base::CheckedNumeric<size_t> FX_SAFE_SIZE_T;
-typedef base::CheckedNumeric<FX_FILESIZE> FX_SAFE_FILESIZE;
+typedef pdfium::base::CheckedNumeric<FX_DWORD> FX_SAFE_DWORD;
+typedef pdfium::base::CheckedNumeric<FX_INT32> FX_SAFE_INT32;
+typedef pdfium::base::CheckedNumeric<size_t> FX_SAFE_SIZE_T;
+typedef pdfium::base::CheckedNumeric<FX_FILESIZE> FX_SAFE_FILESIZE;
#endif // FX_SAFE_TYPES_H_
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 2a0c0e0507..f726fc9ae0 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -11,7 +11,7 @@
#include "../include/fpdf_progressive.h"
#include "../include/fpdf_ext.h"
#include "../../../core/src/fxcrt/fx_safe_types.h"
-#include "../../third_party/numerics/safe_conversions_impl.h"
+#include "../../third_party/base/numerics/safe_conversions_impl.h"
#include "../include/fpdfformfill.h"
#include "../include/fpdfxfa/fpdfxfa_doc.h"
#include "../include/fpdfxfa/fpdfxfa_app.h"
@@ -129,7 +129,7 @@ FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, FX_FILESIZE offset, size_t si
if (offset < 0) {
return FALSE;
}
- FX_SAFE_FILESIZE newPos = base::checked_cast<FX_FILESIZE, size_t>(size);
+ FX_SAFE_FILESIZE newPos = pdfium::base::checked_cast<FX_FILESIZE, size_t>(size);
newPos += offset;
if (!newPos.IsValid() || newPos.ValueOrDie() > m_FileAccess.m_FileLen) {
return FALSE;
@@ -329,7 +329,7 @@ public:
if (offset < 0) {
return FALSE;
}
- FX_SAFE_FILESIZE newPos = base::checked_cast<FX_FILESIZE, size_t>(size);
+ FX_SAFE_FILESIZE newPos = pdfium::base::checked_cast<FX_FILESIZE, size_t>(size);
newPos += offset;
if (!newPos.IsValid() || newPos.ValueOrDie() > (FX_DWORD)m_size) {
return FALSE;
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 2c12068328..e35c538c22 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -18,7 +18,7 @@
#include "../../include/javascript/Icon.h"
#include "../../include/javascript/Field.h"
-#include "../../../third_party/numerics/safe_math.h"
+#include "../../../third_party/base/numerics/safe_math.h"
static v8::Isolate* GetIsolate(IFXJS_Context* cc)
{
@@ -1428,7 +1428,7 @@ FX_BOOL Document::documentFileName(OBJ_PROP_PARAMS)
CFX_WideString Document::ReversalStr(CFX_WideString cbFrom)
{
size_t iLength = cbFrom.GetLength();
- base::CheckedNumeric<size_t> iSize = sizeof(wchar_t);
+ pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t);
iSize *= (iLength + 1);
wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie());
wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength);
@@ -1449,7 +1449,7 @@ CFX_WideString Document::ReversalStr(CFX_WideString cbFrom)
CFX_WideString Document::CutString(CFX_WideString cbFrom)
{
size_t iLength = cbFrom.GetLength();
- base::CheckedNumeric<size_t> iSize = sizeof(wchar_t);
+ pdfium::base::CheckedNumeric<size_t> iSize = sizeof(wchar_t);
iSize *= (iLength + 1);
wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie());
wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength);
diff --git a/pdfium.gyp b/pdfium.gyp
index f23db228ef..96f0e5ce1f 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -45,7 +45,7 @@
'type': 'static_library',
'dependencies': [
'third_party/third_party.gyp:bigint',
- 'third_party/third_party.gyp:safemath',
+ 'third_party/third_party.gyp:pdfium_base',
'fdrm',
'fpdfdoc',
'fpdfapi',
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index df02938a93..fcb09c4b47 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -6,7 +6,7 @@ group("third_party") {
deps = [
":bigint",
":freetype",
- ":safemath",
+ ":pdfium_base",
]
}
@@ -69,20 +69,20 @@ static_library("freetype") {
]
}
-component("safemath") {
+component("pdfium_base") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//third_party/pdfium:pdfium_config",
"//build/config/compiler:no_chromium_code",
]
sources = [
- "logging.h",
- "macros.h",
- "template_util.h",
- "numerics/safe_conversions.h",
- "numerics/safe_conversions_impl.h",
- "numerics/safe_math.h",
- "numerics/safe_math_impl.h",
+ "base/logging.h",
+ "base/macros.h",
+ "base/template_util.h",
+ "base/numerics/safe_conversions.h",
+ "base/numerics/safe_conversions_impl.h",
+ "base/numerics/safe_math.h",
+ "base/numerics/safe_math_impl.h",
]
}
diff --git a/third_party/logging.h b/third_party/base/logging.h
index 3629e84d4a..d24f93b2a1 100644
--- a/third_party/logging.h
+++ b/third_party/base/logging.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_LOGGING_H_
-#define BASE_LOGGING_H_
+#ifndef PDFIUM_THIRD_PARTY_BASE_LOGGING_H_
+#define PDFIUM_THIRD_PARTY_BASE_LOGGING_H_
#include <stdlib.h>
@@ -15,4 +15,4 @@
#define NOTREACHED() abort()
-#endif // BASE_LOGGING_H_
+#endif // PDFIUM_THIRD_PARTY_BASE_LOGGING_H_
diff --git a/third_party/macros.h b/third_party/base/macros.h
index 92d4f34bda..05c3132e46 100644
--- a/third_party/macros.h
+++ b/third_party/base/macros.h
@@ -1,31 +1,31 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file contains macros and macro-like constructs (e.g., templates) that
-// are commonly used throughout Chromium source. (It may also contain things
-// that are closely related to things that are commonly used that belong in this
-// file.)
-
-#ifndef BASE_MACROS_H_
-#define BASE_MACROS_H_
-
-// The COMPILE_ASSERT macro can be used to verify that a compile time
-// expression is true. For example, you could use it to verify the
-// size of a static array:
-//
-// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES,
-// content_type_names_incorrect_size);
-//
-// or to make sure a struct is smaller than a certain size:
-//
-// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
-//
-// The second argument to the macro is the name of the variable. If
-// the expression is false, most compilers will issue a warning/error
-// containing the name of the variable.
-
-#undef COMPILE_ASSERT
-#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
-
-#endif // BASE_MACROS_H_
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains macros and macro-like constructs (e.g., templates) that
+// are commonly used throughout Chromium source. (It may also contain things
+// that are closely related to things that are commonly used that belong in this
+// file.)
+
+#ifndef PDFIUM_THIRD_PARTY_BASE_MACROS_H_
+#define PDFIUM_THIRD_PARTY_BASE_MACROS_H_
+
+// The COMPILE_ASSERT macro can be used to verify that a compile time
+// expression is true. For example, you could use it to verify the
+// size of a static array:
+//
+// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES,
+// content_type_names_incorrect_size);
+//
+// or to make sure a struct is smaller than a certain size:
+//
+// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
+//
+// The second argument to the macro is the name of the variable. If
+// the expression is false, most compilers will issue a warning/error
+// containing the name of the variable.
+
+#undef COMPILE_ASSERT
+#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
+
+#endif // PDFIUM_THIRD_PARTY_BASE_MACROS_H_
diff --git a/third_party/numerics/OWNERS b/third_party/base/numerics/OWNERS
index f7816afe81..f7816afe81 100644
--- a/third_party/numerics/OWNERS
+++ b/third_party/base/numerics/OWNERS
diff --git a/third_party/numerics/safe_conversions.h b/third_party/base/numerics/safe_conversions.h
index 681dc0a9cc..e95608e0a5 100644
--- a/third_party/numerics/safe_conversions.h
+++ b/third_party/base/numerics/safe_conversions.h
@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_SAFE_CONVERSIONS_H_
-#define BASE_SAFE_CONVERSIONS_H_
+#ifndef PDFIUM_THIRD_PARTY_BASE_SAFE_CONVERSIONS_H_
+#define PDFIUM_THIRD_PARTY_BASE_SAFE_CONVERSIONS_H_
#include <limits>
#include "../logging.h"
#include "safe_conversions_impl.h"
+namespace pdfium {
namespace base {
// Convenience function that returns true if the supplied value is in range
@@ -59,6 +60,7 @@ inline Dst saturated_cast(Src value) {
}
} // namespace base
+} // namespace pdfium
-#endif // BASE_SAFE_CONVERSIONS_H_
+#endif // PDFIUM_THIRD_PARTY_BASE_SAFE_CONVERSIONS_H_
diff --git a/third_party/numerics/safe_conversions_impl.h b/third_party/base/numerics/safe_conversions_impl.h
index a357e518d1..7c88dda0a8 100644
--- a/third_party/numerics/safe_conversions_impl.h
+++ b/third_party/base/numerics/safe_conversions_impl.h
@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_SAFE_CONVERSIONS_IMPL_H_
-#define BASE_SAFE_CONVERSIONS_IMPL_H_
+#ifndef PDFIUM_THIRD_PARTY_BASE_SAFE_CONVERSIONS_IMPL_H_
+#define PDFIUM_THIRD_PARTY_BASE_SAFE_CONVERSIONS_IMPL_H_
#include <limits>
#include "../macros.h"
#include "../template_util.h"
+namespace pdfium {
namespace base {
namespace internal {
@@ -212,6 +213,7 @@ inline RangeConstraint DstRangeRelationToSrcRange(Src value) {
} // namespace internal
} // namespace base
+} // namespace pdfium
-#endif // BASE_SAFE_CONVERSIONS_IMPL_H_
+#endif // PDFIUM_THIRD_PARTY_BASE_SAFE_CONVERSIONS_IMPL_H_
diff --git a/third_party/numerics/safe_math.h b/third_party/base/numerics/safe_math.h
index 4b38ff2b1f..9540e83321 100644
--- a/third_party/numerics/safe_math.h
+++ b/third_party/base/numerics/safe_math.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_SAFE_MATH_H_
-#define BASE_SAFE_MATH_H_
+#ifndef PDFIUM_THIRD_PARTY_BASE_SAFE_MATH_H_
+#define PDFIUM_THIRD_PARTY_BASE_SAFE_MATH_H_
#include "safe_math_impl.h"
+namespace pdfium {
namespace base {
-
namespace internal {
// CheckedNumeric implements all the logic and operators for detecting integer
@@ -267,5 +267,6 @@ BASE_NUMERIC_ARITHMETIC_OPERATORS(Mod, %, %= )
using internal::CheckedNumeric;
} // namespace base
+} // namespace pdfium
-#endif // BASE_SAFE_MATH_H_
+#endif // PDFIUM_THIRD_PARTY_BASE_SAFE_MATH_H_
diff --git a/third_party/numerics/safe_math_impl.h b/third_party/base/numerics/safe_math_impl.h
index 4bf59e64e0..f9a4a71570 100644
--- a/third_party/numerics/safe_math_impl.h
+++ b/third_party/base/numerics/safe_math_impl.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SAFE_MATH_IMPL_H_
-#define SAFE_MATH_IMPL_H_
+#ifndef PDFIUM_THIRD_PARTY_SAFE_MATH_IMPL_H_
+#define PDFIUM_THIRD_PARTY_SAFE_MATH_IMPL_H_
#include <stdint.h>
@@ -15,6 +15,7 @@
#include "../template_util.h"
#include "safe_conversions.h"
+namespace pdfium {
namespace base {
namespace internal {
@@ -498,5 +499,6 @@ struct IsIntegerArithmeticSafe {
} // namespace internal
} // namespace base
+} // namespace pdfium
-#endif // SAFE_MATH_IMPL_H_
+#endif // PDFIUM_THIRD_PARTY_SAFE_MATH_IMPL_H_
diff --git a/third_party/template_util.h b/third_party/base/template_util.h
index d4508dd696..ab660940f0 100644
--- a/third_party/template_util.h
+++ b/third_party/base/template_util.h
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_TEMPLATE_UTIL_H_
-#define BASE_TEMPLATE_UTIL_H_
+#ifndef PDFIUM_THIRD_PARTY_BASE_TEMPLATE_UTIL_H_
+#define PDFIUM_THIRD_PARTY_BASE_TEMPLATE_UTIL_H_
#include <cstddef> // For size_t.
+namespace pdfium {
namespace base {
template<class T, T v>
@@ -29,5 +30,6 @@ template<class T>
struct enable_if<true, T> { typedef T type; };
} // namespace base
+} // namespace pdfium
-#endif // BASE_TEMPLATE_UTIL_H_
+#endif // PDFIUM_THIRD_PARTY_BASE_TEMPLATE_UTIL_H_
diff --git a/third_party/third_party.gyp b/third_party/third_party.gyp
index ac7fb7792a..d54905c022 100644
--- a/third_party/third_party.gyp
+++ b/third_party/third_party.gyp
@@ -61,16 +61,16 @@
],
},
{
- 'target_name': 'safemath',
+ 'target_name': 'pdfium_base',
'type': 'none',
'sources': [
- 'logging.h',
- 'macros.h',
- 'template_util.h',
- 'numerics/safe_conversions.h',
- 'numerics/safe_conversions_impl.h',
- 'numerics/safe_math.h',
- 'numerics/safe_math_impl.h',
+ 'base/logging.h',
+ 'base/macros.h',
+ 'base/template_util.h',
+ 'base/numerics/safe_conversions.h',
+ 'base/numerics/safe_conversions_impl.h',
+ 'base/numerics/safe_math.h',
+ 'base/numerics/safe_math_impl.h',
],
},
],