From f46ce8604fb57e90ec9c43cd6f946e4c44c7eb4b Mon Sep 17 00:00:00 2001 From: David Mathog <> Date: Tue, 4 Dec 2012 10:47:30 +0100 Subject: changes_2012-11_28.patch EMF import: - fix a bug which could potentially show up when a UTF16 string was read from an EMF file that contained mostly glyphs that needed 3 or 4 byte UTF-8 encoding. (bzr r11668.1.43) --- src/extension/internal/uemf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/extension/internal/uemf.c b/src/extension/internal/uemf.c index 50ba9933b..785bb475e 100644 --- a/src/extension/internal/uemf.c +++ b/src/extension/internal/uemf.c @@ -14,8 +14,8 @@ /* File: uemf.c -Version: 0.0.9 -Date: 26-OCT-2012 +Version: 0.0.10 +Date: 28-NOV-2012 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu Copyright: 2012 David Mathog and California Institute of Technology (Caltech) @@ -477,7 +477,8 @@ char *U_Utf16leToUtf8( size_t srclen,dstlen,status; if(max){ srclen = 2*max; } else { srclen = 2*(1 +wchar16len(src)); } //include terminator, length in BYTES - dstlen = 1 + srclen; // this will always work, but may waste space + dstlen = 1 + 2*srclen; // this will always work, but may waste space + // worst case is all glyphs (==max) need 4 UTF-8 encoded bytes + terminator. dst2 = dst = (char *) calloc(dstlen,1); if(!dst)return(NULL); iconv_t conv = iconv_open("UTF-8", "UTF-16LE"); -- cgit v1.2.3