Patchwork D12374: revlog: fix wrong type of rank_unknown variable

login
register
mail settings
Submitter phabricator
Date March 14, 2022, 5:01 p.m.
Message ID <differential-rev-PHID-DREV-vlluytkk2qrexrn7effg-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50718/
State New
Headers show

Comments

phabricator - March 14, 2022, 5:01 p.m.
jcristau created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We treat "rank" as an int everywhere, but declare rank_unknown as a
  char.  On architectures where char is signed, that works out ok, but
  when char is unsigned, rank_unknown is 255 instead of -1.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D12374

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS




To: jcristau, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -179,7 +179,7 @@ 
 /* next free offset: 73 */
 
 static const char comp_mode_inline = 2;
-static const char rank_unknown = -1;
+static const int rank_unknown = -1;
 
 static void raise_revlog_error(void)
 {