[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:       Sebastian =?iso-8859-1?q?Tr=FCg?= <trueg () kde ! org>
Date:       2009-08-20 7:48:46
Message-ID: 200908200948.46885.trueg () kde ! org
[Download RAW message or body]

On Thursday 20 August 2009 07:47:54 Thiago Macieira wrote:
> 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.

Well, that's why I used the quotation marks. I did not really think this was a 
fix.

> 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.

Well, I would never use code like that. It is part of libtesseract which is a 
dependency of libmilena which I use in Scribo to detect text in pictures. So I 
would need to tell the tesseract people about their problem.

> 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.

This is for a plugin which can be started at any time in any application. I 
don't think this can be solved then, right? If one needs to set the locale 
before anything major happens then any app using the plugin would need to set 
it. And this would again screw with the whole kde system.

Thus, the way I understand it the only solution is the clean one: fix 
libtesseract.

Thanks for you help. :)

Cheers,
Sebastian

> >--- 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 <<
 
>> 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