<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/base85.c, branch v2.26.0-rc2</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v2.26.0-rc2</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v2.26.0-rc2'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2013-10-16T17:27:26Z</updated>
<entry>
<title>base85.c: have SP around arithmetic operators</title>
<updated>2013-10-16T17:27:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-10-15T22:27:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=5f050e3c4ce05de13f24157ca7d3452362e673dc'/>
<id>urn:sha1:5f050e3c4ce05de13f24157ca7d3452362e673dc</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Standardize do { ... } while (0) style</title>
<updated>2010-08-12T22:44:51Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2010-08-12T22:11:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=987460611ab08ebac83ead9a5ee316d3b3823e7f'/>
<id>urn:sha1:987460611ab08ebac83ead9a5ee316d3b3823e7f</id>
<content type='text'>
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'maint-1.6.2' into maint</title>
<updated>2010-01-10T08:51:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2010-01-10T08:51:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=8fb5d44a47dd3657c8be0de5dcf220935b04e98e'/>
<id>urn:sha1:8fb5d44a47dd3657c8be0de5dcf220935b04e98e</id>
<content type='text'>
* maint-1.6.2:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch

Conflicts:
	diff.c
</content>
</entry>
<entry>
<title>base85: Make the code more obvious instead of explaining the non-obvious</title>
<updated>2010-01-10T06:43:47Z</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@suse.de</email>
</author>
<published>2010-01-08T13:40:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=0606c36a73449e76d8f6133253c1eff291ee8c97'/>
<id>urn:sha1:0606c36a73449e76d8f6133253c1eff291ee8c97</id>
<content type='text'>
Here is another cleanup ...

Signed-off-by: Andreas Gruenbacher &lt;agruen@suse.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>base85: encode_85() does not use the decode table</title>
<updated>2010-01-10T06:43:37Z</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@suse.de</email>
</author>
<published>2010-01-08T16:22:18Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=b0bec518aa4a90485c411cebc7260425271af949'/>
<id>urn:sha1:b0bec518aa4a90485c411cebc7260425271af949</id>
<content type='text'>
Signed-off-by: Andreas Gruenbacher &lt;agruen@suse.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>base85 debug code: Fix length byte calculation</title>
<updated>2010-01-10T06:43:27Z</updated>
<author>
<name>Andreas Gruenbacher</name>
<email>agruen@suse.de</email>
</author>
<published>2010-01-08T13:39:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=75b7e16b6ea49d0a0da821373ae5ee3a0ee36f2e'/>
<id>urn:sha1:75b7e16b6ea49d0a0da821373ae5ee3a0ee36f2e</id>
<content type='text'>
Signed-off-by: Andreas Gruenbacher &lt;agruen@suse.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Fix big left-shifts of unsigned char</title>
<updated>2009-06-18T16:22:46Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2009-06-18T00:22:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=48fb7deb5bbd87933e7d314b73d7c1b52667f80f'/>
<id>urn:sha1:48fb7deb5bbd87933e7d314b73d7c1b52667f80f</id>
<content type='text'>
Shifting 'unsigned char' or 'unsigned short' left can result in sign
extension errors, since the C integer promotion rules means that the
unsigned char/short will get implicitly promoted to a signed 'int' due to
the shift (or due to other operations).

This normally doesn't matter, but if you shift things up sufficiently, it
will now set the sign bit in 'int', and a subsequent cast to a bigger type
(eg 'long' or 'unsigned long') will now sign-extend the value despite the
original expression being unsigned.

One example of this would be something like

	unsigned long size;
	unsigned char c;

	size += c &lt;&lt; 24;

where despite all the variables being unsigned, 'c &lt;&lt; 24' ends up being a
signed entity, and will get sign-extended when then doing the addition in
an 'unsigned long' type.

Since git uses 'unsigned char' pointers extensively, we actually have this
bug in a couple of places.

I may have missed some, but this is the result of looking at

	git grep '[^0-9 	][ 	]*&lt;&lt;[ 	][a-z]' -- '*.c' '*.h'
	git grep '&lt;&lt;[   ]*24'

which catches at least the common byte cases (shifting variables by a
variable amount, and shifting by 24 bits).

I also grepped for just 'unsigned char' variables in general, and
converted the ones that most obviously ended up getting implicitly cast
immediately anyway (eg hash_name(), encode_85()).

In addition to just avoiding 'unsigned char', this patch also tries to use
a common idiom for the delta header size thing. We had three different
variations on it: "&amp; 0x7fUL" in one place (getting the sign extension
right), and "&amp; ~0x80" and "&amp; 0x7f" in two other places (not getting it
right). Apart from making them all just avoid using "unsigned char" at
all, I also unified them to then use a simple "&amp; 0x7f".

I considered making a sparse extension which warns about doing implicit
casts from unsigned types to signed types, but it gets rather complex very
quickly, so this is just a hack.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>decode_85(): fix missing return.</title>
<updated>2007-05-30T22:03:50Z</updated>
<author>
<name>Jerald Fitzjerald</name>
<email>jfj@freemail.gr</email>
</author>
<published>2007-05-30T12:39:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=86d14e1b1d1063fc943c71edc8b05e1ce32c1602'/>
<id>urn:sha1:86d14e1b1d1063fc943c71edc8b05e1ce32c1602</id>
<content type='text'>
When the function detected an invalid base85 sequence, it issued
an error message but forgot to return error status at that point
and kept going.

Signed-off-by: Jerald Fitzjerald &lt;jfj@freemail.gr&gt;
Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>(encode_85, decode_85): Mark source buffer pointer as "const".</title>
<updated>2007-04-11T07:51:20Z</updated>
<author>
<name>Jim Meyering</name>
<email>jim@meyering.net</email>
</author>
<published>2007-04-09T22:56:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=f98157720239f0dd94d03632dc873e3eb3135e2f'/>
<id>urn:sha1:f98157720239f0dd94d03632dc873e3eb3135e2f</id>
<content type='text'>
Signed-off-by: Jim Meyering &lt;jim@meyering.net&gt;
Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>improve base85 generated assembly code</title>
<updated>2006-05-08T18:05:01Z</updated>
<author>
<name>Nicolas Pitre</name>
<email>nico@cam.org</email>
</author>
<published>2006-05-08T15:31:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=addaacab07d91e5ff1f06ada31c9e96c0edd31cd'/>
<id>urn:sha1:addaacab07d91e5ff1f06ada31c9e96c0edd31cd</id>
<content type='text'>
This code is arguably pretty hot, if you use binary patches of course.
This patch helps gcc generate both smaller and faster code especially in
the error free path.

Signed-off-by: Nicolas Pitre &lt;nico@cam.org&gt;
Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
</feed>
