summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sal/textenc/converter.c51
-rw-r--r--sal/textenc/converter.h9
-rw-r--r--sal/textenc/converteuctw.c14
-rw-r--r--sal/textenc/convertgb18030.c14
4 files changed, 53 insertions, 35 deletions
diff --git a/sal/textenc/converter.c b/sal/textenc/converter.c
index 6323e397cf28..f5459fc1bedc 100644
--- a/sal/textenc/converter.c
+++ b/sal/textenc/converter.c
@@ -2,9 +2,9 @@
*
* $RCSfile: converter.c,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sb $ $Date: 2001-10-17 14:35:30 $
+ * last change: $Author: sb $ $Date: 2001-11-19 17:46:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,11 +116,16 @@ ImplHandleBadInputUnicodeToTextConversion(sal_Bool bUndefined,
sal_uInt32 nFlags,
sal_Char ** pDestBufPtr,
sal_Char * pDestBufEnd,
- sal_uInt32 * pInfo)
+ sal_uInt32 * pInfo,
+ sal_Char const * pPrefix,
+ sal_Size nPrefixLen,
+ sal_Bool * pPrefixWritten)
{
/* TODO! RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE
RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR */
+ sal_Char cReplace;
+
if (bUndefined)
if (ImplIsControlOrFormat(nUtf32))
{
@@ -151,38 +156,36 @@ ImplHandleBadInputUnicodeToTextConversion(sal_Bool bUndefined,
case RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE:
case RTL_UNICODETOTEXT_FLAGS_INVALID_IGNORE:
+ if (pPrefixWritten)
+ *pPrefixWritten = sal_False;
return IMPL_BAD_INPUT_CONTINUE;
case RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0:
case RTL_UNICODETOTEXT_FLAGS_INVALID_0:
- if (*pDestBufPtr != pDestBufEnd)
- {
- *(*pDestBufPtr)++ = 0;
- return IMPL_BAD_INPUT_CONTINUE;
- }
- else
- return IMPL_BAD_INPUT_NO_OUTPUT;
+ cReplace = 0;
+ break;
case RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK:
case RTL_UNICODETOTEXT_FLAGS_INVALID_QUESTIONMARK:
default: /* RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT,
RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT */
- if (*pDestBufPtr != pDestBufEnd)
- {
- *(*pDestBufPtr)++ = '?';
- return IMPL_BAD_INPUT_CONTINUE;
- }
- else
- return IMPL_BAD_INPUT_NO_OUTPUT;
+ cReplace = '?';
+ break;
case RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE:
case RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE:
- if (*pDestBufPtr != pDestBufEnd)
- {
- *(*pDestBufPtr)++ = '_';
- return IMPL_BAD_INPUT_CONTINUE;
- }
- else
- return IMPL_BAD_INPUT_NO_OUTPUT;
+ cReplace = '_';
+ break;
+ }
+ if ((sal_Size) (pDestBufEnd - *pDestBufPtr) > nPrefixLen)
+ {
+ while (nPrefixLen-- > 0)
+ *(*pDestBufPtr)++ = *pPrefix++;
+ *(*pDestBufPtr)++ = cReplace;
+ if (pPrefixWritten)
+ *pPrefixWritten = sal_True;
+ return IMPL_BAD_INPUT_CONTINUE;
}
+ else
+ return IMPL_BAD_INPUT_NO_OUTPUT;
}
diff --git a/sal/textenc/converter.h b/sal/textenc/converter.h
index 4ea325c0a1eb..634b9a408c20 100644
--- a/sal/textenc/converter.h
+++ b/sal/textenc/converter.h
@@ -2,9 +2,9 @@
*
* $RCSfile: converter.h,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sb $ $Date: 2001-10-17 14:35:30 $
+ * last change: $Author: sb $ $Date: 2001-11-19 17:46:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,7 +103,10 @@ ImplHandleBadInputUnicodeToTextConversion(sal_Bool bUndefined,
sal_uInt32 nFlags,
sal_Char ** pDestBufPtr,
sal_Char * pDestBufEnd,
- sal_uInt32 * pInfo)
+ sal_uInt32 * pInfo,
+ sal_Char const * pPrefix,
+ sal_Size nPrefixLen,
+ sal_Bool * pPrefixWritten)
SAL_THROW_EXTERN_C();
#if defined __cplusplus
diff --git a/sal/textenc/converteuctw.c b/sal/textenc/converteuctw.c
index e9e2367c4d00..1998e3076406 100644
--- a/sal/textenc/converteuctw.c
+++ b/sal/textenc/converteuctw.c
@@ -2,9 +2,9 @@
*
* $RCSfile: converteuctw.c,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sb $ $Date: 2001-10-17 14:28:23 $
+ * last change: $Author: sb $ $Date: 2001-11-19 17:46:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -441,7 +441,10 @@ sal_Size ImplConvertUnicodeToEucTw(ImplTextConverterData const * pData,
nFlags,
&pDestBufPtr,
pDestBufEnd,
- &nInfo))
+ &nInfo,
+ NULL,
+ 0,
+ NULL))
{
case IMPL_BAD_INPUT_STOP:
nHighSurrogate = 0;
@@ -474,7 +477,10 @@ sal_Size ImplConvertUnicodeToEucTw(ImplTextConverterData const * pData,
nFlags,
&pDestBufPtr,
pDestBufEnd,
- &nInfo))
+ &nInfo,
+ NULL,
+ 0,
+ NULL))
{
case IMPL_BAD_INPUT_STOP:
case IMPL_BAD_INPUT_CONTINUE:
diff --git a/sal/textenc/convertgb18030.c b/sal/textenc/convertgb18030.c
index ce2a81c9edb1..a55a38cad230 100644
--- a/sal/textenc/convertgb18030.c
+++ b/sal/textenc/convertgb18030.c
@@ -2,9 +2,9 @@
*
* $RCSfile: convertgb18030.c,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sb $ $Date: 2001-10-17 14:35:30 $
+ * last change: $Author: sb $ $Date: 2001-11-19 17:46:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -457,7 +457,10 @@ sal_Size ImplConvertUnicodeToGb18030(ImplTextConverterData const * pData,
nFlags,
&pDestBufPtr,
pDestBufEnd,
- &nInfo))
+ &nInfo,
+ NULL,
+ 0,
+ NULL))
{
case IMPL_BAD_INPUT_STOP:
nHighSurrogate = 0;
@@ -490,7 +493,10 @@ sal_Size ImplConvertUnicodeToGb18030(ImplTextConverterData const * pData,
nFlags,
&pDestBufPtr,
pDestBufEnd,
- &nInfo))
+ &nInfo,
+ NULL,
+ 0,
+ NULL))
{
case IMPL_BAD_INPUT_STOP:
case IMPL_BAD_INPUT_CONTINUE: