1
1
/* -----------------------------------------------------------------------
2
2
* formatting.c
3
3
*
4
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.45 2001/11/19 09:05:01 tgl Exp $
4
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.46 2001/12/05 02:06:19 ishii Exp $
5
5
*
6
6
*
7
7
* Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
@@ -4140,7 +4140,10 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
4140
4140
Np -> inout_p += strlen (Np -> inout_p ) - 1 ;
4141
4141
}
4142
4142
else
4143
- Np -> inout_p += sprintf (Np -> inout_p , "%15s" , Np -> number_p ) - 1 ;
4143
+ {
4144
+ sprintf (Np -> inout_p , "%15s" , Np -> number_p );
4145
+ Np -> inout_p += strlen (Np -> inout_p ) - 1 ;
4146
+ }
4144
4147
break ;
4145
4148
4146
4149
case NUM_rn :
@@ -4150,7 +4153,10 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
4150
4153
Np -> inout_p += strlen (Np -> inout_p ) - 1 ;
4151
4154
}
4152
4155
else
4153
- Np -> inout_p += sprintf (Np -> inout_p , "%15s" , str_tolower (Np -> number_p )) - 1 ;
4156
+ {
4157
+ sprintf (Np -> inout_p , "%15s" , str_tolower (Np -> number_p ));
4158
+ Np -> inout_p += strlen (Np -> inout_p ) - 1 ;
4159
+ }
4154
4160
break ;
4155
4161
4156
4162
case NUM_th :
@@ -4664,7 +4670,8 @@ float4_to_char(PG_FUNCTION_ARGS)
4664
4670
}
4665
4671
4666
4672
orgnum = (char * ) palloc (MAXFLOATWIDTH + 1 );
4667
- len = sprintf (orgnum , "%.0f" , fabs (val ));
4673
+ sprintf (orgnum , "%.0f" , fabs (val ));
4674
+ len = strlen (orgnum );
4668
4675
if (Num .pre > len )
4669
4676
plen = Num .pre - len ;
4670
4677
if (len >= FLT_DIG )
0 commit comments