Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc6e8464

Browse files
committed
printf("%lf") is not portable, so omit the "l".
The "l" (ell) width spec means something in the corresponding scanf usage,but not here. While modern POSIX says that applying "l" to "f" and otherfloating format specs is a no-op, SUSv2 says it's undefined. Buildfarmexperience says that some old compilers emit warnings about it, and atleast one old stdio implementation (mingw's "ANSI" option) actuallyproduces wrong answers and/or crashes.Discussion:https://postgr.es/m/21670.1526769114@sss.pgh.pa.usDiscussion:https://postgr.es/m/c085e1da-0d64-1c15-242d-c921f32e0d5c@dunslane.net
1 parente7a808f commitc6e8464

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

‎contrib/pageinspect/btreefuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ bt_metap(PG_FUNCTION_ARGS)
563563
if (metad->btm_version==BTREE_VERSION)
564564
{
565565
values[j++]=psprintf("%u",metad->btm_oldest_btpo_xact);
566-
values[j++]=psprintf("%lf",metad->btm_last_cleanup_num_heap_tuples);
566+
values[j++]=psprintf("%f",metad->btm_last_cleanup_num_heap_tuples);
567567
}
568568
else
569569
{

‎doc/src/sgml/ecpg.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,7 @@ while (1)
16781678
<para>
16791679
Here is an example using the data type <type>complex</type> from
16801680
the example in <xref linkend="xtypes"/>. The external string
1681-
representation of that type is <literal>(%lf,%lf)</literal>,
1681+
representation of that type is <literal>(%f,%f)</literal>,
16821682
which is defined in the
16831683
functions <function>complex_in()</function>
16841684
and <function>complex_out()</function> functions

‎src/backend/access/rmgrdesc/nbtdesc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ btree_desc(StringInfo buf, XLogReaderState *record)
100100
{
101101
xl_btree_metadata*xlrec= (xl_btree_metadata*)rec;
102102

103-
appendStringInfo(buf,"oldest_btpo_xact %u; last_cleanup_num_heap_tuples: %lf",
103+
appendStringInfo(buf,"oldest_btpo_xact %u; last_cleanup_num_heap_tuples: %f",
104104
xlrec->oldest_btpo_xact,
105105
xlrec->last_cleanup_num_heap_tuples);
106106
break;

‎src/interfaces/ecpg/test/compat_informix/sqlda.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dump_sqlda(sqlda_t *sqlda)
3737
printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
3838
break;
3939
case SQLFLOAT:
40-
printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
40+
printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
4141
break;
4242
case SQLDECIMAL:
4343
{

‎src/interfaces/ecpg/test/expected/compat_informix-sqlda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ dump_sqlda(sqlda_t *sqlda)
142142
printf("name sqlda descriptor: '%s' value %d\n",sqlda->sqlvar[i].sqlname,*(int*)sqlda->sqlvar[i].sqldata);
143143
break;
144144
caseSQLFLOAT:
145-
printf("name sqlda descriptor: '%s' value %lf\n",sqlda->sqlvar[i].sqlname,*(double*)sqlda->sqlvar[i].sqldata);
145+
printf("name sqlda descriptor: '%s' value %f\n",sqlda->sqlvar[i].sqlname,*(double*)sqlda->sqlvar[i].sqldata);
146146
break;
147147
caseSQLDECIMAL:
148148
{

‎src/interfaces/ecpg/test/expected/preproc-outofscope.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ if (sqlca.sqlcode < 0) exit (1);}
337337
get_record1();
338338
if (sqlca.sqlcode==ECPG_NOT_FOUND)
339339
break;
340-
printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
340+
printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n",
341341
myvar->id,mynullvar->id ?" (NULL)" :"",
342342
myvar->t,mynullvar->t ?" (NULL)" :"",
343343
myvar->d1,mynullvar->d1 ?" (NULL)" :"",

‎src/interfaces/ecpg/test/expected/sql-sqlda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ dump_sqlda(sqlda_t *sqlda)
158158
break;
159159
#endif
160160
caseECPGt_double:
161-
printf("name sqlda descriptor: '%s' value %lf\n",sqlda->sqlvar[i].sqlname.data,*(double*)sqlda->sqlvar[i].sqldata);
161+
printf("name sqlda descriptor: '%s' value %f\n",sqlda->sqlvar[i].sqlname.data,*(double*)sqlda->sqlvar[i].sqldata);
162162
break;
163163
caseECPGt_numeric:
164164
{

‎src/interfaces/ecpg/test/preproc/outofscope.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ main (void)
101101
get_record1();
102102
if (sqlca.sqlcode == ECPG_NOT_FOUND)
103103
break;
104-
printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
104+
printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n",
105105
myvar->id, mynullvar->id ? " (NULL)" : "",
106106
myvar->t, mynullvar->t ? " (NULL)" : "",
107107
myvar->d1, mynullvar->d1 ? " (NULL)" : "",

‎src/interfaces/ecpg/test/sql/sqlda.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dump_sqlda(sqlda_t *sqlda)
4545
break;
4646
#endif
4747
case ECPGt_double:
48-
printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
48+
printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
4949
break;
5050
case ECPGt_numeric:
5151
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp