Displaying 2 results from an estimated 2 matches for "utf8_from_wchar".
2014 Aug 08
1
[PATCH] for win_utf8_io.c
...ason. If there is an
> error in string conversion there's no point in continuing the operation.
> All conversions are discarded if something failed so not exiting from
> the loop is wasted effort.
Here is the current code:
ret = 0;
for (i=0; i<wargc; i++) {
if ((utf8argv[i] = utf8_from_wchar(wargv[i])) == NULL) {
ret = 1;
break;
}
if (ret != 0) break;
}
I cannot see how the second break can happen.
If utf8argv[i] != NULL then ret == 0; if utf8argv[i] == NULL then the first
break exits the for(i=...) loop.
2014 Aug 08
4
[PATCH] for win_utf8_io.c
For better readability the patch is divided by 3 parts.
Part #1: for a bit better security replace
vsprintf(utmp, format, argptr)
with
vsnprintf_s(utmp, 32768, _TRUNCATE, format, argptr)
Part #2: potential memleak fixed: utf8argv[i] are not freed
when utf8argv itself is freed.
Part #3: 'if (ret != 0) break;' line seems redundant.
-------------- next part --------------
A