From: Nick Ing-Simmons Date: Tue, 19 Nov 2002 10:16:27 +0000 (+0000) Subject: Integrate mainline X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7211588c6aa4629aa6b38db94c2ae732db5ef8c7;p=p5sagit%2Fp5-mst-13.2.git Integrate mainline p4raw-id: //depot/perlio@18157 --- 7211588c6aa4629aa6b38db94c2ae732db5ef8c7 diff --cc ext/Encode/Encode.xs index 89f7a29,df77b7a..d9e33bf --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@@ -337,19 -337,19 +337,19 @@@ CODE s = e; } else { - /* Native bytes - can always encode */ - U8 *d = (U8 *) SvGROW(dst,2*slen); - while (s < e) { - UV uv = NATIVE_TO_UNI((UV) *s++); - if (UNI_IS_INVARIANT(uv)) - *d++ = (U8)UTF_TO_NATIVE(uv); - else { - *d++ = (U8)UTF8_EIGHT_BIT_HI(uv); - *d++ = (U8)UTF8_EIGHT_BIT_LO(uv); - } + /* Native bytes - can always encode */ - U8 *d = (U8 *) SvGROW(dst,2*slen); ++ U8 *d = (U8 *) SvGROW(dst,2*slen+1); + while (s < e) { + UV uv = NATIVE_TO_UNI((UV) *s++); + if (UNI_IS_INVARIANT(uv)) + *d++ = (U8)UTF_TO_NATIVE(uv); + else { + *d++ = (U8)UTF8_EIGHT_BIT_HI(uv); + *d++ = (U8)UTF8_EIGHT_BIT_LO(uv); + } } - SvCUR_set(dst, d- (U8 *)SvPVX(dst)); - *SvEND(dst) = '\0'; + SvCUR_set(dst, d- (U8 *)SvPVX(dst)); + *SvEND(dst) = '\0'; } /* Clear out translated part of source unless asked not to */