From 7558414b8aa1d14ce02e360dd88e4f421cee8725 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Fri, 1 Sep 2017 13:30:19 -0400 Subject: Prepare for converting FX_STRSIZE int->size_t When turning on this conversion a number of typing issues and other nits where found in the code base that can be merged in without actually changing the underlying type. Landing these changes before the type change CL, since there is a high likelihood that the type change will need to be rolled back, since it is high risk. BUG=pdfium:828 Change-Id: I587443d9090055963446485a1aacb8772eb5ca64 Reviewed-on: https://pdfium-review.googlesource.com/12810 Commit-Queue: Ryan Harrison Reviewed-by: Tom Sepez Reviewed-by: Henrique Nakashima --- core/fpdfapi/font/cpdf_cmap.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'core/fpdfapi/font/cpdf_cmap.cpp') diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp index 9e8c48bb27..659139f687 100644 --- a/core/fpdfapi/font/cpdf_cmap.cpp +++ b/core/fpdfapi/font/cpdf_cmap.cpp @@ -434,46 +434,46 @@ int CPDF_CMap::CountChar(const char* pString, int size) const { int CPDF_CMap::AppendChar(char* str, uint32_t charcode) const { switch (m_CodingScheme) { case OneByte: - str[0] = (uint8_t)charcode; + str[0] = static_cast(charcode); return 1; case TwoBytes: - str[0] = (uint8_t)(charcode / 256); - str[1] = (uint8_t)(charcode % 256); + str[0] = static_cast(charcode / 256); + str[1] = static_cast(charcode % 256); return 2; case MixedTwoBytes: - if (charcode < 0x100 && !m_MixedTwoByteLeadingBytes[(uint8_t)charcode]) { - str[0] = (uint8_t)charcode; + if (charcode < 0x100 && !m_MixedTwoByteLeadingBytes[charcode]) { + str[0] = static_cast(charcode); return 1; } - str[0] = (uint8_t)(charcode >> 8); - str[1] = (uint8_t)charcode; + str[0] = static_cast(charcode >> 8); + str[1] = static_cast(charcode); return 2; case MixedFourBytes: if (charcode < 0x100) { - int iSize = - GetFourByteCharSizeImpl(charcode, m_MixedFourByteLeadingRanges); + int iSize = static_cast( + GetFourByteCharSizeImpl(charcode, m_MixedFourByteLeadingRanges)); if (iSize == 0) iSize = 1; - str[iSize - 1] = (uint8_t)charcode; + str[iSize - 1] = static_cast(charcode); if (iSize > 1) memset(str, 0, iSize - 1); return iSize; } if (charcode < 0x10000) { - str[0] = (uint8_t)(charcode >> 8); - str[1] = (uint8_t)charcode; + str[0] = static_cast(charcode >> 8); + str[1] = static_cast(charcode); return 2; } if (charcode < 0x1000000) { - str[0] = (uint8_t)(charcode >> 16); - str[1] = (uint8_t)(charcode >> 8); - str[2] = (uint8_t)charcode; + str[0] = static_cast(charcode >> 16); + str[1] = static_cast(charcode >> 8); + str[2] = static_cast(charcode); return 3; } - str[0] = (uint8_t)(charcode >> 24); - str[1] = (uint8_t)(charcode >> 16); - str[2] = (uint8_t)(charcode >> 8); - str[3] = (uint8_t)charcode; + str[0] = static_cast(charcode >> 24); + str[1] = static_cast(charcode >> 16); + str[2] = static_cast(charcode >> 8); + str[3] = static_cast(charcode); return 4; } return 0; -- cgit v1.2.3