Fixed a number of warnings.
[pspp-builds.git] / src / ui / gui / psppire-data-store.c
index 0cb719046eab964b9a78dc584c628735019979da..cdd000b3fbed2f147282111c9a78ee51378c03bb 100644 (file)
@@ -48,7 +48,7 @@ static void psppire_data_store_sheet_model_init (GSheetModelIface *iface);
 static void psppire_data_store_sheet_column_init (GSheetColumnIface *iface);
 static void psppire_data_store_finalize        (GObject           *object);
 
-static const gchar *const psppire_data_store_get_string(GSheetModel *sheet_model, gint row, gint column);
+static const gchar *psppire_data_store_get_string(GSheetModel *sheet_model, gint row, gint column);
 
 static gboolean psppire_data_store_set_string(GSheetModel *model, 
                                          const gchar *text, gint row, gint column);
@@ -326,7 +326,7 @@ psppire_data_store_finalize (GObject *object)
 }
 
 
-static const gchar *const 
+static const gchar *
 psppire_data_store_get_string(GSheetModel *model, gint row, gint column)
 {
 
@@ -364,13 +364,18 @@ psppire_data_store_get_string(GSheetModel *model, gint row, gint column)
 
   fp = psppire_variable_get_write_spec(pv);
 
-  s = g_string_sized_new (fp->w);
+  s = g_string_sized_new (fp->w + 1);
+  g_string_set_size(s, fp->w);
+  
+  memset(s->str, 0, fp->w);
+
+  g_assert(fp->w == s->len);
     
   /* Converts binary value V into printable form in the exactly
      FP->W character in buffer S according to format specification
      FP.  No null terminator is appended to the buffer.  */
   data_out (s->str, fp, v);
-
+  
   return g_string_free(s, FALSE);
 #if 0
   {