diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-11-06 18:27:25 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-11-06 18:27:25 +0100 |
commit | 5936a64c2aa275992ce231183b35711d8da74ace (patch) | |
tree | fcd0b76405787c647299d36bf863585ee6bbaea7 /sal | |
parent | fc0d57b7aff84f4bdca0a1f201527c265d5f0cf5 (diff) |
sal: do not ignore conversion flags for RTL_TEXTENCODING_ASCII_US
Keep the fast path fast, fall back to the text encoder in case there's a
fly in the ointment.
Change-Id: I94507856a7f3170f770adb741aa1e282d0d2400c
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/ustring.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx index c7622bd246be..1d30dcc49845 100644 --- a/sal/rtl/ustring.cxx +++ b/sal/rtl/ustring.cxx @@ -641,23 +641,28 @@ static void rtl_string2UString_status( rtl_uString** ppThis, return; } pBuffer = (*ppThis)->buffer; + sal_Int32 nLenCopy(nLen); + const sal_Char *pStrCopy(pStr); do { /* Check ASCII range */ - SAL_WARN_IF( ((unsigned char)*pStr) > 127, "rtl.string", - "rtl_string2UString_status() - Found char > 127 and RTL_TEXTENCODING_ASCII_US is specified" ); + if (static_cast<unsigned char>(*pStrCopy) > 127) + { + rtl_uString_release(*ppThis); + goto retry; // cancel loop - try again with the converter + } - *pBuffer = *pStr; + *pBuffer = *pStrCopy; pBuffer++; - pStr++; - nLen--; + pStrCopy++; + nLenCopy--; } - while ( nLen ); + while (nLenCopy); if (pInfo != NULL) { *pInfo = 0; } } - else +retry: { rtl_uString* pTemp; rtl_uString* pTemp2 = NULL; |