From: handa Date: Mon, 13 Sep 2004 01:52:35 +0000 (+0000) Subject: (mdebug_dump_mtext): Fix for the case of mt->format > X-Git-Tag: REL-1-2-0~200 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=085383d3eafe647fb8e91014103b768ac0fcc21b;p=m17n%2Fm17n-lib.git (mdebug_dump_mtext): Fix for the case of mt->format > MTEXT_FORMAT_UTF_8. --- diff --git a/src/mtext.c b/src/mtext.c index f117cf2..fdc993b 100644 --- a/src/mtext.c +++ b/src/mtext.c @@ -2752,26 +2752,24 @@ mdebug_dump_mtext (MText *mt, int indent, int fullp) memset (prefix, 32, indent); prefix[indent] = 0; + fprintf (stderr, + "(mtext (size %d %d %d) (cache %d %d)", + mt->nchars, mt->nbytes, mt->allocated, + mt->cache_char_pos, mt->cache_byte_pos); if (! fullp) { - fprintf (stderr, "\""); - for (i = 0; i < mt->nbytes; i++) + fprintf (stderr, " \""); + for (i = 0; i < mt->nchars; i++) { - int c = mt->data[i]; + int c = mtext_ref_char (mt, i); if (c >= ' ' && c < 127) fprintf (stderr, "%c", c); else fprintf (stderr, "\\x%02X", c); } fprintf (stderr, "\""); - return mt; } - - fprintf (stderr, - "(mtext (size %d %d %d) (cache %d %d)", - mt->nchars, mt->nbytes, mt->allocated, - mt->cache_char_pos, mt->cache_byte_pos); - if (mt->nchars > 0) + else if (mt->nchars > 0) { fprintf (stderr, "\n%s (bytes \"", prefix); for (i = 0; i < mt->nbytes; i++) @@ -2784,7 +2782,7 @@ mdebug_dump_mtext (MText *mt, int indent, int fullp) int len; int c = STRING_CHAR_AND_BYTES (p, len); - if (c >= ' ' && c < 127 && c != '\\' && c != '"') + if (c >= ' ' && c < 127 && c != '\\' && c != '\"') fputc (c, stderr); else fprintf (stderr, "\\x%X", c);