To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=29685


User mkretzschmar changed the following:

                  What    |Old value                 |New value
================================================================================
                    Status|VERIFIED                  |REOPENED
--------------------------------------------------------------------------------
                Resolution|FIXED                     |
--------------------------------------------------------------------------------




------- Additional comments from [EMAIL PROTECTED] Fri May  6 03:55:33 -0700 
2005 -------
The patch doesn't use setlocale correctly. As a result, the old value of
LC_NUMERIC is never restored.

 * setlocale returns the old value only if called with NULL as the second
argument. The patch tries to use "C" as the second argument immediately. That
way, setlocale always returns "C" and not the old value.

 * the result of setlocale must be strdup'ped or similar, the returned string is
not guaranteed to be unchanged during later calls of setlocale.

Here's a demo program that I still had around from debugging a similar problem
in a different app:

[EMAIL PROTECTED]:/tmp$ locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
[EMAIL PROTECTED]:/tmp$ cat test.c
#include <locale.h>
#include <stdio.h>
#include <string.h>

int
main (int argc, char *argv[])
{
        setlocale(LC_ALL, "");
        char *rawLocale = setlocale (LC_NUMERIC, "");
        printf ("LC_NUMERIC: %s\n", rawLocale);
        char *theLocale = strdup (rawLocale);
        printf ("setlocale: %s\n", setlocale (LC_NUMERIC, "C"));
        printf ("rawLocale: %s\n", rawLocale);
        printf ("theLocale: %s\n", theLocale);
        printf ("LC_NUMERIC: %s\n", setlocale (LC_NUMERIC, NULL));
        setlocale (LC_NUMERIC, theLocale);
        printf ("LC_NUMERIC: %s\n", setlocale (LC_NUMERIC, NULL));
        return 0;
}
[EMAIL PROTECTED]:/tmp$ ./test
LC_NUMERIC: de_DE.UTF-8
setlocale: C
rawLocale: \uffff\uffffE.UTF-8
theLocale: de_DE.UTF-8
LC_NUMERIC: C
LC_NUMERIC: de_DE.UTF-8


---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to