Skip to content

Commit bb7a3a7

Browse files
committed
Use our own snprintf() only if NLS is enabled, and support %qd and %I64d.
1 parent 70d4a93 commit bb7a3a7

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14527,7 +14527,8 @@ fi
1452714527

1452814528

1452914529
# Force use of our snprintf if system's doesn't do arg control
14530-
if test $pgac_need_repl_snprintf = no; then
14530+
# This feature is used by NLS
14531+
if test "$enable_nls" = yes -a $pgac_need_repl_snprintf = no; then
1453114532
echo "$as_me:$LINENO: checking whether printf supports argument control" >&5
1453214533
echo $ECHO_N "checking whether printf supports argument control... $ECHO_C" >&6
1453314534
if test "${pgac_cv_printf_arg_control+set}" = set; then

configure.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.403 2005/02/28 20:55:18 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.404 2005/03/02 14:48:22 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1067,7 +1067,8 @@ AC_MSG_ERROR([[
10671067

10681068

10691069
# Force use of our snprintf if system's doesn't do arg control
1070-
if test $pgac_need_repl_snprintf = no; then
1070+
# This feature is used by NLS
1071+
if test "$enable_nls" = yes -a $pgac_need_repl_snprintf = no; then
10711072
PGAC_FUNC_PRINTF_ARG_CONTROL
10721073
if test $pgac_cv_printf_arg_control != yes ; then
10731074
pgac_need_repl_snprintf=yes

src/port/snprintf.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
* causing nasty effects.
6666
**************************************************************/
6767

68-
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.12 2005/03/02 05:22:22 momjian Exp $";*/
68+
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.13 2005/03/02 14:48:22 momjian Exp $";*/
6969

7070
int snprintf(char *str, size_t count, const char *fmt,...);
7171
int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
@@ -259,6 +259,23 @@ dopr(char *buffer, const char *format, va_list args, char *end)
259259
else
260260
longflag = 1;
261261
goto nextch;
262+
/*
263+
* We might export this to client apps so we should
264+
* support 'qd' and 'I64d'(MinGW) also in case the
265+
* native version does.
266+
*/
267+
case 'q':
268+
longlongflag = 1;
269+
longflag = 1;
270+
goto nextch;
271+
case 'I':
272+
if (*(format+1) == '6' && *(format+2) == '4')
273+
{
274+
format += 2;
275+
longlongflag = 1;
276+
longflag = 1;
277+
goto nextch;
278+
}
262279
case 'u':
263280
case 'U':
264281
/* fmtnum(value,base,dosign,ljust,len,zpad,&output) */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy