diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-01-06 12:09:01 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-01-06 15:00:44 +0100 |
commit | 353bed10cf7d41881654b82b0a833da8dff36a69 (patch) | |
tree | 0d1a287f9bb243fa7f2d155d125ef65beaeca67b /sal/textenc | |
parent | 5689b61ac9eac4d4be2d6aa378b732a5eae4784a (diff) |
Made textenc/converter cleanly usable by both sal and sal_textenc.
Diffstat (limited to 'sal/textenc')
-rw-r--r-- | sal/textenc/convertbig5hkscs.cxx | 52 | ||||
-rw-r--r-- | sal/textenc/converter.cxx | 38 | ||||
-rw-r--r-- | sal/textenc/converter.hxx | 34 | ||||
-rw-r--r-- | sal/textenc/converteuctw.cxx | 52 | ||||
-rw-r--r-- | sal/textenc/convertgb18030.cxx | 52 | ||||
-rw-r--r-- | sal/textenc/convertiso2022cn.cxx | 53 | ||||
-rw-r--r-- | sal/textenc/convertiso2022jp.cxx | 54 | ||||
-rw-r--r-- | sal/textenc/convertiso2022kr.cxx | 54 | ||||
-rw-r--r-- | sal/textenc/convertsimple.hxx | 4 | ||||
-rw-r--r-- | sal/textenc/convertsinglebytetobmpunicode.cxx | 24 | ||||
-rw-r--r-- | sal/textenc/tcvtutf8.cxx | 43 |
11 files changed, 191 insertions, 269 deletions
diff --git a/sal/textenc/convertbig5hkscs.cxx b/sal/textenc/convertbig5hkscs.cxx index f1e1275b6690..22bf31091cde 100644 --- a/sal/textenc/convertbig5hkscs.cxx +++ b/sal/textenc/convertbig5hkscs.cxx @@ -229,19 +229,19 @@ sal_Size ImplConvertBig5HkscsToUnicode(void const * pData, continue; bad_input: - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( bUndefined, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nRow = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nRow = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -260,16 +260,16 @@ sal_Size ImplConvertBig5HkscsToUnicode(void const * pData, if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nRow = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; break; } @@ -434,25 +434,19 @@ sal_Size ImplConvertUnicodeToBig5Hkscs(void const * pData, continue; bad_input: - switch (ImplHandleBadInputUnicodeToTextConversion(bUndefined, - nChar, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - NULL, - 0, - NULL)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + bUndefined, nChar, nFlags, &pDestBufPtr, pDestBufEnd, + &nInfo, NULL, 0, NULL)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nHighSurrogate = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -471,22 +465,16 @@ sal_Size ImplConvertUnicodeToBig5Hkscs(void const * pData, if ((nFlags & RTL_UNICODETOTEXT_FLAGS_FLUSH) != 0) nInfo |= RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputUnicodeToTextConversion(false, - 0, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - NULL, - 0, - NULL)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + false, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo, + NULL, 0, NULL)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL; break; } diff --git a/sal/textenc/converter.cxx b/sal/textenc/converter.cxx index cde368c133ae..24ebf486b7ef 100644 --- a/sal/textenc/converter.cxx +++ b/sal/textenc/converter.cxx @@ -35,7 +35,8 @@ #include "tenchelp.hxx" #include "unichars.hxx" -ImplBadInputConversionAction ImplHandleBadInputTextToUnicodeConversion( +sal::detail::textenc::BadInputConversionAction +sal::detail::textenc::handleBadInputTextToUnicodeConversion( bool bUndefined, bool bMultiByte, char cByte, sal_uInt32 nFlags, sal_Unicode ** pDestBufPtr, sal_Unicode * pDestBufEnd, sal_uInt32 * pInfo) { @@ -55,22 +56,22 @@ ImplBadInputConversionAction ImplHandleBadInputTextToUnicodeConversion( case RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR: case RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR: *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR; - return IMPL_BAD_INPUT_STOP; + return BAD_INPUT_STOP; case RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE: case RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE: case RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE: - return IMPL_BAD_INPUT_CONTINUE; + return BAD_INPUT_CONTINUE; case RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE: if (*pDestBufPtr != pDestBufEnd) { *(*pDestBufPtr)++ = RTL_TEXTCVT_BYTE_PRIVATE_START | ((sal_uChar) cByte); - return IMPL_BAD_INPUT_CONTINUE; + return BAD_INPUT_CONTINUE; } else - return IMPL_BAD_INPUT_NO_OUTPUT; + return BAD_INPUT_NO_OUTPUT; default: // RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT, // RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT, @@ -78,23 +79,18 @@ ImplBadInputConversionAction ImplHandleBadInputTextToUnicodeConversion( if (*pDestBufPtr != pDestBufEnd) { *(*pDestBufPtr)++ = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER; - return IMPL_BAD_INPUT_CONTINUE; + return BAD_INPUT_CONTINUE; } else - return IMPL_BAD_INPUT_NO_OUTPUT; + return BAD_INPUT_NO_OUTPUT; } } -ImplBadInputConversionAction -ImplHandleBadInputUnicodeToTextConversion(bool bUndefined, - sal_uInt32 nUtf32, - sal_uInt32 nFlags, - char ** pDestBufPtr, - char * pDestBufEnd, - sal_uInt32 * pInfo, - char const * pPrefix, - sal_Size nPrefixLen, - bool * pPrefixWritten) +sal::detail::textenc::BadInputConversionAction +sal::detail::textenc::handleBadInputUnicodeToTextConversion( + bool bUndefined, sal_uInt32 nUtf32, sal_uInt32 nFlags, char ** pDestBufPtr, + char * pDestBufEnd, sal_uInt32 * pInfo, char const * pPrefix, + sal_Size nPrefixLen, bool * pPrefixWritten) { // TODO! RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE // RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR @@ -129,13 +125,13 @@ ImplHandleBadInputUnicodeToTextConversion(bool bUndefined, case RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR: case RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR: *pInfo |= RTL_UNICODETOTEXT_INFO_ERROR; - return IMPL_BAD_INPUT_STOP; + return BAD_INPUT_STOP; case RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE: case RTL_UNICODETOTEXT_FLAGS_INVALID_IGNORE: if (pPrefixWritten) *pPrefixWritten = false; - return IMPL_BAD_INPUT_CONTINUE; + return BAD_INPUT_CONTINUE; case RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0: case RTL_UNICODETOTEXT_FLAGS_INVALID_0: @@ -161,10 +157,10 @@ ImplHandleBadInputUnicodeToTextConversion(bool bUndefined, *(*pDestBufPtr)++ = cReplace; if (pPrefixWritten) *pPrefixWritten = true; - return IMPL_BAD_INPUT_CONTINUE; + return BAD_INPUT_CONTINUE; } else - return IMPL_BAD_INPUT_NO_OUTPUT; + return BAD_INPUT_NO_OUTPUT; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/textenc/converter.hxx b/sal/textenc/converter.hxx index 50338c2efaa5..fc69ee24110b 100644 --- a/sal/textenc/converter.hxx +++ b/sal/textenc/converter.hxx @@ -31,30 +31,32 @@ #include "sal/config.h" +#include "sal/saldllapi.h" #include "sal/types.h" -enum ImplBadInputConversionAction +// Internal, non-stable ABI + +namespace sal { namespace detail { namespace textenc { + +enum BadInputConversionAction { - IMPL_BAD_INPUT_STOP, - IMPL_BAD_INPUT_CONTINUE, - IMPL_BAD_INPUT_NO_OUTPUT + BAD_INPUT_STOP, + BAD_INPUT_CONTINUE, + BAD_INPUT_NO_OUTPUT }; -ImplBadInputConversionAction -ImplHandleBadInputTextToUnicodeConversion( +BadInputConversionAction SAL_DLLPUBLIC +handleBadInputTextToUnicodeConversion( bool bUndefined, bool bMultiByte, char cByte, sal_uInt32 nFlags, sal_Unicode ** pDestBufPtr, sal_Unicode * pDestBufEnd, sal_uInt32 * pInfo); -ImplBadInputConversionAction -ImplHandleBadInputUnicodeToTextConversion(bool bUndefined, - sal_uInt32 nUtf32, - sal_uInt32 nFlags, - char ** pDestBufPtr, - char * pDestBufEnd, - sal_uInt32 * pInfo, - char const * pPrefix, - sal_Size nPrefixLen, - bool * pPrefixWritten); +BadInputConversionAction SAL_DLLPUBLIC +handleBadInputUnicodeToTextConversion( + bool bUndefined, sal_uInt32 nUtf32, sal_uInt32 nFlags, char ** pDestBufPtr, + char * pDestBufEnd, sal_uInt32 * pInfo, char const * pPrefix, + sal_Size nPrefixLen, bool * pPrefixWritten); + +} } } #endif diff --git a/sal/textenc/converteuctw.cxx b/sal/textenc/converteuctw.cxx index 09e01d8704ed..0274fc3f1211 100644 --- a/sal/textenc/converteuctw.cxx +++ b/sal/textenc/converteuctw.cxx @@ -238,19 +238,19 @@ sal_Size ImplConvertEucTwToUnicode(void const * pData, } bad_input: - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( bUndefined, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: eState = IMPL_EUC_TW_TO_UNICODE_STATE_0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_EUC_TW_TO_UNICODE_STATE_0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -269,16 +269,16 @@ sal_Size ImplConvertEucTwToUnicode(void const * pData, if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_EUC_TW_TO_UNICODE_STATE_0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; break; } @@ -393,25 +393,19 @@ sal_Size ImplConvertUnicodeToEucTw(void const * pData, continue; bad_input: - switch (ImplHandleBadInputUnicodeToTextConversion(bUndefined, - nChar, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - NULL, - 0, - NULL)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + bUndefined, nChar, nFlags, &pDestBufPtr, pDestBufEnd, + &nInfo, NULL, 0, NULL)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nHighSurrogate = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -430,22 +424,16 @@ sal_Size ImplConvertUnicodeToEucTw(void const * pData, if ((nFlags & RTL_UNICODETOTEXT_FLAGS_FLUSH) != 0) nInfo |= RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputUnicodeToTextConversion(false, - 0, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - NULL, - 0, - NULL)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + false, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo, + NULL, 0, NULL)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL; break; } diff --git a/sal/textenc/convertgb18030.cxx b/sal/textenc/convertgb18030.cxx index c2bbdc9197c9..48d742fe4278 100644 --- a/sal/textenc/convertgb18030.cxx +++ b/sal/textenc/convertgb18030.cxx @@ -230,19 +230,19 @@ sal_Size ImplConvertGb18030ToUnicode(void const * pData, continue; bad_input: - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( bUndefined, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: eState = IMPL_GB_18030_TO_UNICODE_STATE_0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_GB_18030_TO_UNICODE_STATE_0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -261,16 +261,16 @@ sal_Size ImplConvertGb18030ToUnicode(void const * pData, if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_GB_18030_TO_UNICODE_STATE_0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; break; } @@ -408,25 +408,19 @@ sal_Size ImplConvertUnicodeToGb18030(void const * pData, continue; bad_input: - switch (ImplHandleBadInputUnicodeToTextConversion(bUndefined, - nChar, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - NULL, - 0, - NULL)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + bUndefined, nChar, nFlags, &pDestBufPtr, pDestBufEnd, + &nInfo, NULL, 0, NULL)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nHighSurrogate = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -445,22 +439,16 @@ sal_Size ImplConvertUnicodeToGb18030(void const * pData, if ((nFlags & RTL_UNICODETOTEXT_FLAGS_FLUSH) != 0) nInfo |= RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputUnicodeToTextConversion(false, - 0, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - NULL, - 0, - NULL)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + false, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo, + NULL, 0, NULL)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL; break; } diff --git a/sal/textenc/convertiso2022cn.cxx b/sal/textenc/convertiso2022cn.cxx index 98b9aa1721fb..8241c5b55198 100644 --- a/sal/textenc/convertiso2022cn.cxx +++ b/sal/textenc/convertiso2022cn.cxx @@ -362,21 +362,21 @@ sal_Size ImplConvertIso2022CnToUnicode(void const * pData, } bad_input: - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( bUndefined, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: eState = IMPL_ISO_2022_CN_TO_UNICODE_STATE_ASCII; b116431 = false; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_ISO_2022_CN_TO_UNICODE_STATE_ASCII; b116431 = false; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -395,17 +395,17 @@ sal_Size ImplConvertIso2022CnToUnicode(void const * pData, if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_ISO_2022_CN_TO_UNICODE_STATE_ASCII; b116431 = false; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; break; } @@ -777,27 +777,21 @@ sal_Size ImplConvertUnicodeToIso2022Cn(void const * pData, continue; bad_input: - switch (ImplHandleBadInputUnicodeToTextConversion(bUndefined, - nChar, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - "\x0F", // SI - bSo ? 1 : 0, - &bWritten)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + bUndefined, nChar, nFlags, &pDestBufPtr, pDestBufEnd, + &nInfo, "\x0F" /* SI */, bSo ? 1 : 0, &bWritten)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: if (bWritten) bSo = false; nHighSurrogate = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -818,29 +812,22 @@ sal_Size ImplConvertUnicodeToIso2022Cn(void const * pData, if ((nFlags & RTL_UNICODETOTEXT_FLAGS_FLUSH) != 0) nInfo |= RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputUnicodeToTextConversion( - false, - 0, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - "\x0F", // SI - bSo ? 1 : 0, - &bWritten)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + false, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo, + "\x0F" /* SI */, bSo ? 1 : 0, &bWritten)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; bFlush = false; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: if (bWritten) bSo = false; nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL; break; } diff --git a/sal/textenc/convertiso2022jp.cxx b/sal/textenc/convertiso2022jp.cxx index f40d6ada70ec..98ede65d0620 100644 --- a/sal/textenc/convertiso2022jp.cxx +++ b/sal/textenc/convertiso2022jp.cxx @@ -252,19 +252,19 @@ sal_Size ImplConvertIso2022JpToUnicode(void const * pData, continue; bad_input: - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( bUndefined, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: eState = IMPL_ISO_2022_JP_TO_UNICODE_STATE_ASCII; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_ISO_2022_JP_TO_UNICODE_STATE_ASCII; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -283,16 +283,16 @@ sal_Size ImplConvertIso2022JpToUnicode(void const * pData, if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_ISO_2022_JP_TO_UNICODE_STATE_ASCII; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; break; } @@ -485,28 +485,21 @@ sal_Size ImplConvertUnicodeToIso2022Jp(void const * pData, continue; bad_input: - switch (ImplHandleBadInputUnicodeToTextConversion( - bUndefined, - nChar, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - "\x1B(B", - b0208 ? 3 : 0, - &bWritten)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + bUndefined, nChar, nFlags, &pDestBufPtr, pDestBufEnd, + &nInfo, "\x1B(B", b0208 ? 3 : 0, &bWritten)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: if (bWritten) b0208 = false; nHighSurrogate = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -527,29 +520,22 @@ sal_Size ImplConvertUnicodeToIso2022Jp(void const * pData, if ((nFlags & RTL_UNICODETOTEXT_FLAGS_FLUSH) != 0) nInfo |= RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputUnicodeToTextConversion( - false, - 0, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - "\x1B(B", - b0208 ? 3 : 0, - &bWritten)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + false, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo, + "\x1B(B", b0208 ? 3 : 0, &bWritten)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; bFlush = false; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: if (bWritten) b0208 = false; nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL; break; } diff --git a/sal/textenc/convertiso2022kr.cxx b/sal/textenc/convertiso2022kr.cxx index 2e796645b1c1..d4e51ea26710 100644 --- a/sal/textenc/convertiso2022kr.cxx +++ b/sal/textenc/convertiso2022kr.cxx @@ -215,19 +215,19 @@ sal_Size ImplConvertIso2022KrToUnicode(void const * pData, continue; bad_input: - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( bUndefined, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: eState = IMPL_ISO_2022_KR_TO_UNICODE_STATE_ASCII; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_ISO_2022_KR_TO_UNICODE_STATE_ASCII; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -246,16 +246,16 @@ sal_Size ImplConvertIso2022KrToUnicode(void const * pData, if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: eState = IMPL_ISO_2022_KR_TO_UNICODE_STATE_ASCII; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; break; } @@ -443,28 +443,23 @@ sal_Size ImplConvertUnicodeToIso2022Kr(void const * pData, continue; bad_input: - switch (ImplHandleBadInputUnicodeToTextConversion( - bUndefined, - nChar, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - "\x0F", // SI + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + bUndefined, nChar, nFlags, &pDestBufPtr, pDestBufEnd, + &nInfo, "\x0F" /* SI */, eSet == IMPL_UNICODE_TO_ISO_2022_KR_SET_ASCII ? 0 : 1, &bWritten)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: if (bWritten) eSet = IMPL_UNICODE_TO_ISO_2022_KR_SET_ASCII; nHighSurrogate = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -485,30 +480,25 @@ sal_Size ImplConvertUnicodeToIso2022Kr(void const * pData, if ((nFlags & RTL_UNICODETOTEXT_FLAGS_FLUSH) != 0) nInfo |= RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputUnicodeToTextConversion( - false, - 0, - nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, - "\x0F", // SI - eSet == IMPL_UNICODE_TO_ISO_2022_KR_SET_ASCII ? - 0 : 1, + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + false, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo, + "\x0F" /* SI */, + (eSet == IMPL_UNICODE_TO_ISO_2022_KR_SET_ASCII + ? 0 : 1), &bWritten)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; bFlush = false; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: if (bWritten) eSet = IMPL_UNICODE_TO_ISO_2022_KR_SET_ASCII; nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL; break; } diff --git a/sal/textenc/convertsimple.hxx b/sal/textenc/convertsimple.hxx index 6fb1042fb445..3f207ea05e84 100644 --- a/sal/textenc/convertsimple.hxx +++ b/sal/textenc/convertsimple.hxx @@ -35,15 +35,15 @@ #include "sal/saldllapi.h" #include "sal/types.h" +// Internal, non-stable ABI + namespace sal { namespace detail { namespace textenc { -// internal, non-stable ABI sal_Size SAL_DLLPUBLIC convertCharToUnicode( void const * pData, void * pContext, char const * pSrcBuf, sal_Size nSrcBytes, sal_Unicode * pDestBuf, sal_Size nDestChars, sal_uInt32 nFlags, sal_uInt32 * pInfo, sal_Size * pSrcCvtBytes); -// internal, non-stable ABI sal_Size SAL_DLLPUBLIC convertUnicodeToChar( void const * pData, void * pContext, sal_Unicode const * pSrcBuf, sal_Size nSrcChars, char * pDestBuf, sal_Size nDestBytes, sal_uInt32 nFlags, diff --git a/sal/textenc/convertsinglebytetobmpunicode.cxx b/sal/textenc/convertsinglebytetobmpunicode.cxx index f94eed26d100..787dee0b7459 100644 --- a/sal/textenc/convertsinglebytetobmpunicode.cxx +++ b/sal/textenc/convertsinglebytetobmpunicode.cxx @@ -64,17 +64,17 @@ sal_Size rtl_textenc_convertSingleByteToBmpUnicode( *destBufPtr++ = c; continue; bad_input: - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( undefined, false, b, flags, &destBufPtr, destBufEnd, &infoFlags)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -152,19 +152,19 @@ sal_Size rtl_textenc_convertBmpUnicodeToSingleByte( highSurrogate = 0; continue; bad_input: - switch (ImplHandleBadInputUnicodeToTextConversion( + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( undefined, c, flags, &destBufPtr, destBufEnd, &infoFlags, 0, 0, 0)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: highSurrogate = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: highSurrogate = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -182,16 +182,16 @@ sal_Size rtl_textenc_convertBmpUnicodeToSingleByte( if ((flags & RTL_UNICODETOTEXT_FLAGS_FLUSH) != 0) { infoFlags |= RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL; } else { - switch (ImplHandleBadInputUnicodeToTextConversion( + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( false, 0, flags, &destBufPtr, destBufEnd, &infoFlags, 0, 0, 0)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: highSurrogate = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: infoFlags |= RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL; break; } diff --git a/sal/textenc/tcvtutf8.cxx b/sal/textenc/tcvtutf8.cxx index 1e41da2e398d..efa0e8dc0097 100644 --- a/sal/textenc/tcvtutf8.cxx +++ b/sal/textenc/tcvtutf8.cxx @@ -191,25 +191,25 @@ sal_Size ImplConvertUtf8ToUnicode( continue; bad_input: - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( bUndefined, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nShift = -1; bCheckBom = false; if (!bConsume) --pSrcBufPtr; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nShift = -1; bCheckBom = false; if (!bConsume) --pSrcBufPtr; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -228,17 +228,17 @@ sal_Size ImplConvertUtf8ToUnicode( if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputTextToUnicodeConversion( + switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nShift = -1; bCheckBom = false; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; break; } @@ -368,20 +368,19 @@ sal_Size ImplConvertUnicodeToUtf8( continue; bad_input: - switch (ImplHandleBadInputUnicodeToTextConversion(false, 0, nFlags, - &pDestBufPtr, - pDestBufEnd, &nInfo, - NULL, 0, NULL)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + false, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo, NULL, + 0, NULL)) { - case IMPL_BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_STOP: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nHighSurrogate = 0; continue; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: goto no_output; } break; @@ -400,18 +399,16 @@ sal_Size ImplConvertUnicodeToUtf8( if ((nFlags & RTL_UNICODETOTEXT_FLAGS_FLUSH) != 0) nInfo |= RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL; else - switch (ImplHandleBadInputUnicodeToTextConversion(false, 0, nFlags, - &pDestBufPtr, - pDestBufEnd, - &nInfo, NULL, 0, - NULL)) + switch (sal::detail::textenc::handleBadInputUnicodeToTextConversion( + false, 0, nFlags, &pDestBufPtr, pDestBufEnd, &nInfo, + NULL, 0, NULL)) { - case IMPL_BAD_INPUT_STOP: - case IMPL_BAD_INPUT_CONTINUE: + case sal::detail::textenc::BAD_INPUT_STOP: + case sal::detail::textenc::BAD_INPUT_CONTINUE: nHighSurrogate = 0; break; - case IMPL_BAD_INPUT_NO_OUTPUT: + case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: nInfo |= RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL; break; } |