]> granicus.if.org Git - postgresql/commitdiff
Fix one overflow and one signedness error, caused by the patch to calculate
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 8 Jul 2011 14:28:27 +0000 (17:28 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 8 Jul 2011 14:29:53 +0000 (17:29 +0300)
OLDSERXID_MAX_PAGE based on BLCKSZ. MSVC compiler warned about these.

src/backend/storage/lmgr/predicate.c

index 3c3a6a9d9633806b0bdabe4d5c1d86b579ac9028..35fbc8f5a2d6c7e278385e5d789fc93d4d9b2e4f 100644 (file)
@@ -311,7 +311,7 @@ static SlruCtlData OldSerXidSlruCtlData;
  * transactions and the maximum that SLRU supports.
  */
 #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)
 
@@ -767,7 +767,7 @@ OldSerXidPagePrecedesLogically(int p, int q)
        diff = p - q;
        if (diff >= ((OLDSERXID_MAX_PAGE + 1) / 2))
                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;
        return diff < 0;
 }