summaryrefslogtreecommitdiff
path: root/src/backend/port
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-12-30 19:17:47 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-12-30 19:17:47 +0000
commit4723b2b99bc2d4b52a7c8a047485707aeb643895 (patch)
tree2cf6e7fd3c12a88b540b9bc7f6201a994c261742 /src/backend/port
parenteedfac64ddfb26b08fa658723919db2a611eb2b2 (diff)
downloadpostgresql-4723b2b99bc2d4b52a7c8a047485707aeb643895.tar.gz
Be more careful about the difference between signed and unsigned ints.
Bug is revealed by OID regress test on 64-bit platforms.
Diffstat (limited to 'src/backend/port')
-rw-r--r--src/backend/port/snprintf.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/backend/port/snprintf.c b/src/backend/port/snprintf.c
index dc85c3f681..6cf45ca992 100644
--- a/src/backend/port/snprintf.c
+++ b/src/backend/port/snprintf.c
@@ -74,7 +74,7 @@ typedef unsigned long ulong_long;
* causing nast effects.
**************************************************************/
-/*static char _id[] = "$Id: snprintf.c,v 1.28 2000/12/03 20:45:34 tgl Exp $";*/
+/*static char _id[] = "$Id: snprintf.c,v 1.29 2000/12/30 19:17:47 tgl Exp $";*/
static char *end;
static int SnprfOverflow;
@@ -192,12 +192,12 @@ dopr(char *buffer, const char *format, va_list args)
if (longflag)
{
if (longlongflag)
- value = va_arg(args, long_long);
+ value = va_arg(args, ulong_long);
else
- value = va_arg(args, long);
+ value = va_arg(args, unsigned long);
}
else
- value = va_arg(args, int);
+ value = va_arg(args, unsigned int);
fmtnum(value, 10, 0, ljust, len, zpad);
break;
case 'o':
@@ -206,12 +206,12 @@ dopr(char *buffer, const char *format, va_list args)
if (longflag)
{
if (longlongflag)
- value = va_arg(args, long_long);
+ value = va_arg(args, ulong_long);
else
- value = va_arg(args, long);
+ value = va_arg(args, unsigned long);
}
else
- value = va_arg(args, int);
+ value = va_arg(args, unsigned int);
fmtnum(value, 8, 0, ljust, len, zpad);
break;
case 'd':
@@ -225,31 +225,30 @@ dopr(char *buffer, const char *format, va_list args)
}
else
value = va_arg(args, int);
-
fmtnum(value, 10, 1, ljust, len, zpad);
break;
case 'x':
if (longflag)
{
if (longlongflag)
- value = va_arg(args, long_long);
+ value = va_arg(args, ulong_long);
else
- value = va_arg(args, long);
+ value = va_arg(args, unsigned long);
}
else
- value = va_arg(args, int);
+ value = va_arg(args, unsigned int);
fmtnum(value, 16, 0, ljust, len, zpad);
break;
case 'X':
if (longflag)
{
if (longlongflag)
- value = va_arg(args, long_long);
+ value = va_arg(args, ulong_long);
else
- value = va_arg(args, long);
+ value = va_arg(args, unsigned long);
}
else
- value = va_arg(args, int);
+ value = va_arg(args, unsigned int);
fmtnum(value, -16, 0, ljust, len, zpad);
break;
case 's':