[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Desperate in need of help: Very very weird problem with sscanf
From: Thiago Macieira <thiago () kde ! org>
Date: 2009-08-20 5:47:54
Message-ID: 200908200748.03370.thiago () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (Text/Plain)]
Sebastian Trüg wrote:
>On Wednesday 19 August 2009 17:21:26 Rafael Fernández López wrote:
>> Hi,
>>
>> > I am having a look at it. It doesn't seem to be libnepomuk, but
>> > libkdecore.
>>
>> Pretty strange. My only guess at the moment is that in kdecore there
>> could be a static symbol (or extern) defined with the same name as
>> some symbol used by sscanf (and being initializated on declaration)...
>>
>> I am curious about this issue... If someone finds something, please
>> step forward ;) /me is still having a look though
>
>The following patch "fixes" the issue. I do not know enough about
> locales to make an informed decision about a real solution.
Well, it actually *hides* the issue.
The code you commented out is correct.
The problem is that Sebastian's code is using a locale-dependent function
(sscanf) with a C-locale-encoded string. Sorry, that won't work.
You need to either find a function that is locale-independent or you need
to encode your strings with the locale decimal-separator. Note that it can
change in time, since users may change locales.
Another alternative is to change the libc locale via setlocale(3) but note
that it's a global change, affecting all threads. Make sure you never run
that once the app is up and running.
>--- kdecore/localization/kcatalog.cpp (revision 1013365)
>+++ kdecore/localization/kcatalog.cpp (working copy)
>@@ -45,7 +45,7 @@
> s_localeSet = true;
> return 1;
> }
>-Q_CONSTRUCTOR_FUNCTION(kInitializeLocale)
>+//Q_CONSTRUCTOR_FUNCTION(kInitializeLocale)
>
> // not defined on win32 :(
> #ifdef _WIN32
>
>Apparently LC_ALL is reset once kdecore is loaded.
>
>Cheers,
>Sebastian
>
>>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
>>> unsubscribe <<
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4
http://qt.nokia.com/qtdevdays2009
["signature.asc" (application/pgp-signature)]
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic