On Thu, 24 Nov 2022 at 08:44, Andrew Dunstan <and...@dunslane.net> wrote:
> Expand AclMode to 64 bits

I noticed this causes a few new warnings on MSVC:

acl.c(629): warning C4334: '<<': result of 32-bit shift implicitly
converted to 64 bits (was 64-bit shift intended?)
acl.c(631): warning C4334: '<<': result of 32-bit shift implicitly
converted to 64 bits (was 64-bit shift intended?)
acl.c(1789): warning C4334: '<<': result of 32-bit shift implicitly
converted to 64 bits (was 64-bit shift intended?)

The attached fixes. I'll push this shortly.

David
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index d4d68f9724..f8eedfe170 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -626,9 +626,9 @@ aclitemout(PG_FUNCTION_ARGS)
 
        for (i = 0; i < N_ACL_RIGHTS; ++i)
        {
-               if (ACLITEM_GET_PRIVS(*aip) & (1 << i))
+               if (ACLITEM_GET_PRIVS(*aip) & (UINT64CONST(1) << i))
                        *p++ = ACL_ALL_RIGHTS_STR[i];
-               if (ACLITEM_GET_GOPTIONS(*aip) & (1 << i))
+               if (ACLITEM_GET_GOPTIONS(*aip) & (UINT64CONST(1) << i))
                        *p++ = '*';
        }
 
@@ -1786,7 +1786,7 @@ aclexplode(PG_FUNCTION_ARGS)
                                break;
                }
                aidata = &aidat[idx[0]];
-               priv_bit = 1 << idx[1];
+               priv_bit = UINT64CONST(1) << idx[1];
 
                if (ACLITEM_GET_PRIVS(*aidata) & priv_bit)
                {

Reply via email to