confuse-devel
[Top][All Lists]
Advanced

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

[Confuse-devel] [PATCH 1/4] confuse: ISO C90 does not support the ‘%lf’


From: Carlo Marcelo Arenas Belon
Subject: [Confuse-devel] [PATCH 1/4] confuse: ISO C90 does not support the ‘%lf’ printf format
Date: Sun, 4 Jan 2009 00:09:31 -0800

'%f' is valid for float and double, while '%Lf' is needed for long double
leaving this as a undefined behaviour for C90 and ignored in C99 as shown
by :

  confuse.c:1410: warning: ISO C90 does not support the ‘%lf’ printf format

Signed-off-by: Carlo Marcelo Arenas Belon <address@hidden>
---
 examples/wincfgtest.c |    2 +-
 src/confuse.c         |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/wincfgtest.c b/examples/wincfgtest.c
index 24f6fa5..4a9c1ac 100644
--- a/examples/wincfgtest.c
+++ b/examples/wincfgtest.c
@@ -88,7 +88,7 @@ int main(void)
             if(cfg_parse(cfg, "wincfgtest.conf") == CFG_FILE_ERROR)
                 perror("wincfgtest.conf");
 
-               sprintf(buf, "bool:    %s\nstring:  %s\nnumber:  %ld\nfloat:   
%lf\n",
+               sprintf(buf, "bool:    %s\nstring:  %s\nnumber:  %ld\nfloat:   
%f\n",
                cfg_getbool(cfg, "bool") ? "true" : "false", cfg_getstr(cfg, 
"string"),
                cfg_getint(cfg, "number"), cfg_getfloat(cfg, "float"));
                MessageBox(NULL, buf, "libConfuse", MB_OK);
diff --git a/src/confuse.c b/src/confuse.c
index 003d0b9..6e7a0ef 100644
--- a/src/confuse.c
+++ b/src/confuse.c
@@ -1407,7 +1407,7 @@ DLLIMPORT void cfg_opt_nprint_var(cfg_opt_t *opt, 
unsigned int index, FILE *fp)
             fprintf(fp, "%ld", cfg_opt_getnint(opt, index));
             break;
         case CFGT_FLOAT:
-            fprintf(fp, "%lf", cfg_opt_getnfloat(opt, index));
+            fprintf(fp, "%f", cfg_opt_getnfloat(opt, index));
             break;
         case CFGT_STR:
             str = cfg_opt_getnstr(opt, index);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]