diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2024-11-14 19:35:45 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2024-11-14 19:35:45 +0100 |
commit | df5520aa2dae5b3ce7abf8733dcdd152898af163 (patch) | |
tree | 00d3047bfb14f682bfb5a21010c731ed649bfed7 /app/bin/utf8convert.c | |
parent | df247efec654e512242e4f4f1b0212034f9e01fe (diff) | |
parent | ec3c0f6f6e7153fa797dc57a0e95779cbc63a23b (diff) |
Merge branch 'release/debian/1_5.3.0GA-1'debian/1_5.3.0GA-1
Diffstat (limited to 'app/bin/utf8convert.c')
-rw-r--r-- | app/bin/utf8convert.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/app/bin/utf8convert.c b/app/bin/utf8convert.c index 0573c93..666ac80 100644 --- a/app/bin/utf8convert.c +++ b/app/bin/utf8convert.c @@ -3,33 +3,30 @@ * * UTF8 conversion functions */ - - /* XTrackCad - Model Railroad CAD - * Copyright (C) 2020 Martin Fischer - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -#include <string.h> +/* XTrackCad - Model Railroad CAD + * Copyright (C) 2020 Martin Fischer + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ -#include <wlib.h> -#include "misc.h" +#include "common.h" #include "include/utf8convert.h" /** - * Convert to UTF-8. The string must by a dynamically allocated storage block + * Convert to UTF-8. The string must by a dynamically allocated storage block * allocated with MyMalloc(). The functions returns a pointer to the converted * string. If no conversion was necessary the returned string is identical to * the parameter. Otherwise a new buffer is allocated and returned. @@ -43,9 +40,9 @@ char * Convert2UTF8( char *string ) { if (RequiresConvToUTF8(string)) { - unsigned cnt = strlen(string) * 2 + 2; + size_t cnt = strlen(string) * 2 + 2; unsigned char *out = MyMalloc(cnt); - wSystemToUTF8(string, out, cnt); + wSystemToUTF8(string, out, (unsigned int)cnt); MyFree(string); return(out); } else { @@ -65,9 +62,9 @@ void ConvertUTF8ToSystem(unsigned char *in) { if (wIsUTF8(in)) { - unsigned cnt = strlen(in) * 2 + 1; + size_t cnt = strlen(in) * 2 + 2; unsigned char *out = MyMalloc(cnt); - wUTF8ToSystem(in, out, cnt); + wUTF8ToSystem(in, out, (unsigned int)cnt); strcpy(in, out); MyFree(out); } |