From a74e9c9d3b0d98c5d6042d7ca739cd921a4524db Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 29 Feb 2016 14:03:09 -0500 Subject: Using size_t to silence warnings. Change a couple int32_t's to size_t in order to fix warnings on OSX. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1747793002 . --- xfa/src/fgas/src/font/fx_stdfontmgr.cpp | 11 +++++----- xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 11 +++++----- .../fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp | 25 ++++++++++------------ xfa/src/fxfa/src/app/xfa_fwltheme.cpp | 9 ++++---- 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp index b363ccbdd7..6ad4918203 100644 --- a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp +++ b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp @@ -485,11 +485,12 @@ const FX_CHAR* g_FontFolders[] = { "/system/fonts", #endif }; + CFX_FontSourceEnum_File::CFX_FontSourceEnum_File() { - for (int32_t i = 0; i < sizeof(g_FontFolders) / sizeof(const FX_CHAR*); i++) { + for (size_t i = 0; i < FX_ArraySize(g_FontFolders); ++i) m_FolderPaths.Add(g_FontFolders[i]); - } } + CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { Restart: void* pCurHandle = @@ -1119,11 +1120,9 @@ static const FX_BitCodePage g_Bit2CodePage[] = { }; FX_WORD FX_GetCodePageBit(FX_WORD wCodePage) { - for (int32_t i = 0; i < sizeof(g_Bit2CodePage) / sizeof(FX_BitCodePage); - i++) { - if (g_Bit2CodePage[i].wCodePage == wCodePage) { + for (size_t i = 0; i < FX_ArraySize(g_Bit2CodePage); ++i) { + if (g_Bit2CodePage[i].wCodePage == wCodePage) return g_Bit2CodePage[i].wBit; - } } return (FX_WORD)-1; } diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index f056c17616..5d363814af 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -42,7 +42,7 @@ CBC_OnedCodaBarWriter::CBC_OnedCodaBarWriter() { } CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {} FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { - for (int32_t i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) { + for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { if (START_END_CHARS[i] == start) { m_chStart = start; return TRUE; @@ -50,8 +50,9 @@ FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { } return FALSE; } + FX_BOOL CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) { - for (int32_t i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) { + for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { if (START_END_CHARS[i] == end) { m_chEnd = end; return TRUE; @@ -78,19 +79,19 @@ FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio) { } FX_BOOL CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, FX_BOOL isContent) { if (isContent) { - for (int32_t i = 0; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR); i++) { + for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { return TRUE; } } - for (int32_t j = 0; j < sizeof(START_END_CHARS) / sizeof(FX_CHAR); j++) { + for (size_t j = 0; j < FX_ArraySize(START_END_CHARS); ++j) { if (ch == (FX_WCHAR)START_END_CHARS[j]) { return TRUE; } } return FALSE; } else { - for (int32_t i = 0; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR); i++) { + for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { return TRUE; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index 8bd4fe1ba4..89fed29ffa 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -124,30 +124,27 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( } return sb; } + void CBC_PDF417HighLevelEncoder::Inverse() { - uint8_t i = 0; - int32_t l = 0; - for (l = 0; l < sizeof(MIXED) / sizeof(MIXED[0]); l++) { + for (size_t l = 0; l < FX_ArraySize(MIXED); ++l) MIXED[l] = -1; - } - for (i = 0; i < sizeof(TEXT_MIXED_RAW) / sizeof(TEXT_MIXED_RAW[0]); i++) { + + for (uint8_t i = 0; i < FX_ArraySize(TEXT_MIXED_RAW); ++i) { uint8_t b = TEXT_MIXED_RAW[i]; - if (b > 0) { + if (b != 0) MIXED[b] = i; - } } - for (l = 0; l < sizeof(PUNCTUATION) / sizeof(PUNCTUATION[0]); l++) { + + for (size_t l = 0; l < FX_ArraySize(PUNCTUATION); ++l) PUNCTUATION[l] = -1; - } - for (i = 0; - i < sizeof(TEXT_PUNCTUATION_RAW) / sizeof(TEXT_PUNCTUATION_RAW[0]); - i++) { + + for (uint8_t i = 0; i < FX_ArraySize(TEXT_PUNCTUATION_RAW); ++i) { uint8_t b = TEXT_PUNCTUATION_RAW[i]; - if (b > 0) { + if (b != 0) PUNCTUATION[b] = i; - } } } + int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, int32_t startpos, int32_t count, diff --git a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp index f1aa18848d..851f9d6102 100644 --- a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp +++ b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp @@ -71,13 +71,12 @@ static const FX_WCHAR* g_FWLTheme_CalFonts[] = { }; FWL_ERR CXFA_FWLTheme::Initialize() { m_pTextOut = IFDE_TextOut::Create(); - for (int32_t i = 0; NULL == m_pCalendarFont && - i < sizeof(g_FWLTheme_CalFonts) / sizeof(const FX_WCHAR*); - i++) { + for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts); + ++i) { m_pCalendarFont = IFX_Font::LoadFont(g_FWLTheme_CalFonts[i], 0, 0, m_pApp->GetFDEFontMgr()); } - if (NULL == m_pCalendarFont) + if (!m_pCalendarFont) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetDefFontByCodePage( FX_CODEPAGE_MSWin_WesternEuropean, 0, NULL); @@ -85,6 +84,8 @@ FWL_ERR CXFA_FWLTheme::Initialize() { m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage( FX_CODEPAGE_MSWin_WesternEuropean, 0, NULL); #endif + } + FXSYS_assert(NULL != m_pCalendarFont); FWLTHEME_Init(); return FWL_ERR_Succeeded; -- cgit v1.2.3