[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Confuse-devel] [PATCH 1/7] confuse: ISO C90 does not support the ‘%lf’
From: |
Carlo Marcelo Arenas Belon |
Subject: |
[Confuse-devel] [PATCH 1/7] confuse: ISO C90 does not support the ‘%lf’ printf format |
Date: |
Sat, 27 Mar 2010 03:08:28 -0700 |
'%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);
--
1.7.0.1
- [Confuse-devel] [PATCH 0/7] trivial compilation fixes for linux., Carlo Marcelo Arenas Belon, 2010/03/27
- [Confuse-devel] [PATCH 1/7] confuse: ISO C90 does not support the ‘%lf’ printf format,
Carlo Marcelo Arenas Belon <=
- [Confuse-devel] [PATCH 3/7] tests: ISO C90 forbids mixed declarations and code, Carlo Marcelo Arenas Belon, 2010/03/27
- [Confuse-devel] [PATCH 5/7] examples: declare source as GNU for strdup definition, Carlo Marcelo Arenas Belon, 2010/03/27
- [Confuse-devel] [PATCH 6/7] tests: declare source as GNU for inet_aton definition, Carlo Marcelo Arenas Belon, 2010/03/27
- [Confuse-devel] [PATCH 4/7] tests: initializer element is not computable at load time, Carlo Marcelo Arenas Belon, 2010/03/27
- [Confuse-devel] [PATCH 2/7] tests: C++ style comments are not allowed in ISO C90, Carlo Marcelo Arenas Belon, 2010/03/27
- [Confuse-devel] [PATCH 7/7] confuse: declare source as GNU for fileno definition and consolidated code, Carlo Marcelo Arenas Belon, 2010/03/27
- Re: [Confuse-devel] [PATCH 0/7] trivial compilation fixes for linux., Martin Hedenfalk, 2010/03/27