Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: core/fpdfapi/fpdf_font/fpdf_font.cpp

Issue 1841643002: Code change to avoid signed/unsigned mismatch warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_font/font_int.h ('k') | core/fpdfapi/fpdf_font/fpdf_font_cid_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_font/fpdf_font.cpp
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp
index b0659b4a52adef9be588c005599c148e93a0a69e..ce2390ec083f37c28435487f5b0a97cc20473e1c 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -45,14 +45,14 @@ CFX_StockFontArray::~CFX_StockFontArray() {
}
}
-CPDF_Font* CFX_StockFontArray::GetFont(int index) const {
- if (index < 0 || index >= FX_ArraySize(m_StockFonts))
+CPDF_Font* CFX_StockFontArray::GetFont(uint32_t index) const {
+ if (index >= FX_ArraySize(m_StockFonts))
return nullptr;
return m_StockFonts[index].get();
}
-void CFX_StockFontArray::SetFont(int index, CPDF_Font* font) {
- if (index < 0 || index >= FX_ArraySize(m_StockFonts))
+void CFX_StockFontArray::SetFont(uint32_t index, CPDF_Font* font) {
+ if (index >= FX_ArraySize(m_StockFonts))
return;
m_StockFonts[index].reset(font);
}
@@ -64,14 +64,16 @@ CPDF_FontGlobals::CPDF_FontGlobals() {
CPDF_FontGlobals::~CPDF_FontGlobals() {}
-CPDF_Font* CPDF_FontGlobals::Find(CPDF_Document* pDoc, int index) {
+CPDF_Font* CPDF_FontGlobals::Find(CPDF_Document* pDoc, uint32_t index) {
auto it = m_StockMap.find(pDoc);
if (it == m_StockMap.end())
return nullptr;
return it->second ? it->second->GetFont(index) : nullptr;
}
-void CPDF_FontGlobals::Set(CPDF_Document* pDoc, int index, CPDF_Font* pFont) {
+void CPDF_FontGlobals::Set(CPDF_Document* pDoc,
+ uint32_t index,
+ CPDF_Font* pFont) {
if (!pdfium::ContainsKey(m_StockMap, pDoc))
m_StockMap[pDoc].reset(new CFX_StockFontArray);
m_StockMap[pDoc]->SetFont(index, pFont);
@@ -121,7 +123,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) {
uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) {
for (const auto& pair : m_Map) {
- if (pair.second == unicode)
+ if (pair.second == static_cast<uint32_t>(unicode))
return pair.first;
}
return 0;
« no previous file with comments | « core/fpdfapi/fpdf_font/font_int.h ('k') | core/fpdfapi/fpdf_font/fpdf_font_cid_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698