Rick,

This seems the proper patch to me.  (It also seems we have a bug there
with removing a trailing decimal.)  The test suite runs without
errors, but I've only run it on Windows:

Index: interpreter/classes/StringClass.cpp
===================================================================
--- interpreter/classes/StringClass.cpp (revision 4329)
+++ interpreter/classes/StringClass.cpp (working copy)
@@ -2009,14 +2009,14 @@
     {
         char buffer[64];
         // format as a string
-        gcvt(number, (int)precision, buffer);
+        sprintf(buffer, "%.*f", (int)precision, number);
         size_t len = strlen(buffer);
         // if the last character is a decimal, we remove that
         if (buffer[len - 1] == '.')
         {
             len--;
         }
-        return new_string(buffer);
+        return new_string(buffer, len);
     }
 }

Since we know the length, new_string(buffer, len) is better than
explicitly putting '\0' at len -1 isn't it?  Or does that end up with
the string not having a trailing null when it should have?  Should it
be:

        // if the last character is a decimal, we remove that
        if (buffer[len - 1] == '.')
        {
            buffer[len - 1] = '\0';
        }
        return new_string(buffer);

instead?

--
Mark Miesfeld

------------------------------------------------------------------------------
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to