Review Request: Locale-independent parsing of floats in trader queries

Chusslove Illich caslav.ilic at
Sun Jul 10 08:39:44 BST 2011

This is an automatically generated e-mail. To reply, visit:

(Updated July 10, 2011, 7:39 a.m.)

Review request for kdelibs.


More robust conversion with respect to roundoff effects. Now there is only a
single floating point operation, division by a power of ten (as I've seen
some publicly available implementations do). This adds the restriction that
the float literal must fit into an int when decimal point is removed, but
this should not be a problem for this limited application.


Usage of atof() to parse floats in trader language was locale-dependent:
if locale specified something other than dot as decimal separator,
parsing floats (which are always dot-separated in queries) failed.
Replaced atof() with simple sufficient custom parser.

Added a unit test.

This addresses bug 275548.

Diffs (updated)

  kdecore/services/lex.l b00013b 
  kdecore/tests/kservicetest.h 189bbd4 
  kdecore/tests/kservicetest.cpp 8d14213 



Unit test.

In bug #275548 a plugin could not be loaded in some locales because,
as it turned out, it failed version check due to misparsed floats
in a trader query. This fix makes it load properly.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the kde-core-devel mailing list