1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Further fixing to make pg_size_bytes() portable.

Not all compilers support "long long" and the "LL" integer literal
suffix, so use a cast to int64 instead.
This commit is contained in:
Dean Rasheed
2016-02-20 15:49:26 +00:00
parent ad7cc1c554
commit 740d71842b

View File

@ -813,15 +813,15 @@ pg_size_bytes(PG_FUNCTION_ARGS)
/* Parse the unit case-insensitively */ /* Parse the unit case-insensitively */
if (pg_strcasecmp(strptr, "bytes") == 0) if (pg_strcasecmp(strptr, "bytes") == 0)
multiplier = 1; multiplier = (int64) 1;
else if (pg_strcasecmp(strptr, "kb") == 0) else if (pg_strcasecmp(strptr, "kb") == 0)
multiplier = 1024; multiplier = (int64) 1024;
else if (pg_strcasecmp(strptr, "mb") == 0) else if (pg_strcasecmp(strptr, "mb") == 0)
multiplier = 1024 * 1024; multiplier = (int64) 1024 * 1024;
else if (pg_strcasecmp(strptr, "gb") == 0) else if (pg_strcasecmp(strptr, "gb") == 0)
multiplier = 1024 * 1024 * 1024; multiplier = (int64) 1024 * 1024 * 1024;
else if (pg_strcasecmp(strptr, "tb") == 0) else if (pg_strcasecmp(strptr, "tb") == 0)
multiplier = 1024 * 1024 * 1024 * 1024LL; multiplier = (int64) 1024 * 1024 * 1024 * 1024;
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),