diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:17:51 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:17:51 +0100 |
commit | 5a3bb76cd384fa3760fe8481ce008791258595ad (patch) | |
tree | 8544fecc06b73cb43000143339c06ad880b56db4 /sal/textenc | |
parent | acd1696a066b8fa6fb94a0613939565799413769 (diff) |
More loplugin:cstylecast: sal
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I7d89b011464ba5d2dd12e04d5fc9f65cb4daebde
Diffstat (limited to 'sal/textenc')
-rw-r--r-- | sal/textenc/convertbig5hkscs.cxx | 12 | ||||
-rw-r--r-- | sal/textenc/converter.cxx | 4 | ||||
-rw-r--r-- | sal/textenc/converteuctw.cxx | 13 | ||||
-rw-r--r-- | sal/textenc/convertgb18030.cxx | 13 | ||||
-rw-r--r-- | sal/textenc/convertiso2022cn.cxx | 15 | ||||
-rw-r--r-- | sal/textenc/convertiso2022jp.cxx | 8 | ||||
-rw-r--r-- | sal/textenc/convertiso2022kr.cxx | 6 | ||||
-rw-r--r-- | sal/textenc/convertsimple.cxx | 2 | ||||
-rw-r--r-- | sal/textenc/handleundefinedunicodetotextchar.cxx | 2 | ||||
-rw-r--r-- | sal/textenc/tcvtbyte.cxx | 8 | ||||
-rw-r--r-- | sal/textenc/tcvtmb.cxx | 25 | ||||
-rw-r--r-- | sal/textenc/tcvtutf7.cxx | 10 | ||||
-rw-r--r-- | sal/textenc/tcvtutf8.cxx | 8 | ||||
-rw-r--r-- | sal/textenc/textcvt.cxx | 4 |
14 files changed, 63 insertions, 67 deletions
diff --git a/sal/textenc/convertbig5hkscs.cxx b/sal/textenc/convertbig5hkscs.cxx index eec82b2c495c..3d66bdfcc432 100644 --- a/sal/textenc/convertbig5hkscs.cxx +++ b/sal/textenc/convertbig5hkscs.cxx @@ -93,7 +93,7 @@ sal_Size ImplConvertBig5HkscsToUnicode(void const * pData, if (nRow == 0) if (nChar < 0x80) if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nChar; + *pDestBufPtr++ = static_cast<sal_Unicode>(nChar); else goto no_output; else if (nChar >= 0x81 && nChar <= 0xFE) @@ -198,16 +198,16 @@ sal_Size ImplConvertBig5HkscsToUnicode(void const * pData, { nOffset += nLast - nFirst + 1; nFirst = pBig5Hkscs2001Data[nOffset++]; - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); *pDestBufPtr++ - = (sal_Unicode) pBig5Hkscs2001Data[ - nOffset + (nChar - nFirst)]; + = static_cast<sal_Unicode>(pBig5Hkscs2001Data[ + nOffset + (nChar - nFirst)]); } else goto no_output; else if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); else goto no_output; nRow = 0; @@ -316,7 +316,7 @@ sal_Size ImplConvertUnicodeToBig5Hkscs(void const * pData, { if (ImplIsHighSurrogate(nChar)) { - nHighSurrogate = (sal_Unicode) nChar; + nHighSurrogate = static_cast<sal_Unicode>(nChar); continue; } } diff --git a/sal/textenc/converter.cxx b/sal/textenc/converter.cxx index 8d23f3081522..92eca3fc190a 100644 --- a/sal/textenc/converter.cxx +++ b/sal/textenc/converter.cxx @@ -58,7 +58,7 @@ sal::detail::textenc::handleBadInputTextToUnicodeConversion( if (*pDestBufPtr != pDestBufEnd) { *(*pDestBufPtr)++ = RTL_TEXTCVT_BYTE_PRIVATE_START - | ((unsigned char) cByte); + | static_cast<unsigned char>(cByte); return BAD_INPUT_CONTINUE; } else @@ -141,7 +141,7 @@ sal::detail::textenc::handleBadInputUnicodeToTextConversion( cReplace = '_'; break; } - if ((sal_Size) (pDestBufEnd - *pDestBufPtr) > nPrefixLen) + if (static_cast<sal_Size>(pDestBufEnd - *pDestBufPtr) > nPrefixLen) { while (nPrefixLen-- > 0) *(*pDestBufPtr)++ = *pPrefix++; diff --git a/sal/textenc/converteuctw.cxx b/sal/textenc/converteuctw.cxx index 14be7000cc88..87becd9b11ec 100644 --- a/sal/textenc/converteuctw.cxx +++ b/sal/textenc/converteuctw.cxx @@ -110,7 +110,7 @@ sal_Size ImplConvertEucTwToUnicode(void const * pData, case IMPL_EUC_TW_TO_UNICODE_STATE_0: if (nChar < 0x80) if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nChar; + *pDestBufPtr++ = static_cast<sal_Unicode>(nChar); else goto no_output; else if (nChar >= 0xA1 && nChar <= 0xFE) @@ -206,17 +206,16 @@ sal_Size ImplConvertEucTwToUnicode(void const * pData, { nOffset += nLast - nFirst + 1; nFirst = pCns116431992Data[nOffset++]; - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); *pDestBufPtr++ - = (sal_Unicode) - pCns116431992Data[ - nOffset + (nChar - nFirst)]; + = static_cast<sal_Unicode>(pCns116431992Data[ + nOffset + (nChar - nFirst)]); } else goto no_output; else if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); else goto no_output; } @@ -326,7 +325,7 @@ sal_Size ImplConvertUnicodeToEucTw(void const * pData, { if (ImplIsHighSurrogate(nChar)) { - nHighSurrogate = (sal_Unicode) nChar; + nHighSurrogate = static_cast<sal_Unicode>(nChar); continue; } } diff --git a/sal/textenc/convertgb18030.cxx b/sal/textenc/convertgb18030.cxx index 28ddd9335bb8..87e814674bb7 100644 --- a/sal/textenc/convertgb18030.cxx +++ b/sal/textenc/convertgb18030.cxx @@ -102,7 +102,7 @@ sal_Size ImplConvertGb18030ToUnicode(void const * pData, case IMPL_GB_18030_TO_UNICODE_STATE_0: if (nChar < 0x80) if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nChar; + *pDestBufPtr++ = static_cast<sal_Unicode>(nChar); else goto no_output; else if (nChar == 0x80) @@ -167,9 +167,9 @@ sal_Size ImplConvertGb18030ToUnicode(void const * pData, { nCode -= 189000 - 0x10000; *pDestBufPtr++ - = (sal_Unicode) ImplGetHighSurrogate(nCode); + = static_cast<sal_Unicode>(ImplGetHighSurrogate(nCode)); *pDestBufPtr++ - = (sal_Unicode) ImplGetLowSurrogate(nCode); + = static_cast<sal_Unicode>(ImplGetLowSurrogate(nCode)); } else goto no_output; @@ -197,8 +197,7 @@ sal_Size ImplConvertGb18030ToUnicode(void const * pData, { if (pDestBufPtr != pDestBufEnd) *pDestBufPtr++ - = (sal_Unicode) - (pRange->m_nFirstUnicode + = static_cast<sal_Unicode>(pRange->m_nFirstUnicode + (nCode - pRange-> m_nFirstLinear)); @@ -314,7 +313,7 @@ sal_Size ImplConvertUnicodeToGb18030(void const * pData, { if (ImplIsHighSurrogate(nChar)) { - nHighSurrogate = (sal_Unicode) nChar; + nHighSurrogate = static_cast<sal_Unicode>(nChar); continue; } } @@ -381,7 +380,7 @@ sal_Size ImplConvertUnicodeToGb18030(void const * pData, break; } nFirstNonRange - = (sal_Unicode) ((pRange++)->m_nLastUnicode + 1); + = static_cast<sal_Unicode>((pRange++)->m_nLastUnicode + 1); } } else diff --git a/sal/textenc/convertiso2022cn.cxx b/sal/textenc/convertiso2022cn.cxx index 5d534fc2fa84..e931d68f1f35 100644 --- a/sal/textenc/convertiso2022cn.cxx +++ b/sal/textenc/convertiso2022cn.cxx @@ -150,7 +150,7 @@ sal_Size ImplConvertIso2022CnToUnicode(void const * pData, eState = IMPL_ISO_2022_CN_TO_UNICODE_STATE_ESC; else if (nChar < 0x80) if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nChar; + *pDestBufPtr++ = static_cast<sal_Unicode>(nChar); else goto no_output; else @@ -201,7 +201,7 @@ sal_Size ImplConvertIso2022CnToUnicode(void const * pData, if (nUnicode != 0) if (pDestBufPtr != pDestBufEnd) { - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); eState = IMPL_ISO_2022_CN_TO_UNICODE_STATE_SO; } else @@ -328,17 +328,16 @@ sal_Size ImplConvertIso2022CnToUnicode(void const * pData, { nOffset += nLast - nFirst + 1; nFirst = pCns116431992Data[nOffset++]; - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); *pDestBufPtr++ - = (sal_Unicode) - pCns116431992Data[ - nOffset + (nChar - nFirst)]; + = static_cast<sal_Unicode>(pCns116431992Data[ + nOffset + (nChar - nFirst)]); } else goto no_output; else if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); else goto no_output; } @@ -541,7 +540,7 @@ sal_Size ImplConvertUnicodeToIso2022Cn(void const * pData, { if (ImplIsHighSurrogate(nChar)) { - nHighSurrogate = (sal_Unicode) nChar; + nHighSurrogate = static_cast<sal_Unicode>(nChar); continue; } } diff --git a/sal/textenc/convertiso2022jp.cxx b/sal/textenc/convertiso2022jp.cxx index d455f7cfb896..f0eb5eb9a936 100644 --- a/sal/textenc/convertiso2022jp.cxx +++ b/sal/textenc/convertiso2022jp.cxx @@ -112,7 +112,7 @@ sal_Size ImplConvertIso2022JpToUnicode(void const * pData, eState = IMPL_ISO_2022_JP_TO_UNICODE_STATE_ESC; else if (nChar < 0x80) if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nChar; + *pDestBufPtr++ = static_cast<sal_Unicode>(nChar); else goto no_output; else @@ -138,7 +138,7 @@ sal_Size ImplConvertIso2022JpToUnicode(void const * pData, nChar = 0xAF; // MACRON break; } - *pDestBufPtr++ = (sal_Unicode) nChar; + *pDestBufPtr++ = static_cast<sal_Unicode>(nChar); } else goto no_output; @@ -176,7 +176,7 @@ sal_Size ImplConvertIso2022JpToUnicode(void const * pData, if (nUnicode != 0) if (pDestBufPtr != pDestBufEnd) { - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); eState = IMPL_ISO_2022_JP_TO_UNICODE_STATE_0208; } else @@ -360,7 +360,7 @@ sal_Size ImplConvertUnicodeToIso2022Jp(void const * pData, { if (ImplIsHighSurrogate(nChar)) { - nHighSurrogate = (sal_Unicode) nChar; + nHighSurrogate = static_cast<sal_Unicode>(nChar); continue; } } diff --git a/sal/textenc/convertiso2022kr.cxx b/sal/textenc/convertiso2022kr.cxx index 4daef323b40e..c65bc8597414 100644 --- a/sal/textenc/convertiso2022kr.cxx +++ b/sal/textenc/convertiso2022kr.cxx @@ -120,7 +120,7 @@ sal_Size ImplConvertIso2022KrToUnicode(void const * pData, eState = IMPL_ISO_2022_KR_TO_UNICODE_STATE_ESC; else if (nChar < 0x80) if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nChar; + *pDestBufPtr++ = static_cast<sal_Unicode>(nChar); else goto no_output; else @@ -157,7 +157,7 @@ sal_Size ImplConvertIso2022KrToUnicode(void const * pData, if (nUnicode != 0) if (pDestBufPtr != pDestBufEnd) { - *pDestBufPtr++ = (sal_Unicode) nUnicode; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUnicode); eState = IMPL_ISO_2022_KR_TO_UNICODE_STATE_1001; } else @@ -339,7 +339,7 @@ sal_Size ImplConvertUnicodeToIso2022Kr(void const * pData, { if (ImplIsHighSurrogate(nChar)) { - nHighSurrogate = (sal_Unicode) nChar; + nHighSurrogate = static_cast<sal_Unicode>(nChar); continue; } } diff --git a/sal/textenc/convertsimple.cxx b/sal/textenc/convertsimple.cxx index d4d23c82e6af..e621cdda504a 100644 --- a/sal/textenc/convertsimple.cxx +++ b/sal/textenc/convertsimple.cxx @@ -524,7 +524,7 @@ sal_Size sal::detail::textenc::convertCharToUnicode( pEndSrcBuf = pSrcBuf+nSrcBytes; while ( pSrcBuf < pEndSrcBuf ) { - unsigned char c = (unsigned char)*pSrcBuf; + unsigned char c = static_cast<unsigned char>(*pSrcBuf); if ( c < 0x80 ) cConv = c; else diff --git a/sal/textenc/handleundefinedunicodetotextchar.cxx b/sal/textenc/handleundefinedunicodetotextchar.cxx index 007e342b485e..320562495e97 100644 --- a/sal/textenc/handleundefinedunicodetotextchar.cxx +++ b/sal/textenc/handleundefinedunicodetotextchar.cxx @@ -90,7 +90,7 @@ bool sal::detail::textenc::handleUndefinedUnicodeToTextChar( { if ( nFlags & RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 ) { - **ppDestBuf = (char)(unsigned char)(c-RTL_TEXTCVT_BYTE_PRIVATE_START); + **ppDestBuf = static_cast<char>(static_cast<unsigned char>(c-RTL_TEXTCVT_BYTE_PRIVATE_START)); (*ppDestBuf)++; (*ppSrcBuf)++; return true; diff --git a/sal/textenc/tcvtbyte.cxx b/sal/textenc/tcvtbyte.cxx index aa6664a40494..ee727d9f910f 100644 --- a/sal/textenc/tcvtbyte.cxx +++ b/sal/textenc/tcvtbyte.cxx @@ -47,11 +47,11 @@ sal_Size ImplSymbolToUnicode( SAL_UNUSED_PARAMETER const void*, } /* 0-31 (all Control-Character get the same Unicode value) */ - unsigned char c = (unsigned char)*pSrcBuf; + unsigned char c = static_cast<unsigned char>(*pSrcBuf); if ( c <= 0x1F ) - *pDestBuf = (sal_Unicode)c; + *pDestBuf = static_cast<sal_Unicode>(c); else - *pDestBuf = ((sal_Unicode)c)+0xF000; + *pDestBuf = static_cast<sal_Unicode>(c)+0xF000; pDestBuf++; pSrcBuf++; } @@ -142,7 +142,7 @@ sal_Size ImplUpperCharToUnicode( const void* pData, } while ( pSrcBuf < pEndSrcBuf ) { - unsigned char c = (unsigned char)*pSrcBuf; + unsigned char c = static_cast<unsigned char>(*pSrcBuf); if (c < 0x80) cConv = c; else diff --git a/sal/textenc/tcvtmb.cxx b/sal/textenc/tcvtmb.cxx index efdf01ea4e90..b5b6903a1d40 100644 --- a/sal/textenc/tcvtmb.cxx +++ b/sal/textenc/tcvtmb.cxx @@ -49,7 +49,7 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*, pEndSrcBuf = pSrcBuf+nSrcBytes; while ( pSrcBuf < pEndSrcBuf ) { - unsigned char cLead = (unsigned char)*pSrcBuf; + unsigned char cLead = static_cast<unsigned char>(*pSrcBuf); /* get entry for the lead byte */ pLeadEntry = pLeadTab+cLead; @@ -91,7 +91,7 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*, else { pSrcBuf++; - cTrail = (unsigned char)*pSrcBuf; + cTrail = static_cast<unsigned char>(*pSrcBuf); if ( (cTrail >= pLeadEntry->mnTrailStart) && (cTrail <= pLeadEntry->mnTrailEnd) ) cConv = pLeadEntry->mpToUniTrailTab[cTrail-pLeadEntry->mnTrailStart]; else @@ -229,8 +229,8 @@ sal_Size ImplUnicodeToDBCS( const void* pData, SAL_UNUSED_PARAMETER void*, while ( pSrcBuf < pEndSrcBuf ) { c = *pSrcBuf; - unsigned char nHighChar = (unsigned char)((c >> 8) & 0xFF); - unsigned char nLowChar = (unsigned char)(c & 0xFF); + unsigned char nHighChar = static_cast<unsigned char>((c >> 8) & 0xFF); + unsigned char nLowChar = static_cast<unsigned char>(c & 0xFF); /* get entry for the high byte */ pHighEntry = pHighTab+nHighChar; @@ -264,8 +264,7 @@ sal_Size ImplUnicodeToDBCS( const void* pData, SAL_UNUSED_PARAMETER void*, sal_uInt32 nTrailOff = nIndex % pEUDCTab->mnTrailRangeCount; sal_uInt32 nSize; - cConv = (sal_uInt16) - ((pEUDCTab->mnLeadStart + nLeadOff) << 8); + cConv = static_cast<sal_uInt16>((pEUDCTab->mnLeadStart + nLeadOff) << 8); nSize = pEUDCTab->mnTrail1End - pEUDCTab->mnTrail1Start + 1; if (nTrailOff < nSize) @@ -379,7 +378,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData, pEndSrcBuf = pSrcBuf+nSrcBytes; while ( pSrcBuf < pEndSrcBuf ) { - unsigned char c = (unsigned char)*pSrcBuf; + unsigned char c = static_cast<unsigned char>(*pSrcBuf); /* ASCII */ if ( c <= 0x7F ) @@ -398,7 +397,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData, } pSrcBuf++; - c = (unsigned char)*pSrcBuf; + c = static_cast<unsigned char>(*pSrcBuf); if ( (c >= 0xA1) && (c <= 0xDF) ) cConv = 0xFF61+(c-0xA1); else @@ -422,9 +421,9 @@ sal_Size ImplEUCJPToUnicode( const void* pData, } pSrcBuf++; - cLead = (unsigned char)*pSrcBuf; + cLead = static_cast<unsigned char>(*pSrcBuf); pSrcBuf++; - cTrail = (unsigned char)*pSrcBuf; + cTrail = static_cast<unsigned char>(*pSrcBuf); pLeadTab = pConvertData->mpJIS0212ToUniLeadTab; } /* CodeSet 2 JIS 0208-1997 */ @@ -440,7 +439,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData, cLead = c; pSrcBuf++; - cTrail = (unsigned char)*pSrcBuf; + cTrail = static_cast<unsigned char>(*pSrcBuf); pLeadTab = pConvertData->mpJIS0208ToUniLeadTab; } @@ -547,8 +546,8 @@ sal_Size ImplUnicodeToEUCJP( const void* pData, cConv = 0x8E00+0xA1+(c-0xFF61); else { - nHighChar = (unsigned char)((c >> 8) & 0xFF); - nLowChar = (unsigned char)(c & 0xFF); + nHighChar = static_cast<unsigned char>((c >> 8) & 0xFF); + nLowChar = static_cast<unsigned char>(c & 0xFF); /* JIS 0208 */ pHighTab = pConvertData->mpUniToJIS0208HighTab; diff --git a/sal/textenc/tcvtutf7.cxx b/sal/textenc/tcvtutf7.cxx index 2b18d4370b3a..6c0625d0016e 100644 --- a/sal/textenc/tcvtutf7.cxx +++ b/sal/textenc/tcvtutf7.cxx @@ -180,7 +180,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext, { if ( pSrcBuf < pEndSrcBuf ) { - c = (unsigned char)*pSrcBuf; + c = static_cast<unsigned char>(*pSrcBuf); /* End, when not a base64 character */ bBase64End = false; @@ -235,7 +235,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext, /* Skip character */ pSrcBuf++; if ( pSrcBuf < pEndSrcBuf ) - c = (unsigned char)*pSrcBuf; + c = static_cast<unsigned char>(*pSrcBuf); else bEnd = true; } @@ -266,7 +266,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext, { /* Add 6 Bits from character to the bit buffer */ nBufferBits += 6; - nBitBuffer |= ((sal_uInt32)(nBase64Value & 0x3F)) << (32-nBufferBits); + nBitBuffer |= static_cast<sal_uInt32>(nBase64Value & 0x3F) << (32-nBufferBits); bFirst = false; } @@ -275,7 +275,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext, while ( (pDestBuf < pEndDestBuf) && (nBufferBits >= 16) ) { nBitBufferTemp = nBitBuffer >> (32-16); - *pDestBuf = (sal_Unicode)(nBitBufferTemp & 0xFFFF); + *pDestBuf = static_cast<sal_Unicode>(nBitBufferTemp & 0xFFFF); pDestBuf++; nBitBuffer <<= 16; nBufferBits -= 16; @@ -506,7 +506,7 @@ sal_Size ImplUnicodeToUTF7( SAL_UNUSED_PARAMETER const void*, void* pContext, if ( bNeedShift ) { nBufferBits += 16; - nBitBuffer |= ((sal_uInt32)c) << (32-nBufferBits); + nBitBuffer |= static_cast<sal_uInt32>(c) << (32-nBufferBits); } else nBufferBits += (6-(nBufferBits%6))%6; diff --git a/sal/textenc/tcvtutf8.cxx b/sal/textenc/tcvtutf8.cxx index 0f0ac6fbbdf1..72b336b9ded4 100644 --- a/sal/textenc/tcvtutf8.cxx +++ b/sal/textenc/tcvtutf8.cxx @@ -187,13 +187,13 @@ sal_Size ImplConvertUtf8ToUnicode( } if (nUtf32 <= 0xFFFF) if (pDestBufPtr != pDestBufEnd) - *pDestBufPtr++ = (sal_Unicode) nUtf32; + *pDestBufPtr++ = static_cast<sal_Unicode>(nUtf32); else goto no_output; else if (pDestBufEnd - pDestBufPtr >= 2) { - *pDestBufPtr++ = (sal_Unicode) ImplGetHighSurrogate(nUtf32); - *pDestBufPtr++ = (sal_Unicode) ImplGetLowSurrogate(nUtf32); + *pDestBufPtr++ = static_cast<sal_Unicode>(ImplGetHighSurrogate(nUtf32)); + *pDestBufPtr++ = static_cast<sal_Unicode>(ImplGetLowSurrogate(nUtf32)); } else goto no_output; @@ -333,7 +333,7 @@ sal_Size ImplConvertUnicodeToUtf8( { if (ImplIsHighSurrogate(nChar) && !bJavaUtf8) { - nHighSurrogate = (sal_Unicode) nChar; + nHighSurrogate = static_cast<sal_Unicode>(nChar); continue; } } diff --git a/sal/textenc/textcvt.cxx b/sal/textenc/textcvt.cxx index 76f0f826f89b..2d5add0a89e4 100644 --- a/sal/textenc/textcvt.cxx +++ b/sal/textenc/textcvt.cxx @@ -57,7 +57,7 @@ static sal_Size ImplDummyToUnicode( const char* pSrcBuf, sal_Size nSrcBytes, break; } - *pDestBuf = (sal_Unicode)(unsigned char)*pSrcBuf; + *pDestBuf = static_cast<sal_Unicode>(static_cast<unsigned char>(*pSrcBuf)); pDestBuf++; pSrcBuf++; } @@ -94,7 +94,7 @@ static sal_Size ImplUnicodeToDummy( const sal_Unicode* pSrcBuf, sal_Size nSrcCha break; } - *pDestBuf = (char)(unsigned char)(*pSrcBuf & 0x00FF); + *pDestBuf = static_cast<char>(static_cast<unsigned char>(*pSrcBuf & 0x00FF)); pDestBuf++; pSrcBuf++; } |