--- psiconv/trunk/lib/psiconv/misc.c 2002/01/29 18:38:38 142 +++ 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 @@ -22,6 +22,7 @@ #include #include #include +#include #include "common.h" #ifdef DMALLOC @@ -29,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; }