summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-06 12:06:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-06 12:06:35 -0700
commit4e20094dbb2ea942734b8986fa9a60d2f3ccbb1b (patch)
treeebb642f2387b2a5ab4335944c549eccd1d142124 /core/fpdfapi/fpdf_parser
parent6fe7d2174a47107578da912299c93b4dfb9f2add (diff)
downloadpdfium-4e20094dbb2ea942734b8986fa9a60d2f3ccbb1b.tar.xz
Rename FX_SAFE_DWORD to FX_SAFE_UINT32
We removed the FX_DWORD typedef in favour of uint32_t. This CL cleans up the FX_SAFE_DWORD naming to match. BUG=pdfium:81, pdfium:470 Review URL: https://codereview.chromium.org/1861403002
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp23
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_parser.cpp6
3 files changed, 16 insertions, 15 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
index 15f98b26b9..68f8b88557 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
@@ -1507,7 +1507,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckLinearizedData(
return DataAvailable;
if (!m_bMainXRefLoadTried) {
- FX_SAFE_DWORD data_size = m_dwFileLen;
+ FX_SAFE_UINT32 data_size = m_dwFileLen;
data_size -= m_dwLastXRefOffset;
if (!data_size.IsValid())
return DataError;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
index 18687e5fb7..3e08ead9ff 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
@@ -16,7 +16,7 @@
namespace {
bool CanReadFromBitStream(const CFX_BitStream* hStream,
- const FX_SAFE_DWORD& num_bits) {
+ const FX_SAFE_UINT32& num_bits) {
return num_bits.IsValid() &&
hStream->BitsRemaining() >= num_bits.ValueOrDie();
}
@@ -60,7 +60,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
// Item 2: The location of the first page's page object.
uint32_t dwFirstObjLoc = hStream->GetBits(32);
if (dwFirstObjLoc > static_cast<uint32_t>(nStreamOffset)) {
- FX_SAFE_DWORD safeLoc = pdfium::base::checked_cast<uint32_t>(nStreamLen);
+ FX_SAFE_UINT32 safeLoc = pdfium::base::checked_cast<uint32_t>(nStreamLen);
safeLoc += dwFirstObjLoc;
if (!safeLoc.IsValid())
return FALSE;
@@ -107,13 +107,13 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
if (nPages < 1)
return FALSE;
- FX_SAFE_DWORD required_bits = dwDeltaObjectsBits;
+ FX_SAFE_UINT32 required_bits = dwDeltaObjectsBits;
required_bits *= pdfium::base::checked_cast<uint32_t>(nPages);
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
for (int i = 0; i < nPages; ++i) {
- FX_SAFE_DWORD safeDeltaObj = hStream->GetBits(dwDeltaObjectsBits);
+ FX_SAFE_UINT32 safeDeltaObj = hStream->GetBits(dwDeltaObjectsBits);
safeDeltaObj += dwObjLeastNum;
if (!safeDeltaObj.IsValid())
return FALSE;
@@ -128,7 +128,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
CFX_ArrayTemplate<uint32_t> dwPageLenArray;
for (int i = 0; i < nPages; ++i) {
- FX_SAFE_DWORD safePageLen = hStream->GetBits(dwDeltaPageLenBits);
+ FX_SAFE_UINT32 safePageLen = hStream->GetBits(dwDeltaPageLenBits);
safePageLen += dwPageLeastLen;
if (!safePageLen.IsValid())
return FALSE;
@@ -191,7 +191,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
hStream->ByteAlign();
for (int i = 0; i < nPages; i++) {
- FX_SAFE_DWORD safeSize = m_dwNSharedObjsArray[i];
+ FX_SAFE_UINT32 safeSize = m_dwNSharedObjsArray[i];
safeSize *= dwSharedNumeratorBits;
if (!CanReadFromBitStream(hStream, safeSize))
return FALSE;
@@ -200,7 +200,8 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
}
hStream->ByteAlign();
- FX_SAFE_DWORD safeTotalPageLen = pdfium::base::checked_cast<uint32_t>(nPages);
+ FX_SAFE_UINT32 safeTotalPageLen =
+ pdfium::base::checked_cast<uint32_t>(nPages);
safeTotalPageLen *= dwDeltaPageLenBits;
if (!CanReadFromBitStream(hStream, safeTotalPageLen))
return FALSE;
@@ -220,7 +221,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
if (nStreamOffset < 0 || nStreamLen < 1)
return FALSE;
- FX_SAFE_DWORD bit_offset = offset;
+ FX_SAFE_UINT32 bit_offset = offset;
bit_offset *= 8;
if (!bit_offset.IsValid() || hStream->GetPos() > bit_offset.ValueOrDie())
return FALSE;
@@ -263,14 +264,14 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
uint32_t dwPrevObjLen = 0;
uint32_t dwCurObjLen = 0;
- FX_SAFE_DWORD required_bits = dwSharedObjTotal;
+ FX_SAFE_UINT32 required_bits = dwSharedObjTotal;
required_bits *= dwDeltaGroupLen;
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
for (uint32_t i = 0; i < dwSharedObjTotal; ++i) {
dwPrevObjLen = dwCurObjLen;
- FX_SAFE_DWORD safeObjLen = hStream->GetBits(dwDeltaGroupLen);
+ FX_SAFE_UINT32 safeObjLen = hStream->GetBits(dwDeltaGroupLen);
safeObjLen += dwGroupLeastLen;
if (!safeObjLen.IsValid())
return FALSE;
@@ -281,7 +282,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
if (i == 0)
m_szSharedObjOffsetArray.push_back(m_szFirstPageObjOffset);
} else {
- FX_SAFE_DWORD safeObjNum = dwFirstSharedObjNum;
+ FX_SAFE_UINT32 safeObjNum = dwFirstSharedObjNum;
safeObjNum += i - m_nFirstPageSharedObjs;
if (!safeObjNum.IsValid())
return FALSE;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
index 73ca71ef1a..15af1ca5c7 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
@@ -1012,7 +1012,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
}
CFX_ArrayTemplate<uint32_t> WidthArray;
- FX_SAFE_DWORD dwAccWidth = 0;
+ FX_SAFE_UINT32 dwAccWidth = 0;
for (uint32_t i = 0; i < pArray->GetCount(); i++) {
WidthArray.Add(pArray->GetIntegerAt(i));
dwAccWidth += WidthArray[i];
@@ -1039,7 +1039,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
pdfium::base::checked_cast<uint32_t, int32_t>(startnum);
uint32_t count =
pdfium::base::checked_cast<uint32_t, int32_t>(arrIndex[i].second);
- FX_SAFE_DWORD dwCaculatedSize = segindex;
+ FX_SAFE_UINT32 dwCaculatedSize = segindex;
dwCaculatedSize += count;
dwCaculatedSize *= totalWidth;
if (!dwCaculatedSize.IsValid() ||
@@ -1048,7 +1048,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
}
const uint8_t* segstart = pData + segindex * totalWidth;
- FX_SAFE_DWORD dwMaxObjNum = startnum;
+ FX_SAFE_UINT32 dwMaxObjNum = startnum;
dwMaxObjNum += count;
uint32_t dwV5Size = m_ObjectInfo.empty() ? 0 : GetLastObjNum() + 1;
if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size)