1. 11 2月, 2011 1 次提交
  2. 27 1月, 2010 1 次提交
  3. 14 9月, 2009 1 次提交
  4. 19 6月, 2009 1 次提交
    • L
      Fix big left-shifts of unsigned char · 48fb7deb
      Linus Torvalds 提交于
      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 << 24;
      
      where despite all the variables being unsigned, 'c << 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 	][ 	]*<<[ 	][a-z]' -- '*.c' '*.h'
      	git grep '<<[   ]*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: "& 0x7fUL" in one place (getting the sign extension
      right), and "& ~0x80" and "& 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 "& 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: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      48fb7deb
  5. 19 12月, 2006 1 次提交
  6. 20 6月, 2006 1 次提交
  7. 05 5月, 2006 1 次提交
  8. 25 4月, 2006 1 次提交
    • N
      split the diff-delta interface · 08abe669
      Nicolas Pitre 提交于
      This patch splits the diff-delta interface into index creation and delta
      generation.  A wrapper is provided to preserve the diff-delta() call.
      
      This will allow for an optimization in pack-objects.c where the source
      object could be fixed and a full window of objects tentatively tried
      against
      that same source object without recomputing the source index each time.
      
      This patch only restructure things, plus a couple cleanups for good
      measure. There is no performance change yet.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      08abe669
  9. 08 4月, 2006 1 次提交
  10. 10 2月, 2006 1 次提交
    • N
      remove delta-against-self bit · d60fc1c8
      Nicolas Pitre 提交于
      After experimenting with code to add the ability to encode a delta
      against part of the deltified file, it turns out that resulting packs
      are _bigger_ than when this ability is not used.  The raw delta output
      might be smaller, but it doesn't compress as well using gzip with a
      negative net saving on average.
      
      Said bit would in fact be more useful to allow for encoding the copying
      of chunks larger than 64KB providing more savings with large files.
      This will correspond to packs version 3.
      
      While the current code still produces packs version 2, it is made future
      proof so pack versions 2 and 3 are accepted.  Any pack version 2 are
      compatible with version 3 since the redefined bit was never used before.
      When enough time has passed, code to use that bit to produce version 3
      packs could be added.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      d60fc1c8
  11. 05 9月, 2005 1 次提交
    • S
      [PATCH] NUL terminate the object data in patch_delta() · ce726ec8
      Sergey Vlasov 提交于
      At least pretty_print_commit() expects to get NUL-terminated commit data to
      work properly.  unpack_sha1_rest(), which reads objects from separate files,
      and unpack_non_delta_entry(), which reads non-delta-compressed objects from
      pack files, already add the NUL byte after the object data, but patch_delta()
      did not do it, which caused problems with, e.g., git-rev-list --pretty when
      there are delta-compressed commit objects.
      Signed-off-by: NSergey Vlasov <vsu@altlinux.ru>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ce726ec8
  12. 30 6月, 2005 1 次提交
  13. 29 6月, 2005 1 次提交
  14. 19 5月, 2005 1 次提交