--- psiconv/trunk/lib/psiconv/misc.c 2000/12/22 22:31:50 71 +++ psiconv/trunk/lib/psiconv/misc.c 2005/11/15 15:52:34 270 @@ -1,6 +1,6 @@ /* parse_aux.c - Part of psiconv, a PSION 5 file formats converter - Copyright (c) 1999, 2000 Frodo Looijaard + Copyright (c) 1999-2005 Frodo Looijaard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,19 +22,30 @@ #include #include #include +#include #include "common.h" -char *psiconv_make_printable(const char *s) +#ifdef DMALLOC +#include +#endif + + +char *psiconv_make_printable(const psiconv_config config, + const psiconv_string_t input) { int i; - char *res = malloc(strlen(s) + 1); - if (!res) + char *output; + + if (!(output = malloc(sizeof(*output) * + (psiconv_unicode_strlen(input) + 1)))) { return NULL; - for (i = 0; i < strlen(s); i ++) - if (s[i] < 0x20 || s[i] >= 0x7f) - res[i] = '.'; + } + + for (i = 0; i < psiconv_unicode_strlen(input); i ++) + if (input[i] < 0x20 || input[i] >= 0x7f) + output[i] = '.'; else - res[i] = s[i]; - res[strlen(s)] = 0; - return res; + output[i] = input[i]; + output[i] = 0; + return output; }