mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Fix one overflow and one signedness error, caused by the patch to calculate
OLDSERXID_MAX_PAGE based on BLCKSZ. MSVC compiler warned about these.
This commit is contained in:
parent
7544064b15
commit
9598afa3b0
@ -311,7 +311,7 @@ static SlruCtlData OldSerXidSlruCtlData;
|
|||||||
* transactions and the maximum that SLRU supports.
|
* transactions and the maximum that SLRU supports.
|
||||||
*/
|
*/
|
||||||
#define OLDSERXID_MAX_PAGE Min(SLRU_PAGES_PER_SEGMENT * 0x10000 - 1, \
|
#define OLDSERXID_MAX_PAGE Min(SLRU_PAGES_PER_SEGMENT * 0x10000 - 1, \
|
||||||
(MaxTransactionId + 1) / OLDSERXID_ENTRIESPERPAGE - 1)
|
(MaxTransactionId) / OLDSERXID_ENTRIESPERPAGE)
|
||||||
|
|
||||||
#define OldSerXidNextPage(page) (((page) >= OLDSERXID_MAX_PAGE) ? 0 : (page) + 1)
|
#define OldSerXidNextPage(page) (((page) >= OLDSERXID_MAX_PAGE) ? 0 : (page) + 1)
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ OldSerXidPagePrecedesLogically(int p, int q)
|
|||||||
diff = p - q;
|
diff = p - q;
|
||||||
if (diff >= ((OLDSERXID_MAX_PAGE + 1) / 2))
|
if (diff >= ((OLDSERXID_MAX_PAGE + 1) / 2))
|
||||||
diff -= OLDSERXID_MAX_PAGE + 1;
|
diff -= OLDSERXID_MAX_PAGE + 1;
|
||||||
else if (diff < -((OLDSERXID_MAX_PAGE + 1) / 2))
|
else if (diff < -((int) (OLDSERXID_MAX_PAGE + 1) / 2))
|
||||||
diff += OLDSERXID_MAX_PAGE + 1;
|
diff += OLDSERXID_MAX_PAGE + 1;
|
||||||
return diff < 0;
|
return diff < 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user