Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Sep 2009 20:14:58 GMT
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 168725 for review
Message-ID:  <200909202014.n8KKEweO012430@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=168725

Change 168725 by gabor@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909202014.n8KKEweO012430>