summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc')
-rw-r--r--Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc40
1 files changed, 4 insertions, 36 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc
index 5eec7a9fc6c..0a2100fde9b 100644
--- a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc
+++ b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc
@@ -232,6 +232,10 @@ CharCodeToUnicode *CharCodeToUnicode::make8BitToUnicode(Unicode *toUnicode) {
return new CharCodeToUnicode(NULL, toUnicode, 256, gTrue, NULL, 0, 0);
}
+CharCodeToUnicode *CharCodeToUnicode::make16BitToUnicode(Unicode *toUnicode) {
+ return new CharCodeToUnicode(NULL, toUnicode, 65536, gTrue, NULL, 0, 0);
+}
+
CharCodeToUnicode *CharCodeToUnicode::parseCMap(GString *buf, int nBits) {
CharCodeToUnicode *ctu;
GStringIndex idx;
@@ -470,24 +474,17 @@ GBool CharCodeToUnicode::parseCMap1(int (*getCharFunc)(void *), void *data,
void CharCodeToUnicode::addMapping(CharCode code, char *uStr, int n,
int offset) {
CharCode oldLen, i;
-#if 1 //~utf16
Unicode u[maxUnicodeString];
int uLen, j;
-#else
- Unicode u;
- int j;
-#endif
if (code > 0xffffff) {
// This is an arbitrary limit to avoid integer overflow issues.
// (I've seen CMaps with mappings for <ffffffff>.)
return;
}
-#if 1 //~utf16
if ((uLen = parseUTF16String(uStr, n, u)) == 0) {
return;
}
-#endif
if (code >= mapLen) {
oldLen = mapLen;
mapLen = mapLen ? 2 * mapLen : 256;
@@ -499,7 +496,6 @@ void CharCodeToUnicode::addMapping(CharCode code, char *uStr, int n,
map[i] = 0;
}
}
-#if 1 //~utf16
if (uLen == 1) {
map[code] = u[0] + offset;
} else {
@@ -517,34 +513,6 @@ void CharCodeToUnicode::addMapping(CharCode code, char *uStr, int n,
sMap[sMapLen].len = uLen;
++sMapLen;
}
-#else //~utf16
- if (n <= 4) {
- if (!parseHex(uStr, n, &u)) {
- error(errSyntaxWarning, -1, "Illegal entry in ToUnicode CMap");
- return;
- }
- map[code] = u + offset;
- } else {
- if (sMapLen >= sMapSize) {
- sMapSize = sMapSize + 16;
- sMap = (CharCodeToUnicodeString *)
- greallocn(sMap, sMapSize, sizeof(CharCodeToUnicodeString));
- }
- map[code] = 0;
- sMap[sMapLen].c = code;
- if ((sMap[sMapLen].len = n / 4) > maxUnicodeString) {
- sMap[sMapLen].len = maxUnicodeString;
- }
- for (j = 0; j < sMap[sMapLen].len; ++j) {
- if (!parseHex(uStr + j*4, 4, &sMap[sMapLen].u[j])) {
- error(errSyntaxWarning, -1, "Illegal entry in ToUnicode CMap");
- return;
- }
- }
- sMap[sMapLen].u[sMap[sMapLen].len - 1] += offset;
- ++sMapLen;
- }
-#endif //~utf16
}
// Convert a UTF-16BE hex string into a sequence of up to