%f in galaktos (Closes:#585)
authorClément Stenac <zorglub@videolan.org>
Sat, 18 Mar 2006 12:38:38 +0000 (12:38 +0000)
committerClément Stenac <zorglub@videolan.org>
Sat, 18 Mar 2006 12:38:38 +0000 (12:38 +0000)
modules/visualization/galaktos/init_cond.c
modules/visualization/galaktos/preset.c

index 7653447..1f76668 100644 (file)
@@ -22,7 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-
+#include <vlc/vlc.h>
 
 /* Library functions to manipulate initial condition values */
 
@@ -115,6 +115,7 @@ void init_cond_to_string(init_cond_t * init_cond) {
 
        /* Create a string "param_name=val" */
        switch (init_cond->param->type) {
+                lldiv_t div;
                
                case P_TYPE_BOOL:
                        sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.bool_val);
@@ -123,7 +124,9 @@ void init_cond_to_string(init_cond_t * init_cond) {
                        sprintf(string, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val);
                        break;
                case P_TYPE_DOUBLE:
-                       sprintf(string, "%s=%f\n", init_cond->param->name, init_cond->init_val.double_val);
+                        div = lldiv( init_cond->init_val.double_val * 1000000,
+                                     1000000 );
+                       sprintf(string, "%s="I64Fd".%06u\n", init_cond->param->name, div.quot, (unsigned int) div.rem );
                        break;
                default:
                        return;
index 7620d5f..eff43d6 100644 (file)
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include <vlc/vlc.h>
 
 
 #include <stdio.h>
@@ -886,15 +887,19 @@ void write_init(init_cond_t * init_cond) {
     sprintf(s, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val);
 
   else if (init_cond->param->type == P_TYPE_DOUBLE)
-    sprintf(s, "%s=%f\n", init_cond->param->name, init_cond->init_val.double_val);
+  {
+    lldiv_t div = lldiv( init_cond->init_val.double_val * 1000000,1000000 );
+    sprintf(s, "%s="I64Fd".%06u\n", init_cond->param->name, div.quot,
+                    (unsigned int) div.rem );
+  }
 
   else { printf("write_init: unknown parameter type!\n"); return; }
-  
+
   len = strlen(s);
 
   if ((fwrite(s, 1, len, write_stream)) != len)
     printf("write_init: failed writing to file stream! Out of disk space?\n");
-  
+
 }