[PATCH] pathencode: eliminate signed integer warnings

Danek Duvall danek.duvall at oracle.com
Wed Feb 19 15:16:31 CST 2014


# HG changeset patch
# User Danek Duvall <danek.duvall at oracle.com>
# Date 1392844284 28800
#      Wed Feb 19 13:11:24 2014 -0800
# Node ID ad3388693673ef87a4368cb00a14b4a858c37b72
# Parent  0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd
pathencode: eliminate signed integer warnings

Compiling mercurial with the Sun Studio compiler gives seven copies of the
following warning on pathencode.c:

    line 533: warning: initializer will be sign-extended: -1

Using explicit unsigned literals silences it.

diff --git a/mercurial/pathencode.c b/mercurial/pathencode.c
--- a/mercurial/pathencode.c
+++ b/mercurial/pathencode.c
@@ -530,7 +530,7 @@ static Py_ssize_t auxencode(char *dest, 
 	static const uint32_t twobytes[8];
 
 	static const uint32_t onebyte[8] = {
-		~0, 0xffff3ffe, ~0, ~0, ~0, ~0, ~0, ~0,
+		~0U, 0xffff3ffe, ~0U, ~0U, ~0U, ~0U, ~0U, ~0U,
 	};
 
 	return _encode(twobytes, onebyte, dest, 0, destsize, src, len, 0);


More information about the Mercurial-devel mailing list