summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qpdf/UTF8.h
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/qpdf/UTF8.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/UTF8.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/UTF8.h b/noncore/unsupported/qpdf/UTF8.h
index aacf663..95adecf 100644
--- a/noncore/unsupported/qpdf/UTF8.h
+++ b/noncore/unsupported/qpdf/UTF8.h
@@ -19,6 +19,20 @@ static int mapUTF8 ( Unicode u, char *buf, int bufSize )
::memcpy ( buf, utf. data ( ), len );
return len;
}
else
return 0;
}
+
+static int mapUCS2 ( Unicode u, char *buf, int bufSize)
+{
+ if (u <= 0xffff) {
+ if (bufSize < 2)
+ return 0;
+
+ buf[0] = (char)((u >> 8) & 0xff);
+ buf[1] = (char)(u & 0xff);
+ return 2;
+ }
+ else
+ return 0;
+}