From 4692cf310041e485e1466389ff131f87ec9888de Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 29 Mar 2004 03:56:32 +0000 Subject: [PATCH] (mtext__adjust_foramt): New function. --- src/mtext.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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) { -- 1.7.10.4