summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-16 13:53:42 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-16 13:53:42 -0700
commit3cc01f2ba255f4b7584668ee2b8e5ed97792c26d (patch)
tree6a207d8910696ef1c28ef60a855ae266f81067cd /core
parentc6450bb06b69528406a2a261c70c4ea769965a8d (diff)
downloadpdfium-3cc01f2ba255f4b7584668ee2b8e5ed97792c26d.tar.xz
Fix the code that causes warnings
These are the left or newly added code which causes compilation warnings of "signed and unsigned comparison". Need to fix them before I re-enable the warning flag. BUG=pdfium:29 Review-Url: https://codereview.chromium.org/1986533002
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_document.cpp4
-rw-r--r--core/fxcrt/fx_basic_wstring.cpp3
-rw-r--r--core/fxcrt/fx_basic_wstring_unittest.cpp8
-rw-r--r--core/fxge/win32/fx_win32_gdipext.cpp4
5 files changed, 11 insertions, 10 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp
index 58642a610f..12a36d921a 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp
@@ -76,7 +76,7 @@ TEST(cpdf_array, InsertAt) {
for (size_t i = 0; i < FX_ArraySize(elems); ++i)
arr->InsertAt(i, new CPDF_Number(elems[i]));
arr->InsertAt(10, new CPDF_Number(10));
- EXPECT_EQ(11, arr->GetCount());
+ EXPECT_EQ(11u, arr->GetCount());
for (size_t i = 0; i < FX_ArraySize(elems); ++i)
EXPECT_EQ(elems[i], arr->GetIntegerAt(i));
for (size_t i = FX_ArraySize(elems); i < 10; ++i)
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index 52899eedb3..13d9737b5b 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -1102,7 +1102,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
pBaseDict->SetAtName("Encoding", "WinAnsiEncoding");
} else {
flags |= PDFFONT_NONSYMBOLIC;
- int i;
+ size_t i;
for (i = 0; i < FX_ArraySize(g_FX_CharsetUnicodes); ++i) {
if (g_FX_CharsetUnicodes[i].m_Charset == pLogFont->lfCharSet)
break;
@@ -1136,7 +1136,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
int char_widths[224];
GetCharWidth(hDC, 32, 255, char_widths);
CPDF_Array* pWidths = new CPDF_Array;
- for (int i = 0; i < 224; i++)
+ for (size_t i = 0; i < 224; i++)
pWidths->AddInteger(char_widths[i]);
pBaseDict->SetAt("Widths", pWidths);
diff --git a/core/fxcrt/fx_basic_wstring.cpp b/core/fxcrt/fx_basic_wstring.cpp
index 241c3a6985..ba86823fe2 100644
--- a/core/fxcrt/fx_basic_wstring.cpp
+++ b/core/fxcrt/fx_basic_wstring.cpp
@@ -894,7 +894,8 @@ void CFX_WideString::TrimLeft(const CFX_WideStringC& pTargets) {
FX_STRSIZE pos = 0;
while (pos < len) {
FX_STRSIZE i = 0;
- while (i < pTargets.GetLength() && pTargets[i] != m_pData->m_String[pos]) {
+ while (i < pTargets.GetLength() &&
+ pTargets.CharAt(i) != m_pData->m_String[pos]) {
i++;
}
if (i == pTargets.GetLength()) {
diff --git a/core/fxcrt/fx_basic_wstring_unittest.cpp b/core/fxcrt/fx_basic_wstring_unittest.cpp
index 4b6f4a5800..efd958d8a6 100644
--- a/core/fxcrt/fx_basic_wstring_unittest.cpp
+++ b/core/fxcrt/fx_basic_wstring_unittest.cpp
@@ -691,10 +691,10 @@ TEST(fxcrt, WideStringUTF16LE_Encode) {
TEST(fxcrt, WideStringCOperatorSubscript) {
// CFX_WideStringC includes the NUL terminator for non-empty strings.
CFX_WideStringC abc(L"abc");
- EXPECT_EQ(L'a', abc[0]);
- EXPECT_EQ(L'b', abc[1]);
- EXPECT_EQ(L'c', abc[2]);
- EXPECT_EQ(L'\0', abc[3]);
+ EXPECT_EQ(L'a', abc.CharAt(0));
+ EXPECT_EQ(L'b', abc.CharAt(1));
+ EXPECT_EQ(L'c', abc.CharAt(2));
+ EXPECT_EQ(L'\0', abc.CharAt(3));
}
TEST(fxcrt, WideStringCOperatorLT) {
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp
index 15f0972bba..eb24410900 100644
--- a/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -673,7 +673,7 @@ static void OutputImage(GpGraphics* pGraphics,
CGdiplusExt::CGdiplusExt() {
m_hModule = NULL;
m_GdiModule = NULL;
- for (int i = 0; i < sizeof g_GdipFuncNames / sizeof(LPCSTR); i++) {
+ for (size_t i = 0; i < sizeof g_GdipFuncNames / sizeof(LPCSTR); i++) {
m_Functions[i] = NULL;
}
m_pGdiAddFontMemResourceEx = NULL;
@@ -690,7 +690,7 @@ void CGdiplusExt::Load() {
if (!m_hModule) {
return;
}
- for (int i = 0; i < sizeof g_GdipFuncNames / sizeof(LPCSTR); i++) {
+ for (size_t i = 0; i < sizeof g_GdipFuncNames / sizeof(LPCSTR); i++) {
m_Functions[i] = GetProcAddress(m_hModule, g_GdipFuncNames[i]);
if (!m_Functions[i]) {
m_hModule = NULL;