RTL_UNICODETOTEXT_INFO_{DEST|SCR}BUFFERTOSMALL should use TOO, not TO

I have kept the old mispelled constant for backwards compatibility

Change-Id: I128a2eec76d00cc5ef058cd6a0c35a7474d2411e
Reviewed-on: https://gerrit.libreoffice.org/39995
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
This commit is contained in:
Chris Sherlock 2017-07-15 14:35:50 +10:00
parent 2cbd412168
commit 9af8964dd2
23 changed files with 80 additions and 76 deletions

View File

@ -81,8 +81,12 @@ SAL_DLLPUBLIC void SAL_CALL rtl_resetTextToUnicodeContext( rtl_TextToUnicodeConv
#define RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK ((sal_uInt32)0x0F00) #define RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK ((sal_uInt32)0x0F00)
#define RTL_TEXTTOUNICODE_INFO_ERROR ((sal_uInt32)0x0001) #define RTL_TEXTTOUNICODE_INFO_ERROR ((sal_uInt32)0x0001)
// Misspelled constant, kept for backwards compatibility:
#define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL ((sal_uInt32)0x0002) #define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL ((sal_uInt32)0x0002)
#define RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL ((sal_uInt32)0x0002)
// Misspelled constant, kept for backwards compatibility:
#define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ((sal_uInt32)0x0004) #define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ((sal_uInt32)0x0004)
#define RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL ((sal_uInt32)0x0004)
#define RTL_TEXTTOUNICODE_INFO_UNDEFINED ((sal_uInt32)0x0008) #define RTL_TEXTTOUNICODE_INFO_UNDEFINED ((sal_uInt32)0x0008)
#define RTL_TEXTTOUNICODE_INFO_MBUNDEFINED ((sal_uInt32)0x0010) #define RTL_TEXTTOUNICODE_INFO_MBUNDEFINED ((sal_uInt32)0x0010)
#define RTL_TEXTTOUNICODE_INFO_INVALID ((sal_uInt32)0x0020) #define RTL_TEXTTOUNICODE_INFO_INVALID ((sal_uInt32)0x0020)

View File

@ -288,13 +288,13 @@ sal_Int32 OTextInputStream::implReadNext()
nSourceCount += nSrcCvtBytes; nSourceCount += nSrcCvtBytes;
bool bCont = false; bool bCont = false;
if( uiInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ) if( uiInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL )
{ {
mvBuffer.resize(mvBuffer.size() * 2); mvBuffer.resize(mvBuffer.size() * 2);
bCont = true; bCont = true;
} }
if( uiInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL ) if( uiInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL )
{ {
// read next byte // read next byte
static Sequence< sal_Int8 > aOneByteSeq( 1 ); static Sequence< sal_Int8 > aOneByteSeq( 1 );

View File

@ -818,7 +818,7 @@ int TextToUnicode(
text, text_buffer_size, unic_text, unic_text_buffer_size, text, text_buffer_size, unic_text, unic_text_buffer_size,
OSTRING_TO_OUSTRING_CVTFLAGS | RTL_TEXTTOUNICODE_FLAGS_FLUSH, &nInfo, &nSrcChars); OSTRING_TO_OUSTRING_CVTFLAGS | RTL_TEXTTOUNICODE_FLAGS_FLUSH, &nInfo, &nSrcChars);
if (nInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL) if (nInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL)
{ {
errno = EOVERFLOW; errno = EOVERFLOW;
return 0; return 0;

View File

@ -265,7 +265,7 @@ void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
nOutput += nSize; nOutput += nSize;
nInput += nConverted; nInput += nConverted;
CPPUNIT_ASSERT_EQUAL((sal_uInt32) 0, CPPUNIT_ASSERT_EQUAL((sal_uInt32) 0,
(nInfo & ~RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL)); (nInfo & ~RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL));
} }
CPPUNIT_ASSERT_EQUAL(rTest.m_nUnicodeSize, nOutput); CPPUNIT_ASSERT_EQUAL(rTest.m_nUnicodeSize, nOutput);
CPPUNIT_ASSERT_EQUAL(rTest.m_nTextSize, nInput); CPPUNIT_ASSERT_EQUAL(rTest.m_nTextSize, nInput);
@ -306,11 +306,11 @@ void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
| (rTest.m_bGlobalSignature ? | (rTest.m_bGlobalSignature ?
RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE : 0)), RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE : 0)),
&nInfo, &nCvtBytes); &nInfo, &nCvtBytes);
if ((nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) != 0) { if ((nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) != 0) {
sal_Char sBuffer[10]; sal_Char sBuffer[10];
sBuffer[0] = c1; sBuffer[0] = c1;
sal_uInt16 nLen = 1; sal_uInt16 nLen = 1;
while ((nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) != 0 while ((nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) != 0
&& nLen < 10) && nLen < 10)
{ {
if (i == rTest.m_nTextSize) { if (i == rTest.m_nTextSize) {
@ -336,7 +336,7 @@ void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
aUnicode[nSize++] = aUC[1]; aUnicode[nSize++] = aUC[1];
} else { } else {
OSL_ASSERT( OSL_ASSERT(
(nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) == 0 (nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) == 0
&& nChars == 0 && nInfo != 0); && nChars == 0 && nInfo != 0);
aUnicode[nSize++] = sBuffer[0]; aUnicode[nSize++] = sBuffer[0];
i -= nLen - 1; i -= nLen - 1;
@ -426,9 +426,9 @@ void doComplexCharSetCutTest(ComplexCharSetTest const & rTest) {
&nInfo, &nConverted); &nInfo, &nConverted);
CPPUNIT_ASSERT_EQUAL(rTest.m_nUnicodeSize, nSize); CPPUNIT_ASSERT_EQUAL(rTest.m_nUnicodeSize, nSize);
if (nInfo != RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) if (nInfo != RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL)
{ {
CPPUNIT_ASSERT_EQUAL(RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL, CPPUNIT_ASSERT_EQUAL(RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL,
nInfo); nInfo);
} }
CPPUNIT_ASSERT_MESSAGE("nConverted should be less than rTest.m_nTextSize", nConverted < rTest.m_nTextSize); CPPUNIT_ASSERT_MESSAGE("nConverted should be less than rTest.m_nTextSize", nConverted < rTest.m_nTextSize);
@ -2683,7 +2683,7 @@ void Test::testSRCBUFFERTOSMALL() {
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR), RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR),
&info, &cvt)); &info, &cvt));
CPPUNIT_ASSERT_EQUAL(RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL, info); CPPUNIT_ASSERT_EQUAL(RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL, info);
CPPUNIT_ASSERT(cvt <= 1); CPPUNIT_ASSERT(cvt <= 1);
rtl_destroyTextToUnicodeContext(cv, cx); rtl_destroyTextToUnicodeContext(cv, cx);
rtl_destroyTextToUnicodeConverter(cv); rtl_destroyTextToUnicodeConverter(cv);

View File

@ -175,7 +175,7 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
return nDstSize == 1 return nDstSize == 1
? aDst[0] : rtl::combineSurrogates(aDst[0], aDst[1]); ? aDst[0] : rtl::combineSurrogates(aDst[0], aDst[1]);
} }
if (nInfo == RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL if (nInfo == RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL
&& pEnd - p >= 3 && p[0] == cEscapePrefix && pEnd - p >= 3 && p[0] == cEscapePrefix
&& (nWeight1 = getHexWeight(p[1])) >= 0 && (nWeight1 = getHexWeight(p[1])) >= 0
&& (nWeight2 = getHexWeight(p[2])) >= 0) && (nWeight2 = getHexWeight(p[2])) >= 0)
@ -183,7 +183,7 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
p += 3; p += 3;
aBuf.append(static_cast< char >(nWeight1 << 4 | nWeight2)); aBuf.append(static_cast< char >(nWeight1 << 4 | nWeight2));
} }
else if (nInfo == RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL else if (nInfo == RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL
&& p != pEnd && *p <= 0x7F) && p != pEnd && *p <= 0x7F)
{ {
aBuf.append(static_cast< char >(*p++)); aBuf.append(static_cast< char >(*p++));
@ -191,7 +191,7 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
else else
{ {
assert( assert(
(nInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL) (nInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL)
== 0); == 0);
break; break;
} }

View File

@ -728,7 +728,7 @@ static void rtl_string2UString_status( rtl_uString** ppThis,
if (*ppThis == nullptr) { if (*ppThis == nullptr) {
if (pInfo != nullptr) { if (pInfo != nullptr) {
*pInfo = RTL_TEXTTOUNICODE_INFO_ERROR | *pInfo = RTL_TEXTTOUNICODE_INFO_ERROR |
RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
} }
return; return;
} }
@ -783,7 +783,7 @@ retry:
{ {
if (pInfo != nullptr) { if (pInfo != nullptr) {
*pInfo = RTL_TEXTTOUNICODE_INFO_ERROR | *pInfo = RTL_TEXTTOUNICODE_INFO_ERROR |
RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
} }
return; return;
} }
@ -814,7 +814,7 @@ retry:
if (pTemp == nullptr) { if (pTemp == nullptr) {
if (pInfo != nullptr) { if (pInfo != nullptr) {
*pInfo = RTL_TEXTTOUNICODE_INFO_ERROR | *pInfo = RTL_TEXTTOUNICODE_INFO_ERROR |
RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
} }
return; return;
} }
@ -828,7 +828,7 @@ retry:
/* Shouldn't be the case, but if we get textencoding which /* Shouldn't be the case, but if we get textencoding which
could results in more unicode characters we have this could results in more unicode characters we have this
code here. Could be the case for apple encodings */ code here. Could be the case for apple encodings */
while ( nInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ) while ( nInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL )
{ {
rtl_freeMemory( pTemp ); rtl_freeMemory( pTemp );
nNewLen += 8; nNewLen += 8;
@ -836,7 +836,7 @@ retry:
if (pTemp == nullptr) { if (pTemp == nullptr) {
if (pInfo != nullptr) { if (pInfo != nullptr) {
*pInfo = RTL_TEXTTOUNICODE_INFO_ERROR | *pInfo = RTL_TEXTTOUNICODE_INFO_ERROR |
RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
} }
return; return;
} }

View File

@ -239,17 +239,17 @@ sal_Size ImplConvertBig5HkscsToUnicode(void const * pData,
no_output: no_output:
--pSrcBuf; --pSrcBuf;
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
if (nRow != 0 if (nRow != 0
&& (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR && (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR
| RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL)) | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL))
== 0) == 0)
{ {
if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0)
nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion(
false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd,
@ -261,7 +261,7 @@ sal_Size ImplConvertBig5HkscsToUnicode(void const * pData,
break; break;
case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: case sal::detail::textenc::BAD_INPUT_NO_OUTPUT:
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
} }

View File

@ -248,17 +248,17 @@ sal_Size ImplConvertEucTwToUnicode(void const * pData,
no_output: no_output:
--pSrcBuf; --pSrcBuf;
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
if (eState != IMPL_EUC_TW_TO_UNICODE_STATE_0 if (eState != IMPL_EUC_TW_TO_UNICODE_STATE_0
&& (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR && (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR
| RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL)) | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL))
== 0) == 0)
{ {
if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0)
nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion(
false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd,
@ -270,7 +270,7 @@ sal_Size ImplConvertEucTwToUnicode(void const * pData,
break; break;
case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: case sal::detail::textenc::BAD_INPUT_NO_OUTPUT:
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
} }

View File

@ -240,17 +240,17 @@ sal_Size ImplConvertGb18030ToUnicode(void const * pData,
no_output: no_output:
--pSrcBuf; --pSrcBuf;
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
if (eState != IMPL_GB_18030_TO_UNICODE_STATE_0 if (eState != IMPL_GB_18030_TO_UNICODE_STATE_0
&& (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR && (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR
| RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL)) | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL))
== 0) == 0)
{ {
if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0)
nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion(
false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd,
@ -262,7 +262,7 @@ sal_Size ImplConvertGb18030ToUnicode(void const * pData,
break; break;
case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: case sal::detail::textenc::BAD_INPUT_NO_OUTPUT:
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
} }

View File

@ -101,7 +101,7 @@ sal_Size IsciiDevanagariToUnicode::convert(
{ {
if (pDestBufPtr == pDestBufEnd) if (pDestBufPtr == pDestBufEnd)
{ {
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
@ -196,7 +196,7 @@ sal_Size IsciiDevanagariToUnicode::convert(
break; break;
if (eAction == BAD_INPUT_NO_OUTPUT) if (eAction == BAD_INPUT_NO_OUTPUT)
{ {
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
} }

View File

@ -373,17 +373,17 @@ sal_Size ImplConvertIso2022CnToUnicode(void const * pData,
no_output: no_output:
--pSrcBuf; --pSrcBuf;
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
if (eState > IMPL_ISO_2022_CN_TO_UNICODE_STATE_SO if (eState > IMPL_ISO_2022_CN_TO_UNICODE_STATE_SO
&& (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR && (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR
| RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL)) | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL))
== 0) == 0)
{ {
if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0)
nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion(
false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd,
@ -396,7 +396,7 @@ sal_Size ImplConvertIso2022CnToUnicode(void const * pData,
break; break;
case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: case sal::detail::textenc::BAD_INPUT_NO_OUTPUT:
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
} }

View File

@ -261,17 +261,17 @@ sal_Size ImplConvertIso2022JpToUnicode(void const * pData,
no_output: no_output:
--pSrcBuf; --pSrcBuf;
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
if (eState > IMPL_ISO_2022_JP_TO_UNICODE_STATE_0208 if (eState > IMPL_ISO_2022_JP_TO_UNICODE_STATE_0208
&& (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR && (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR
| RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL)) | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL))
== 0) == 0)
{ {
if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0)
nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion(
false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd,
@ -283,7 +283,7 @@ sal_Size ImplConvertIso2022JpToUnicode(void const * pData,
break; break;
case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: case sal::detail::textenc::BAD_INPUT_NO_OUTPUT:
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
} }

View File

@ -224,17 +224,17 @@ sal_Size ImplConvertIso2022KrToUnicode(void const * pData,
no_output: no_output:
--pSrcBuf; --pSrcBuf;
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
if (eState > IMPL_ISO_2022_KR_TO_UNICODE_STATE_1001 if (eState > IMPL_ISO_2022_KR_TO_UNICODE_STATE_1001
&& (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR && (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR
| RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL)) | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL))
== 0) == 0)
{ {
if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0)
nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion(
false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd,
@ -246,7 +246,7 @@ sal_Size ImplConvertIso2022KrToUnicode(void const * pData,
break; break;
case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: case sal::detail::textenc::BAD_INPUT_NO_OUTPUT:
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
} }

View File

@ -554,7 +554,7 @@ sal_Size sal::detail::textenc::convertCharToUnicode(
if ( pDestBuf == pEndDestBuf ) if ( pDestBuf == pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }

View File

@ -69,7 +69,7 @@ sal_Size rtl_textenc_convertSingleByteToBmpUnicode(
break; break;
no_output: no_output:
--srcBuf; --srcBuf;
infoFlags |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; infoFlags |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
if (info != nullptr) { if (info != nullptr) {

View File

@ -42,7 +42,7 @@ sal_Size ImplSymbolToUnicode( SAL_UNUSED_PARAMETER const void*,
{ {
if ( pDestBuf == pEndDestBuf ) if ( pDestBuf == pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
@ -136,7 +136,7 @@ sal_Size ImplUpperCharToUnicode( const void* pData,
pEndSrcBuf = pSrcBuf+nSrcBytes; pEndSrcBuf = pSrcBuf+nSrcBytes;
if ( pDestBuf == pEndDestBuf ) if ( pDestBuf == pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
*pSrcCvtBytes = 0; *pSrcCvtBytes = 0;
return 0; return 0;
} }

View File

@ -87,7 +87,7 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*,
{ {
if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0 ) if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0 )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
break; break;
} }
cConv = 0; cConv = 0;
@ -194,7 +194,7 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*,
if ( pDestBuf == pEndDestBuf ) if ( pDestBuf == pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
@ -403,7 +403,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData,
/* Source buffer to small */ /* Source buffer to small */
if ( pSrcBuf + 1 == pEndSrcBuf ) if ( pSrcBuf + 1 == pEndSrcBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
break; break;
} }
@ -427,7 +427,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData,
/* Source buffer to small */ /* Source buffer to small */
if (pEndSrcBuf - pSrcBuf < 3) if (pEndSrcBuf - pSrcBuf < 3)
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
break; break;
} }
@ -444,7 +444,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData,
/* Source buffer to small */ /* Source buffer to small */
if ( pSrcBuf + 1 == pEndSrcBuf ) if ( pSrcBuf + 1 == pEndSrcBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
break; break;
} }
@ -512,7 +512,7 @@ sal_Size ImplEUCJPToUnicode( const void* pData,
if ( pDestBuf == pEndDestBuf ) if ( pDestBuf == pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }

View File

@ -224,7 +224,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
{ {
if ( pDestBuf >= pEndDestBuf ) if ( pDestBuf >= pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
*pDestBuf = IMPL_SHIFT_IN_CHAR; *pDestBuf = IMPL_SHIFT_IN_CHAR;
@ -248,7 +248,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
/* When no more bytes in the source buffer, then */ /* When no more bytes in the source buffer, then */
/* this buffer may be to small */ /* this buffer may be to small */
if ( bEnd ) if ( bEnd )
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_INVALID; *pInfo |= RTL_TEXTTOUNICODE_INFO_INVALID;
@ -284,7 +284,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
if ( nBufferBits >= 16 ) if ( nBufferBits >= 16 )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
@ -297,7 +297,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
/* When no more bytes in the source buffer, then */ /* When no more bytes in the source buffer, then */
/* this buffer may be to small */ /* this buffer may be to small */
if ( bEnd ) if ( bEnd )
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_INVALID; *pInfo |= RTL_TEXTTOUNICODE_INFO_INVALID;
@ -310,7 +310,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
{ {
if ( pDestBuf >= pEndDestBuf ) if ( pDestBuf >= pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
*pDestBuf++ *pDestBuf++
@ -351,7 +351,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
{ {
if ( pDestBuf >= pEndDestBuf ) if ( pDestBuf >= pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
*pDestBuf++ *pDestBuf++
@ -362,7 +362,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
/* Write char to unicode buffer */ /* Write char to unicode buffer */
if ( pDestBuf >= pEndDestBuf ) if ( pDestBuf >= pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
*pDestBuf = c; *pDestBuf = c;

View File

@ -207,17 +207,17 @@ sal_Size ImplConvertUtf8ToUnicode(
no_output: no_output:
--pSrcBufPtr; --pSrcBufPtr;
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
if (nShift >= 0 if (nShift >= 0
&& (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR && (nInfo & (RTL_TEXTTOUNICODE_INFO_ERROR
| RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL)) | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL))
== 0) == 0)
{ {
if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0) if ((nFlags & RTL_TEXTTOUNICODE_FLAGS_FLUSH) == 0)
nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL;
else else
switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion(
false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd, false, true, 0, nFlags, &pDestBufPtr, pDestBufEnd,
@ -230,7 +230,7 @@ sal_Size ImplConvertUtf8ToUnicode(
break; break;
case sal::detail::textenc::BAD_INPUT_NO_OUTPUT: case sal::detail::textenc::BAD_INPUT_NO_OUTPUT:
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }
} }

View File

@ -50,7 +50,7 @@ static sal_Size ImplDummyToUnicode( const char* pSrcBuf, sal_Size nSrcBytes,
{ {
if ( pDestBuf == pEndDestBuf ) if ( pDestBuf == pEndDestBuf )
{ {
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL; *pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR | RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
break; break;
} }

View File

@ -420,14 +420,14 @@ Sequence<sal_Unicode> Text2UnicodeConverter::convert( const Sequence<sal_Int8> &
&nSrcCvtBytes ); &nSrcCvtBytes );
nSourceCount += nSrcCvtBytes; nSourceCount += nSrcCvtBytes;
if( uiInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ) { if( uiInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL ) {
// save necessary bytes for next conversion // save necessary bytes for next conversion
seqUnicode.realloc( seqUnicode.getLength() * 2 ); seqUnicode.realloc( seqUnicode.getLength() * 2 );
continue; continue;
} }
break; break;
} }
if( uiInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL ) { if( uiInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL ) {
m_seqSource.realloc( nSourceSize - nSourceCount ); m_seqSource.realloc( nSourceSize - nSourceCount );
memcpy( m_seqSource.getArray() , &(pbSource[nSourceCount]) , nSourceSize-nSourceCount ); memcpy( m_seqSource.getArray() , &(pbSource[nSourceCount]) , nSourceSize-nSourceCount );
} }

View File

@ -304,14 +304,14 @@ sal_uInt32 SvParser<T>::GetNextChar()
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR| RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR|
RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR, RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR,
&nInfo, &nCvtBytes); &nInfo, &nCvtBytes);
if( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) != 0 ) if( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) != 0 )
{ {
// The conversion wasn't successful because we haven't // The conversion wasn't successful because we haven't
// read enough characters. // read enough characters.
if( pImplData->hContext != reinterpret_cast<rtl_TextToUnicodeContext>(1) ) if( pImplData->hContext != reinterpret_cast<rtl_TextToUnicodeContext>(1) )
{ {
sal_Unicode sCh[2]; sal_Unicode sCh[2];
while( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) != 0 ) while( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) != 0 )
{ {
rInput.ReadChar( c1 ); rInput.ReadChar( c1 );
bErr = rInput.IsEof() || rInput.GetError(); bErr = rInput.IsEof() || rInput.GetError();
@ -338,9 +338,9 @@ sal_uInt32 SvParser<T>::GetNextChar()
} }
else if( 0 != nChars || 0 != nInfo ) else if( 0 != nChars || 0 != nInfo )
{ {
DBG_ASSERT( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) == 0, DBG_ASSERT( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) == 0,
"source buffer is to small" ); "source buffer is to small" );
DBG_ASSERT( (nInfo&~(RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL)) == 0, DBG_ASSERT( (nInfo&~(RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL)) == 0,
"there is a conversion error" ); "there is a conversion error" );
DBG_ASSERT( 0 == nChars, DBG_ASSERT( 0 == nChars,
"there is a converted character, but an error" ); "there is a converted character, but an error" );
@ -356,7 +356,7 @@ sal_uInt32 SvParser<T>::GetNextChar()
sal_Char sBuffer[10]; sal_Char sBuffer[10];
sBuffer[0] = c1; sBuffer[0] = c1;
sal_uInt16 nLen = 1; sal_uInt16 nLen = 1;
while( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) != 0 && while( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) != 0 &&
nLen < 10 ) nLen < 10 )
{ {
rInput.ReadChar( c1 ); rInput.ReadChar( c1 );
@ -382,9 +382,9 @@ sal_uInt32 SvParser<T>::GetNextChar()
} }
else else
{ {
DBG_ASSERT( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) == 0, DBG_ASSERT( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) == 0,
"source buffer is to small" ); "source buffer is to small" );
DBG_ASSERT( (nInfo&~(RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL)) == 0, DBG_ASSERT( (nInfo&~(RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL)) == 0,
"there is a conversion error" ); "there is a conversion error" );
DBG_ASSERT( 0 == nChars, DBG_ASSERT( 0 == nChars,
"there is a converted character, but an error" ); "there is a converted character, but an error" );

View File

@ -117,7 +117,7 @@ sal_Unicode * convertToUnicode(const sal_Char * pBegin,
| RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
| RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR, | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR,
&nInfo, &nSrcCvtBytes); &nInfo, &nSrcCvtBytes);
if (nInfo != RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL) if (nInfo != RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL)
break; break;
delete[] pBuffer; delete[] pBuffer;
rtl_resetTextToUnicodeContext(hConverter, hContext); rtl_resetTextToUnicodeContext(hConverter, hContext);