summaryrefslogtreecommitdiffstats
path: root/utf8.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2009-11-16 22:05:28 -0800
committerKaz Kylheku <kaz@kylheku.com>2009-11-16 22:05:28 -0800
commit3a6c04927b4136a195b0bc259f50caf8249dfced (patch)
treed8972160fe49f6ccb60ea868a0af2fdd4d60845e /utf8.c
parentfb2f0af8bd14283524e5842b43461ea3fc7701ca (diff)
downloadtxr-3a6c04927b4136a195b0bc259f50caf8249dfced.tar.gz
txr-3a6c04927b4136a195b0bc259f50caf8249dfced.tar.bz2
txr-3a6c04927b4136a195b0bc259f50caf8249dfced.zip
Big round of changes to switch the code base to use the stream
abstraction instead of directly using C standard I/O, to eliminate most uses of C formatted I/O, and fix numerous bugs, such variadic argument lists which lack a terminating ``nao'' sentinel. Bug 28033 is addressed by this patch, since streams no longer provide printf-compatible formatting. The native formatter is extended with some additional capabilities to take over. The work on literal objects is expanded and they are now used throughout the code base. Fixed bad realloc in string output stream: reallocating by number of wide chars rather than bytes.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/utf8.c b/utf8.c
index 5936e43a..46b1feae 100644
--- a/utf8.c
+++ b/utf8.c
@@ -153,7 +153,7 @@ size_t utf8_to(char *dst, const wchar_t *wsrc)
wchar_t *utf8_dup_from_uc(const unsigned char *str)
{
size_t nchar = utf8_from_uc(0, str);
- wchar_t *wstr = chk_malloc(sizeof *wstr * nchar);
+ wchar_t *wstr = (wchar_t *) chk_malloc(nchar * sizeof *wstr);
utf8_from_uc(wstr, str);
return wstr;
}
@@ -161,7 +161,7 @@ wchar_t *utf8_dup_from_uc(const unsigned char *str)
wchar_t *utf8_dup_from(const char *str)
{
size_t nchar = utf8_from(0, str);
- wchar_t *wstr = chk_malloc(sizeof *wstr * nchar);
+ wchar_t *wstr = (wchar_t *) chk_malloc(nchar * sizeof *wstr);
utf8_from(wstr, str);
return wstr;
}
@@ -169,7 +169,7 @@ wchar_t *utf8_dup_from(const char *str)
unsigned char *utf8_dup_to_uc(const wchar_t *wstr)
{
size_t nbyte = utf8_to_uc(0, wstr);
- unsigned char *str = chk_malloc(nbyte);
+ unsigned char *str = (unsigned char *) chk_malloc(nbyte);
utf8_to_uc(str, wstr);
return str;
}
@@ -177,7 +177,7 @@ unsigned char *utf8_dup_to_uc(const wchar_t *wstr)
char *utf8_dup_to(const wchar_t *wstr)
{
size_t nbyte = utf8_to(0, wstr);
- char *str = chk_malloc(nbyte);
+ char *str = (char *) chk_malloc(nbyte);
utf8_to(str, wstr);
return str;
}