SmallInteger.st
branchjv
changeset 17732 a1892eeca6c0
parent 17728 bbc5fa73dfab
child 17735 6a5bc05f696a
--- a/SmallInteger.st	Fri Aug 28 12:38:51 2009 +0100
+++ b/SmallInteger.st	Sat Oct 24 16:48:19 2009 +0100
@@ -3606,7 +3606,9 @@
      Notice that a conversion may not be portable; for example,
      to correctly convert an int on a 64-bit alpha, a %ld is required,
      while other systems may be happy with a %d ...
-     Use at your own risk (if at all)"
+     Use at your own risk (if at all).
+     WARNNG: this goes directly to the C-printf function and may therefore me inherently unsafe.
+     Please use the printf: method, which is safe as it is completely implemented in Smalltalk."
 
 %{  /* STACK: 400 */
     char buffer[256];
@@ -3614,34 +3616,34 @@
     int len;
 
     if (__isString(formatString)) {
-	/*
-	 * actually only needed on sparc: since thisContext is
-	 * in a global register, which gets destroyed by printf,
-	 * manually save it here - very stupid ...
-	 */
-	__BEGIN_PROTECT_REGISTERS__
-
-	len = snprintf(buffer, sizeof(buffer), __stringVal(formatString), __intVal(self));
-
-	__END_PROTECT_REGISTERS__
-
-	if (len < 0) goto fail;
-
-	s = __MKSTRING_L(buffer, len);
-	if (s != nil) {
-	    RETURN (s);
-	}
+        /*
+         * actually only needed on sparc: since thisContext is
+         * in a global register, which gets destroyed by printf,
+         * manually save it here - very stupid ...
+         */
+        __BEGIN_PROTECT_REGISTERS__
+
+        len = snprintf(buffer, sizeof(buffer), __stringVal(formatString), __intVal(self));
+
+        __END_PROTECT_REGISTERS__
+
+        if (len < 0) goto fail;
+
+        s = __MKSTRING_L(buffer, len);
+        if (s != nil) {
+            RETURN (s);
+        }
     }
 fail: ;
 %}.
     self primitiveFailed
 
     "
-	123 printfPrintString:'%%d -> %d'
-	123 printfPrintString:'%%6d -> %6d'
-	123 printfPrintString:'%%x -> %x'
-	123 printfPrintString:'%%4x -> %4x'
-	123 printfPrintString:'%%04x -> %04x'
+        123 printfPrintString:'%%d -> %d'
+        123 printfPrintString:'%%6d -> %6d'
+        123 printfPrintString:'%%x -> %x'
+        123 printfPrintString:'%%4x -> %4x'
+        123 printfPrintString:'%%04x -> %04x'
     "
 ! !
 
@@ -3788,5 +3790,6 @@
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Id: SmallInteger.st 10467 2009-08-19 16:14:36Z vranyj1 $'
+    ^ '$Id: SmallInteger.st 10473 2009-10-24 15:48:19Z vranyj1 $'
 ! !
+