--- psiconv/trunk/lib/psiconv/misc.c 2003/11/26 20:56:17 171 +++ psiconv/trunk/lib/psiconv/misc.c 2014/10/22 19:53:40 351 @@ -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-2014 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 @@ -30,17 +30,22 @@ #endif -char *psiconv_make_printable(const char *s) +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; }