[gnome-color-manager] Use g_ascii_dtostr() to avoid writing locale-specific floats in PLY files



commit 0af7f4ae7a0058863d50be2e7197bdd9cff22c9b
Author: Richard Hughes <richard hughsie com>
Date:   Thu Apr 18 08:46:49 2013 +0100

    Use g_ascii_dtostr() to avoid writing locale-specific floats in PLY files

 src/gcm-hull.c   | 12 ++++++++----
 src/gcm-viewer.c |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/gcm-hull.c b/src/gcm-hull.c
index 2168787..e38ed82 100644
--- a/src/gcm-hull.c
+++ b/src/gcm-hull.c
@@ -116,6 +116,7 @@ gcm_hull_add_face (GcmHull *hull,
 gchar *
 gcm_hull_export_to_ply (GcmHull *hull)
 {
+       gchar xyz_str[3][G_ASCII_DTOSTR_BUF_SIZE];
        GString *string;
        guint i;
        GcmHullFace *face;
@@ -139,10 +140,13 @@ gcm_hull_export_to_ply (GcmHull *hull)
        for (i=0; i<hull->priv->vertices->len; i++) {
                vertex = g_ptr_array_index (hull->priv->vertices, i);
                cd_color_rgb_to_rgb8 (&vertex->color, &tmp);
-               g_string_append_printf (string, "%lf %lf %lf %i %i %i\n",
-                                       vertex->xyz.X,
-                                       vertex->xyz.Y,
-                                       vertex->xyz.Z,
+               g_ascii_dtostr (xyz_str[0], G_ASCII_DTOSTR_BUF_SIZE, vertex->xyz.X);
+               g_ascii_dtostr (xyz_str[1], G_ASCII_DTOSTR_BUF_SIZE, vertex->xyz.Y);
+               g_ascii_dtostr (xyz_str[2], G_ASCII_DTOSTR_BUF_SIZE, vertex->xyz.Z);
+               g_string_append_printf (string, "%s %s %s %i %i %i\n",
+                                       xyz_str[0],
+                                       xyz_str[1],
+                                       xyz_str[2],
                                        tmp.R,
                                        tmp.G,
                                        tmp.B);
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index 617e780..8e00271 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -1204,7 +1204,7 @@ gcm_viewer_set_profile (GcmViewerPrivate *viewer, CdProfile *profile)
        gtk_widget_set_visible (widget, profile_copyright != NULL);
        if (profile_copyright != NULL) {
                temp = gcm_utils_linkify (profile_copyright);
-               gtk_label_set_label (GTK_LABEL (widget), temp);
+               gtk_label_set_label (GTK_LABEL (widget), profile_copyright);
                g_free (temp);
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]