ICU-410 preflighting crashed when destCapacity>0 (oops, did this yesterday?)

X-SVN-Rev: 2307
This commit is contained in:
Markus Scherer 2000-08-17 17:12:38 +00:00
parent 8940d6fe91
commit faa2a512ef

View File

@ -534,8 +534,10 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
int32_t lenParsed = 0; int32_t lenParsed = 0;
UChar32 c32; UChar32 c32;
if (src != segment) { if (src != segment) {
_appendUChars(dest + i, destCapacity - i, if (dest != NULL) {
segment, src - segment); _appendUChars(dest + i, destCapacity - i,
segment, src - segment);
}
i += src - segment; i += src - segment;
} }
++src; /* advance past '\\' */ ++src; /* advance past '\\' */
@ -555,11 +557,13 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
} }
} }
if (src != segment) { if (src != segment) {
_appendUChars(dest + i, destCapacity - i, if (dest != NULL) {
segment, src - segment); _appendUChars(dest + i, destCapacity - i,
segment, src - segment);
}
i += src - segment; i += src - segment;
} }
if (i < destCapacity) { if (dest != NULL && i < destCapacity) {
dest[i] = 0; dest[i] = 0;
} }
return i + 1; /* add 1 for zero term */ return i + 1; /* add 1 for zero term */