PERFORCE change 168725 for review
Gabor Kovesdan
gabor at FreeBSD.org
Sun Sep 20 20:14:59 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=168725
Change 168725 by gabor at gabor_server on 2009/09/20 20:14:53
- Fix mbs -> wcs conversion in month sort routine
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/newsort/coll.c#7 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/newsort/coll.c#7 (text+ko) ====
@@ -338,8 +338,12 @@
for (int i = 0; i < 12; i++) {
tmp = nl_langinfo(item[i]);
len = strlen(tmp);
- m = sort_malloc(sizeof(wint_t) * (len + 1));
- mbstowcs(m, tmp, len);
+ m = sort_malloc((len + 1) * sizeof(wint_t));
+ if (mbstowcs(m, tmp, len) == ((size_t)-1)) {
+ months[i] = NULL;
+ continue;
+ }
+ m[len] = L'\0';
for (int j = 0; j < len; j++)
m[j] = towlower(m[j]);
months[i] = m;
More information about the p4-projects
mailing list