After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 461804 - don't use setlocale
don't use setlocale
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
0.x.x [obsolete]
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-07-30 13:37 UTC by Christian Persch
Modified: 2008-07-24 13:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (3.90 KB, patch)
2007-07-30 14:15 UTC, Christian Persch
none Details | Review
fix initialisation (3.91 KB, patch)
2007-07-31 10:05 UTC, Christian Persch
none Details | Review
updated patch (3.64 KB, patch)
2008-05-19 10:33 UTC, Cosimo Cecchi
committed Details | Review

Description Christian Persch 2007-07-30 13:37:22 UTC
Nautilus uses setlocale (LC_NUMERIC, "C") to temporarily switch locale just to printf a float. It should use g_ascii_dtostr instead!
Comment 1 Christian Persch 2007-07-30 14:15:09 UTC
Created attachment 92705 [details] [review]
patch

use g_ascii_dtostr/strtod and g_ascii_strtoll, instead of fiddling with the locale.
Comment 2 Martin Wehner 2007-07-30 23:39:57 UTC
What I don't get about this: why is position_good not flagged as being potentially uninitialized by gcc? What am I missing?
Comment 3 Christian Persch 2007-07-31 10:05:18 UTC
Created attachment 92780 [details] [review]
fix initialisation

You're right, it was being used uninitialised; the new patch fixes that.
Comment 4 Martin Wehner 2007-08-13 23:02:16 UTC
Comment on attachment 92780 [details] [review]
fix initialisation

Sorry, I just noticed another thing: Why are you replacing the position sscanf() at all? Like the comment states, the whole locale radix thingy is just about floats, isn't it?
Comment 5 Christian Persch 2007-08-15 21:28:39 UTC
Hmm right, maybe the scanf parts of the patch aren't needed.
Comment 6 Cosimo Cecchi 2008-05-19 10:33:58 UTC
Created attachment 111147 [details] [review]
updated patch

Patch updated with the comments from Martin.
Comment 7 Cosimo Cecchi 2008-07-24 13:26:04 UTC
Committed to trunk.

2008-07-24  Cosimo Cecchi  <cosimoc@gnome.org>

	* src/file-manager/fm-icon-view.c:
	(get_stored_icon_position_callback),
	(icon_position_changed_callback):
	Don't use setlocale () just to printf a float, but use
	g_ascii_dtostr () instead.
	Initial patch by Christian Persch (#461804).