git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix a comparison bug in diff-delta.c

From
Pierre Habouzit <madcoder@debian.org>
Date
Aug 23, 2006, 02:38 UTC
Message-ID
<200608230438.06053.madcoder@debian.org>
In-Reply-To
<1156300368160-git-send-email-madcoder@debian.org>
Le mer 23 août 2006 04:32, Pierre Habouzit a écrit :
>   I'm currently trying to make git compile with more strict gcc flags
> (-g -O2 -Wall -Wextra -Wno-unused -Werror to be precise) and I've
> spotted a first bug due to a signed/unsigned comparison.
still in the same kind of "problems" sha1_name.c:512 has:
		if (active_nr < 0)
			return -1;
but active_nr is defined as an unsigned (in cache.h/cache-read.c).

Also note that there is a *lot* of signed/unsigned comparisons due to the fact that it's unsigned, and that it's often compared to positions that are ints (I assume pos need the negative values to mean "error").

so either those two lines are too much, or active_nr has to be a plain signed int. I'm not used to git sources enough yet to be able to make the right decision.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Pierre HabouzitNext: Nicolas Pitre
Message 2 of 3 in “Fix a comparison bug in diff-delta.c”
  1. Fix a comparison bug in diff-delta.cPierre Habouzit, Aug 23, 2006
  2. Pierre HabouzitAug 23, 2006
  3. Nicolas PitreAug 23, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.