Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e472f13

Browse files
committed
Better fix for determining minimum and maximum int64 values that doesn't
require stdint.h and works for "busted" int64.
1 parent 8d2b05d commit e472f13

File tree

1 file changed

+3
-6
lines changed
  • src/backend/utils/adt

1 file changed

+3
-6
lines changed

src/backend/utils/adt/xml.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.30 2007/02/16 10:42:31 petere Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.31 2007/02/16 18:37:43 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -40,10 +40,6 @@
4040

4141
#include "postgres.h"
4242

43-
#ifdef HAVE_STDINT_H
44-
#include <stdint.h>
45-
#endif
46-
4743
#ifdef USE_LIBXML
4844
#include <libxml/chvalid.h>
4945
#include <libxml/parser.h>
@@ -2189,7 +2185,8 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
21892185
" <xsd:maxInclusive value=\"" INT64_FORMAT "\"/>\n"
21902186
" <xsd:minInclusive value=\"" INT64_FORMAT "\"/>\n"
21912187
" </xsd:restriction>\n",
2192-
INT64_MAX, INT64_MIN);
2188+
-((INT64CONST(1) << (sizeof(int64) * 8 - 1)) + 1),
2189+
(INT64CONST(1) << (sizeof(int64) * 8 - 1)));
21932190
break;
21942191

21952192
case FLOAT4OID:

0 commit comments

Comments
 (0)