summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/font/cpdf_cmap.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_cmap.h2
-rw-r--r--core/fpdfapi/font/cpdf_cmapparser.cpp17
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_streamparser.cpp10
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp2
-rw-r--r--core/fpdftext/cpdf_linkextract.cpp12
-rw-r--r--core/fpdftext/cpdf_textpage.cpp8
-rw-r--r--core/fxcrt/cfx_bytestring.cpp2
-rw-r--r--core/fxcrt/cfx_chariter.cpp7
-rw-r--r--core/fxcrt/cfx_seekablestreamproxy.cpp4
-rw-r--r--core/fxcrt/cfx_string_data_template.h6
-rw-r--r--core/fxcrt/fx_basic.h2
-rw-r--r--core/fxcrt/fx_basic_buffer.cpp2
-rw-r--r--core/fxcrt/fx_basic_util.cpp2
15 files changed, 40 insertions, 42 deletions
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index 55f5ccc5c5..7b88346d64 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -182,7 +182,7 @@ const PredefinedCMap g_PredefinedCMaps[] = {
};
int CheckFourByteCodeRange(uint8_t* codes,
- int size,
+ FX_STRSIZE size,
const std::vector<CPDF_CMap::CodeRange>& ranges) {
int iSeg = pdfium::CollectionSize<int>(ranges) - 1;
while (iSeg >= 0) {
@@ -216,7 +216,7 @@ int GetFourByteCharSizeImpl(uint32_t charcode,
codes[0] = codes[1] = 0x00;
codes[2] = (uint8_t)(charcode >> 8 & 0xFF);
codes[3] = (uint8_t)charcode;
- int offset = 0;
+ FX_STRSIZE offset = 0;
int size = 4;
for (int i = 0; i < 4; ++i) {
int iSeg = pdfium::CollectionSize<int>(ranges) - 1;
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index ab495efbfc..b47b12d531 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -37,7 +37,7 @@ class CPDF_CMap : public CFX_Retainable {
};
struct CodeRange {
- int m_CharSize;
+ FX_STRSIZE m_CharSize;
uint8_t m_Lower[4];
uint8_t m_Upper[4];
};
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index 272f8deb34..101ae5f0c8 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -141,7 +141,8 @@ uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
return 0;
pdfium::base::CheckedNumeric<uint32_t> num = 0;
if (word[0] == '<') {
- for (int i = 1; i < word.GetLength() && std::isxdigit(word[i]); ++i) {
+ for (FX_STRSIZE i = 1; i < word.GetLength() && std::isxdigit(word[i]);
+ ++i) {
num = num * 16 + FXSYS_HexCharToInt(word[i]);
if (!num.IsValid())
return 0;
@@ -149,7 +150,7 @@ uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
return num.ValueOrDie();
}
- for (int i = 0; i < word.GetLength() && std::isdigit(word[i]); ++i) {
+ for (FX_STRSIZE i = 0; i < word.GetLength() && std::isdigit(word[i]); ++i) {
num = num * 10 + FXSYS_DecimalCharToInt(static_cast<wchar_t>(word[i]));
if (!num.IsValid())
return 0;
@@ -164,7 +165,7 @@ bool CPDF_CMapParser::CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
if (first.GetLength() == 0 || first[0] != '<')
return false;
- int i;
+ FX_STRSIZE i;
for (i = 1; i < first.GetLength(); ++i) {
if (first[i] == '>') {
break;
@@ -181,14 +182,10 @@ bool CPDF_CMapParser::CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
FXSYS_HexCharToInt(digit1) * 16 + FXSYS_HexCharToInt(digit2);
}
- uint32_t size = second.GetLength();
+ FX_STRSIZE size = second.GetLength();
for (i = 0; i < range.m_CharSize; ++i) {
- uint8_t digit1 = ((uint32_t)i * 2 + 1 < size)
- ? second[static_cast<FX_STRSIZE>(i * 2 + 1)]
- : '0';
- uint8_t digit2 = ((uint32_t)i * 2 + 2 < size)
- ? second[static_cast<FX_STRSIZE>(i * 2 + 2)]
- : '0';
+ uint8_t digit1 = (i * 2 + 1 < size) ? second[i * 2 + 1] : '0';
+ uint8_t digit2 = (i * 2 + 2 < size) ? second[i * 2 + 2] : '0';
range.m_Upper[i] =
FXSYS_HexCharToInt(digit1) * 16 + FXSYS_HexCharToInt(digit2);
}
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index efdd66b442..2c3f13e9c2 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -257,7 +257,7 @@ void CPDF_Image::SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
int32_t maskWidth = pMaskBitmap->GetWidth();
int32_t maskHeight = pMaskBitmap->GetHeight();
std::unique_ptr<uint8_t, FxFreeDeleter> mask_buf;
- FX_STRSIZE mask_size = 0;
+ int32_t mask_size = 0;
auto pMaskDict =
pdfium::MakeUnique<CPDF_Dictionary>(m_pDocument->GetByteStringPool());
pMaskDict->SetNewFor<CPDF_Name>("Type", "XObject");
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index 9d7dd1ed55..f745331818 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -478,9 +478,9 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
case 0:
if (ch == ')') {
if (parlevel == 0) {
- return CFX_ByteString(
- buf.str().c_str(),
- std::min(static_cast<int>(buf.tellp()), kMaxStringLength));
+ return CFX_ByteString(buf.str().c_str(),
+ std::min(static_cast<FX_STRSIZE>(buf.tellp()),
+ kMaxStringLength));
}
parlevel--;
buf << ')';
@@ -557,7 +557,7 @@ CFX_ByteString CPDF_StreamParser::ReadString() {
return CFX_ByteString(
buf.str().c_str(),
- std::min(static_cast<int>(buf.tellp()), kMaxStringLength));
+ std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength));
}
CFX_ByteString CPDF_StreamParser::ReadHexString() {
@@ -590,7 +590,7 @@ CFX_ByteString CPDF_StreamParser::ReadHexString() {
return CFX_ByteString(
buf.str().c_str(),
- std::min(static_cast<int>(buf.tellp()), kMaxStringLength));
+ std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength));
}
bool CPDF_StreamParser::PositionIsInBounds() const {
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 9c3730ad70..7e73f7e5a5 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -377,7 +377,7 @@ int CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2) {
if (name1.GetLength() == name2.GetLength())
return name1 == name2 ? 1 : 0;
- int i = 0;
+ FX_STRSIZE i = 0;
while (ptr1[i] == ptr2[i])
i++;
if (i == name1.GetLength())
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index cfa9dbba7f..880a4ceb92 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -244,8 +244,8 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
return false;
// Check the local part.
- int pPos = aPos.value(); // Used to track the position of '@' or '.'.
- for (int i = aPos.value() - 1; i >= 0; i--) {
+ FX_STRSIZE pPos = aPos.value(); // Used to track the position of '@' or '.'.
+ for (FX_STRSIZE i = aPos.value() - 1; i >= 0; i--) {
wchar_t ch = (*str)[i];
if (ch == L'_' || ch == L'-' || FXSYS_iswalnum(ch))
continue;
@@ -257,7 +257,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
}
// End extracting for other invalid chars, '.' at the beginning, or
// consecutive '.'.
- int removed_len = i == pPos - 1 ? i + 2 : i + 1;
+ FX_STRSIZE removed_len = i == pPos - 1 ? i + 2 : i + 1;
*str = str->Right(str->GetLength() - removed_len);
break;
}
@@ -279,16 +279,16 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString* str) {
return false;
// Validate all other chars in domain name.
- int nLen = str->GetLength();
+ FX_STRSIZE nLen = str->GetLength();
pPos = 0; // Used to track the position of '.'.
- for (int i = aPos.value() + 1; i < nLen; i++) {
+ for (FX_STRSIZE i = aPos.value() + 1; i < nLen; i++) {
wchar_t wch = (*str)[i];
if (wch == L'-' || FXSYS_iswalnum(wch))
continue;
if (wch != L'.' || i == pPos + 1) {
// Domain name should end before invalid char.
- int host_end = i == pPos + 1 ? i - 2 : i - 1;
+ FX_STRSIZE host_end = i == pPos + 1 ? i - 2 : i - 1;
if (pPos > 0 && host_end - aPos.value() >= 3) {
// Trim the ending invalid chars if there is at least one '.' and name.
*str = str->Left(host_end + 1);
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 223b59f4e8..ffc3729af4 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -649,7 +649,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(wchar_t wChar,
if (nCount >= 1) {
pDst = FX_Alloc(wchar_t, nCount);
Unicode_GetNormalization(wChar, pDst);
- for (int nIndex = 0; nIndex < nCount; nIndex++) {
+ for (FX_STRSIZE nIndex = 0; nIndex < nCount; nIndex++) {
PAGECHAR_INFO info2 = info;
info2.m_Unicode = pDst[nIndex];
info2.m_Flag = FPDFTEXT_CHAR_PIECE;
@@ -679,7 +679,7 @@ void CPDF_TextPage::AddCharInfoByRLDirection(wchar_t wChar,
if (nCount >= 1) {
pDst = FX_Alloc(wchar_t, nCount);
Unicode_GetNormalization(wChar, pDst);
- for (int nIndex = 0; nIndex < nCount; nIndex++) {
+ for (FX_STRSIZE nIndex = 0; nIndex < nCount; nIndex++) {
PAGECHAR_INFO info2 = info;
info2.m_Unicode = pDst[nIndex];
info2.m_Flag = FPDFTEXT_CHAR_PIECE;
@@ -700,7 +700,7 @@ void CPDF_TextPage::CloseTempLine() {
CFX_WideString str = m_TempTextBuf.MakeString();
bool bPrevSpace = false;
- for (int i = 0; i < str.GetLength(); i++) {
+ for (FX_STRSIZE i = 0; i < str.GetLength(); i++) {
if (str[i] != ' ') {
bPrevSpace = false;
continue;
@@ -1222,7 +1222,7 @@ bool CPDF_TextPage::IsHyphen(wchar_t curChar) {
FX_STRSIZE nCount = strCurText.GetLength();
if (nCount < 1)
return false;
- int nIndex = nCount - 1;
+ FX_STRSIZE nIndex = nCount - 1;
wchar_t wcTmp = strCurText[nIndex];
while (wcTmp == 0x20 && nIndex > 0 && nIndex <= nCount - 1)
wcTmp = strCurText[--nIndex];
diff --git a/core/fxcrt/cfx_bytestring.cpp b/core/fxcrt/cfx_bytestring.cpp
index ac390949ee..13b6673c70 100644
--- a/core/fxcrt/cfx_bytestring.cpp
+++ b/core/fxcrt/cfx_bytestring.cpp
@@ -427,7 +427,7 @@ FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE index, FX_STRSIZE count) {
return old_length;
ReallocBeforeWrite(old_length);
- int chars_to_copy = old_length - removal_length + 1;
+ FX_STRSIZE chars_to_copy = old_length - removal_length + 1;
memmove(m_pData->m_String + index, m_pData->m_String + removal_length,
chars_to_copy);
m_pData->m_nDataLength = old_length - count;
diff --git a/core/fxcrt/cfx_chariter.cpp b/core/fxcrt/cfx_chariter.cpp
index db94fb09f4..827e86967d 100644
--- a/core/fxcrt/cfx_chariter.cpp
+++ b/core/fxcrt/cfx_chariter.cpp
@@ -21,7 +21,7 @@ bool CFX_CharIter::Next(bool bPrev) {
return false;
m_nIndex--;
} else {
- if (m_nIndex + 1 >= m_wsText.GetLength())
+ if (static_cast<FX_STRSIZE>(m_nIndex + 1) >= m_wsText.GetLength())
return false;
m_nIndex++;
}
@@ -33,7 +33,7 @@ wchar_t CFX_CharIter::GetChar() const {
}
void CFX_CharIter::SetAt(int32_t nIndex) {
- if (nIndex < 0 || nIndex >= m_wsText.GetLength())
+ if (nIndex < 0 || static_cast<FX_STRSIZE>(nIndex) >= m_wsText.GetLength())
return;
m_nIndex = nIndex;
}
@@ -43,7 +43,8 @@ int32_t CFX_CharIter::GetAt() const {
}
bool CFX_CharIter::IsEOF(bool bTail) const {
- return bTail ? (m_nIndex + 1 == m_wsText.GetLength()) : (m_nIndex == 0);
+ return bTail ? (static_cast<FX_STRSIZE>(m_nIndex + 1) == m_wsText.GetLength())
+ : (m_nIndex == 0);
}
std::unique_ptr<IFX_CharIter> CFX_CharIter::Clone() const {
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index e610e0a9c3..da1170717a 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -98,8 +98,8 @@ void UTF16ToWChar(void* pBuffer, FX_STRSIZE iLength) {
uint16_t* pSrc = static_cast<uint16_t*>(pBuffer);
wchar_t* pDst = static_cast<wchar_t*>(pBuffer);
- while (--iLength >= 0)
- pDst[iLength] = static_cast<wchar_t>(pSrc[iLength]);
+ for (FX_STRSIZE i = 0; i < iLength; i++)
+ pDst[i] = static_cast<wchar_t>(pSrc[i]);
}
void SwapByteOrder(wchar_t* pStr, FX_STRSIZE iLength) {
diff --git a/core/fxcrt/cfx_string_data_template.h b/core/fxcrt/cfx_string_data_template.h
index e39f6a5dfd..eabb608818 100644
--- a/core/fxcrt/cfx_string_data_template.h
+++ b/core/fxcrt/cfx_string_data_template.h
@@ -21,7 +21,7 @@ class CFX_StringDataTemplate {
// NUL char that is not included in |m_nAllocLength|.
int overhead =
offsetof(CFX_StringDataTemplate, m_String) + sizeof(CharType);
- pdfium::base::CheckedNumeric<int> nSize = nLen;
+ pdfium::base::CheckedNumeric<FX_STRSIZE> nSize = nLen;
nSize *= sizeof(CharType);
nSize += overhead;
@@ -31,8 +31,8 @@ class CFX_StringDataTemplate {
// by using this otherwise wasted space.
nSize += 7;
nSize &= ~7;
- int totalSize = nSize.ValueOrDie();
- int usableLen = (totalSize - overhead) / sizeof(CharType);
+ FX_STRSIZE totalSize = nSize.ValueOrDie();
+ FX_STRSIZE usableLen = (totalSize - overhead) / sizeof(CharType);
ASSERT(usableLen >= nLen);
void* pData = pdfium::base::PartitionAllocGeneric(
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h
index 47cce9a60f..1f05dfb627 100644
--- a/core/fxcrt/fx_basic.h
+++ b/core/fxcrt/fx_basic.h
@@ -43,7 +43,7 @@ class CFX_BinaryBuf {
}
void InsertBlock(FX_STRSIZE pos, const void* pBuf, FX_STRSIZE size);
- void Delete(int start_index, int count);
+ void Delete(FX_STRSIZE start_index, FX_STRSIZE count);
// Releases ownership of |m_pBuffer| and returns it.
std::unique_ptr<uint8_t, FxFreeDeleter> DetachBuffer();
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index a359bdd5d0..310aec7faf 100644
--- a/core/fxcrt/fx_basic_buffer.cpp
+++ b/core/fxcrt/fx_basic_buffer.cpp
@@ -23,7 +23,7 @@ CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size)
CFX_BinaryBuf::~CFX_BinaryBuf() {}
-void CFX_BinaryBuf::Delete(int start_index, int count) {
+void CFX_BinaryBuf::Delete(FX_STRSIZE start_index, FX_STRSIZE count) {
if (!m_pBuffer || start_index < 0 || count < 0 || count > m_DataSize ||
start_index > m_DataSize - count) {
return;
diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp
index 05ab20472c..6f59f32fff 100644
--- a/core/fxcrt/fx_basic_util.cpp
+++ b/core/fxcrt/fx_basic_util.cpp
@@ -28,7 +28,7 @@ bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
pdfium::base::CheckedNumeric<uint32_t> integer = 0;
bool bNegative = false;
bool bSigned = false;
- int cc = 0;
+ FX_STRSIZE cc = 0;
if (strc[0] == '+') {
cc++;
bSigned = true;