X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=charset%2Fcharconv-gen.h;h=1c76b12a2d4e5328397491cc4c80ea0fab66e844;hb=eec6d2c37cbcbf9c350aa4ca80e5a316e5144087;hp=6740c1b4f279e310b8b5057e73942269fce74f3c;hpb=39359f268c445fa4a4defb38e644e519c58660f4;p=libucw.git diff --git a/charset/charconv-gen.h b/charset/charconv-gen.h index 6740c1b4..1c76b12a 100644 --- a/charset/charconv-gen.h +++ b/charset/charconv-gen.h @@ -13,6 +13,7 @@ do { /*** Header ***/ + const byte *s, *se; byte *d, *de; uns code; @@ -138,7 +139,7 @@ got_code: { byte *k = string_table + code - 0x100; uns len = *k++; - if (unlikely(de - d < len)) + if (unlikely((uns)(de - d) < len)) { c->state = SEQ_WRITE; c->string_at = k; @@ -154,7 +155,7 @@ got_code: if (code < 0x80) { if (d >= de) - goto dend; + goto dend_utf; *d++ = code; } else if (code < 0x800) @@ -193,6 +194,7 @@ got_code: else { write_slow: + c->code = code; c->state = UTF16_BE_WRITE; goto go_slow; } @@ -217,6 +219,7 @@ write_slow: else { write_slow: + c->code = code; c->state = UTF16_LE_WRITE; goto go_slow; } @@ -247,10 +250,6 @@ write_slow: #endif #ifdef CONV_WRITE_UTF8 - dend: - c->source = s; - c->dest = d; - return CONV_DEST_END; dend_utf: c->state = UTF8_WRITE_START; c->code = code;