From 8940993efffaaf432320509555dc61122b8b72b2 Mon Sep 17 00:00:00 2001 From: Wei Li Date: Mon, 28 Mar 2016 10:33:33 -0700 Subject: Reduce signed/unsigned comparison warnings The warnings generated by Clang. This is part 1 for some simple cases. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1840483003 . --- core/fpdfapi/fpdf_page/cpdf_textobject.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'core/fpdfapi/fpdf_page/cpdf_textobject.cpp') diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp index 7ca03b4f05..444101fb9e 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp @@ -28,7 +28,7 @@ void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[index]; pInfo->m_OriginX = index ? m_pCharPos[index - 1] : 0; pInfo->m_OriginY = 0; - if (pInfo->m_CharCode == -1) { + if (pInfo->m_CharCode == CPDF_Font::kInvalidCharCode) { return; } CPDF_Font* pFont = m_TextState.GetFont(); @@ -54,7 +54,7 @@ int CPDF_TextObject::CountChars() const { } int count = 0; for (int i = 0; i < m_nChars; ++i) - if (m_pCharCodes[i] != (uint32_t)-1) { + if (m_pCharCodes[i] != CPDF_Font::kInvalidCharCode) { ++count; } return count; @@ -70,10 +70,11 @@ void CPDF_TextObject::GetCharInfo(int index, } int count = 0; for (int i = 0; i < m_nChars; ++i) { - if (m_pCharCodes[i] != (uint32_t)-1) { + if (m_pCharCodes[i] != CPDF_Font::kInvalidCharCode) { if (count == index) { charcode = m_pCharCodes[i]; - if (i == m_nChars - 1 || m_pCharCodes[i + 1] != (uint32_t)-1) { + if (i == m_nChars - 1 || + m_pCharCodes[i + 1] != CPDF_Font::kInvalidCharCode) { kerning = 0; } else { kerning = m_pCharPos[i]; @@ -93,7 +94,7 @@ void CPDF_TextObject::GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const { int count = 0; for (int i = 0; i < m_nChars; ++i) { uint32_t charcode = m_pCharCodes[i]; - if (charcode == (uint32_t)-1) { + if (charcode == CPDF_Font::kInvalidCharCode) { continue; } if (count == index) { @@ -156,7 +157,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, } if (i != nsegs - 1) { m_pCharPos[index - 1] = pKerning[i]; - m_pCharCodes[index++] = (uint32_t)-1; + m_pCharCodes[index++] = CPDF_Font::kInvalidCharCode; } } } else { @@ -206,7 +207,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, uint32_t charcode = m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (i > 0) { - if (charcode == (uint32_t)-1) { + if (charcode == CPDF_Font::kInvalidCharCode) { curpos -= (m_pCharPos[i - 1] * fontsize) / 1000; continue; } -- cgit v1.2.3