summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sb@openoffice.org>2002-02-25 13:57:35 +0000
committerStephan Bergmann <sb@openoffice.org>2002-02-25 13:57:35 +0000
commit739cb04c36524c5a1bbf768dfe93624a1b2ec8b4 (patch)
tree5ccad5aaaff5aba90bb1e3b9351027ec7225653b /sal
parent353ef38df9e90182beb5e98470bfbd2f884a0c57 (diff)
#97705# Fixed mapping of Big5 EUDC points.
Diffstat (limited to 'sal')
-rw-r--r--sal/textenc/tcvtmb.c61
-rw-r--r--sal/textenc/tcvttcn6.tab16
2 files changed, 46 insertions, 31 deletions
diff --git a/sal/textenc/tcvtmb.c b/sal/textenc/tcvtmb.c
index 774291fb81a2..7f4c13556b54 100644
--- a/sal/textenc/tcvtmb.c
+++ b/sal/textenc/tcvtmb.c
@@ -2,9 +2,9 @@
*
* $RCSfile: tcvtmb.c,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: sb $ $Date: 2002-01-18 10:49:51 $
+ * last change: $Author: sb $ $Date: 2002-02-25 14:57:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -289,39 +289,50 @@ sal_Size ImplUnicodeToDBCS( const ImplTextConverterData* pData, void* pContext,
else
cConv = 0;
- if ( !cConv && !c )
+ if (cConv == 0 && c != 0)
{
- /* EUDC Ranges */
- sal_uInt16 i;
- const ImplDBCSEUDCData* pEUDCTab = pConvertData->mpEUDCTab;
- for ( i = 0; i < pConvertData->mnEUDCCount; i++ )
+ /* Map to EUDC ranges: */
+ ImplDBCSEUDCData const * pEUDCTab = pConvertData->mpEUDCTab;
+ sal_uInt32 i;
+ for (i = 0; i < pConvertData->mnEUDCCount; ++i)
{
- if ( (c >= pEUDCTab->mnUniStart) && (c <= pEUDCTab->mnUniEnd) )
+ if (c >= pEUDCTab->mnUniStart && c <= pEUDCTab->mnUniEnd)
{
- sal_uInt16 nLead = (c-pEUDCTab->mnUniStart) / pEUDCTab->mnTrailRangeCount;
- sal_uInt16 nOff = c-(nLead*pEUDCTab->mnTrailRangeCount);
- cConv = pEUDCTab->mnLeadStart+nLead;
- cConv <<= 8;
- if ( nOff < (pEUDCTab->mnTrail1End-pEUDCTab->mnTrail1Start+1) )
- cConv += pEUDCTab->mnTrail1Start+nOff;
- else
+ sal_uInt32 nIndex = c - pEUDCTab->mnUniStart;
+ sal_uInt32 nLeadOff
+ = nIndex / pEUDCTab->mnTrailRangeCount;
+ sal_uInt32 nTrailOff
+ = nIndex % pEUDCTab->mnTrailRangeCount;
+ sal_uInt32 nSize;
+ cConv = (sal_uInt16)
+ ((pEUDCTab->mnLeadStart + nLeadOff) << 8);
+ nSize
+ = pEUDCTab->mnTrail1End - pEUDCTab->mnTrail1Start + 1;
+ if (nTrailOff < nSize)
{
- nOff -= pEUDCTab->mnTrail1End-pEUDCTab->mnTrail1Start+1;
- if ( nOff < (pEUDCTab->mnTrail2End-pEUDCTab->mnTrail2Start+1) )
- cConv += pEUDCTab->mnTrail2Start+nOff;
- else
- {
- nOff -= pEUDCTab->mnTrail2End-pEUDCTab->mnTrail2Start+1;
- cConv += pEUDCTab->mnTrail3Start+nOff;
- }
+ cConv |= pEUDCTab->mnTrail1Start + nTrailOff;
+ break;
}
-
+ nTrailOff -= nSize;
+ nSize
+ = pEUDCTab->mnTrail2End - pEUDCTab->mnTrail2Start + 1;
+ if (nTrailOff < nSize)
+ {
+ cConv |= pEUDCTab->mnTrail2Start + nTrailOff;
+ break;
+ }
+ nTrailOff -= nSize;
+ cConv |= pEUDCTab->mnTrail3Start + nTrailOff;
break;
}
-
pEUDCTab++;
}
+ /* FIXME
+ * SB: Not sure why this is in here. Plus, it does not work as
+ * intended when (c & 0xFF) == 0, because the next !cConv check
+ * will then think c has not yet been converted...
+ */
if (c >= RTL_TEXTCVT_BYTE_PRIVATE_START
&& c <= RTL_TEXTCVT_BYTE_PRIVATE_END)
{
diff --git a/sal/textenc/tcvttcn6.tab b/sal/textenc/tcvttcn6.tab
index 92d5b01560ce..460dd252e6e7 100644
--- a/sal/textenc/tcvttcn6.tab
+++ b/sal/textenc/tcvttcn6.tab
@@ -2,9 +2,9 @@
*
* $RCSfile: tcvttcn6.tab,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: sb $ $Date: 2001-10-12 10:44:53 $
+ * last change: $Author: sb $ $Date: 2002-02-25 14:57:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -594,9 +594,10 @@ static ImplUniToDBCSHighTab const aBIG5DBCSHighTab[256] =
/* FA40-FEFE --> E000-E310 */
/* 8E40-A0FE --> E311-EEB7 */
/* 8140-8DFE --> EEB8-F6B0 */
-/* C6A1-C8FE --> F6B1-F8FF 3*5E = 11A --> F6B1+11A-1 = F7CA ??? */
+/* C6A1-C6FE --> F6B1-F70E */
+/* C740-C8FE --> F70F-F848 */
-#define DBCS_EUDC_MS950_COUNT 4
+#define DBCS_EUDC_MS950_COUNT 5
static ImplDBCSEUDCData const aImplMS950DBCSEUDCTab[DBCS_EUDC_MS950_COUNT] =
{
/* EUDC-Range */
@@ -609,9 +610,12 @@ static ImplDBCSEUDCData const aImplMS950DBCSEUDCTab[DBCS_EUDC_MS950_COUNT] =
/* Lead: 81-8D */
/* Trail: 40-7E, A1-FE */
{ 0x81, 0x8D, 0x40, 0x7E, 0xA1, 0xFE, 0, 0, 2, 0x9D, 0xEEB8, 0xF6B0 },
- /* Lead: C6-C8 */
+ /* Lead: C6-C6 */
/* Trail: A1-FE */
- { 0xC6, 0xC8, 0xA1, 0xFE, 0, 0, 0, 0, 1, 0x5E, 0xF6B1, 0xF7CA }
+ { 0xC6, 0xC6, 0xA1, 0xFE, 0, 0, 0, 0, 1, 0x5E, 0xF6B1, 0xF70E },
+ /* Lead: C7-C8 */
+ /* Trail: 40-7E, A1-FE */
+ { 0xC7, 0xC8, 0x40, 0x7E, 0xA1, 0xFE, 0, 0, 2, 0x9D, 0xF70F, 0xF848 }
};
/* ----------------------------------------------------------------------- */