Skip to content

Commit bedd33f

Browse files
author
Alexander Korotkov
committed
Fix string to 64-bit integer convertion.
1 parent c2638d1 commit bedd33f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/backend/access/transam/slru.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data)
13771377
if ((len == 12 || len == 13 || len == 14) &&
13781378
strspn(clde->d_name, "0123456789ABCDEF") == len)
13791379
{
1380-
segno = strtoq(clde->d_name, NULL, 16);
1380+
segno = pg_strtouint64(clde->d_name, NULL, 16);
13811381
segpage = segno * SLRU_PAGES_PER_SEGMENT;
13821382

13831383
elog(DEBUG2, "SlruScanDirectory invoking callback on %s/%s",

src/bin/pg_upgrade/util.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,13 @@ str2uint(const char *str)
267267
uint64
268268
str2uint64(const char *str)
269269
{
270-
return strtouq(str, NULL, 10);
270+
#ifdef _MSC_VER /* MSVC only */
271+
return _strtoui64(str, NULL, 10);
272+
#elif defined(HAVE_STRTOULL) && SIZEOF_LONG < 8
273+
return strtoull(str, NULL, 10);
274+
#else
275+
return strtoul(str, NULL, 10);
276+
#endif
271277
}
272278

273279

0 commit comments

Comments
 (0)