Author: piumarta
Date: 2011-04-27 18:16:17 -0700 (Wed, 27 Apr 2011)
New Revision: 2383
Modified:
trunk/platforms/unix/ChangeLog
trunk/platforms/unix/plugins/LocalePlugin/sqUnixLocale.c
Log:
do not copy trailing NUL from C to Squeak strings
Modified: trunk/platforms/unix/ChangeLog
===================================================================
--- trunk/platforms/unix/ChangeLog 2011-04-27 18:23:43 UTC (rev 2382)
+++ trunk/platforms/unix/ChangeLog 2011-04-28 01:16:17 UTC (rev 2383)
@@ -1,3 +1,8 @@
+2011-04-28 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)>
+
+ * plugins/LocalePlugin/sqUnixLocale.c: Do not copy trailing NUL
+ from C to Squeak strings.
+
2011-03-31 Ian Piumarta <
[hidden email]>
* vm/sqUnixExternalPrims.c: Resolve symbols eagerly on FreeBSD.
Modified: trunk/platforms/unix/plugins/LocalePlugin/sqUnixLocale.c
===================================================================
--- trunk/platforms/unix/plugins/LocalePlugin/sqUnixLocale.c 2011-04-27 18:23:43 UTC (rev 2382)
+++ trunk/platforms/unix/plugins/LocalePlugin/sqUnixLocale.c 2011-04-28 01:16:17 UTC (rev 2383)
@@ -27,7 +27,7 @@
/* Author:
[hidden email]
*
- * Last edited: 2008-11-10 13:25:18 by piumarta on ubuntu.piumarta.com
+ * Last edited: 2011-04-28 10:11:02 by piumarta on 192.168.1.11
*/
#include "sq.h"
@@ -62,6 +62,12 @@
static struct lconv *localeConv= 0;
+static void safestrcpy(char *dst, const char *src)
+{
+ memcpy(dst, src, strlen(src));
+}
+
+
/*** SUNDRY STUPIDITY ***/
@@ -612,7 +618,7 @@
*/
void sqLocGetCurrencySymbolInto(char *str)
{
- strcpy(str, localeConv->currency_symbol);
+ safestrcpy(str, localeConv->currency_symbol);
}
sqInt sqLocCurrencySymbolSize(void)
@@ -637,7 +643,7 @@
*/
void sqLocGetDigitGroupingSymbolInto(char *str)
{
- strcpy(str, localeConv->thousands_sep);
+ safestrcpy(str, localeConv->thousands_sep);
}
@@ -645,7 +651,7 @@
*/
void sqLocGetDecimalSymbolInto(char *str)
{
- strcpy(str, localeConv->decimal_point);
+ safestrcpy(str, localeConv->decimal_point);
}
@@ -698,7 +704,7 @@
*/
void sqLocGetLongDateFormatInto(char *str)
{
- strcpy(str, nl_langinfo(D_FMT));
+ safestrcpy(str, nl_langinfo(D_FMT));
}
/* Answer the number of characters in the short date format.
@@ -712,7 +718,7 @@
*/
void sqLocGetShortDateFormatInto(char *str)
{
- strcpy(str, nl_langinfo(D_FMT));
+ safestrcpy(str, nl_langinfo(D_FMT));
}
/* Answer the number of characters in the time format.
@@ -726,7 +732,7 @@
*/
void sqLocGetTimeFormatInto(char *str)
{
- strcpy(str, nl_langinfo(T_FMT));
+ safestrcpy(str, nl_langinfo(T_FMT));
}
@@ -741,11 +747,11 @@
void sqLocGetCountryInto(char * str)
{
- strcpy(str, getCountry());
+ safestrcpy(str, getCountry());
}
void sqLocGetLanguageInto(char * str)
{
- strcpy(str, getLanguage());
+ safestrcpy(str, getLanguage());
}