From: handa Date: Mon, 29 Mar 2004 03:56:32 +0000 (+0000) Subject: (mtext__adjust_foramt): New function. X-Git-Tag: REL-1-0-2~5 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4692cf310041e485e1466389ff131f87ec9888de;p=m17n%2Fm17n-lib.git (mtext__adjust_foramt): New function. --- diff --git a/src/mtext.c b/src/mtext.c index d052cfe..9876eab 100644 --- a/src/mtext.c +++ b/src/mtext.c @@ -806,6 +806,35 @@ mtext__from_data (void *data, int nitems, enum MTextFormat format, } +/* Not yet implemented. */ + +int +mtext__adjust_format (MText *mt, enum MTextFormat format) +{ + if (mt->format == format) + return 0; + if (mt->format == MTEXT_FORMAT_US_ASCII) + { + if (format == MTEXT_FORMAT_UTF_8) + mt->format = MTEXT_FORMAT_UTF_8; + MERROR (MERROR_MTEXT, -1); + } + else if (mt->format == MTEXT_FORMAT_UTF_8) + { + MERROR (MERROR_MTEXT, -1); + } + else if (mt->format <= MTEXT_FORMAT_UTF_16BE) + { + MERROR (MERROR_MTEXT, -1); + } + else + { + MERROR (MERROR_MTEXT, -1); + } + return 0; +} + + int mtext__replace (MText *mt, int from, int to, char *from_str, char *to_str) {