summaryrefslogtreecommitdiff
path: root/src/delta-apply.c
Commit message (Collapse)AuthorAgeFilesLines
* delta: move delta application to delta.cEdward Thomson2016-05-261-166/+0
| | | | | | | Move the delta application functions into `delta.c`, next to the similar delta creation functions. Make the `git__delta_apply` functions adhere to other naming and parameter style within the library.
* Merge pull request #3767 from pks-t/pks/misc-fixesEdward Thomson2016-05-091-5/+5
|\ | | | | Misc fixes
| * delta-apply: fix sign extensionPatrick Steinhardt2016-05-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We compute offsets by executing `off |= (*delta++ << 24)` for multiple constants, where `off` is of type `size_t` and `delta` is of type `unsigned char`. The usual arithmetic conversions (see ISO C89 §3.2.1.5 "Usual arithmetic conversions") kick in here, causing us to promote both operands to `int` and then extending the result to an `unsigned long` when OR'ing it with `off`. The integer promotion to `int` may result in wrong size calculations for big values. Fix the issue by making the constants `unsigned long`, causing both operands to be promoted to `unsigned long`.
* | odb: avoid inflating the full delta to read the headercmn/faster-headerCarlos Martín Nieto2016-05-021-0/+31
|/ | | | | | | | | | When we read the header, we want to know the size and type of the object. We're currently inflating the full delta in order to read the first few bytes. This can mean hundreds of kB needlessly inflated for large objects. Instead use a packfile stream to read just enough so we can read the two varints in the header and avoid inflating most of the delta.
* Make our overflow check look more like gcc/clang'sEdward Thomson2015-02-131-3/+3
| | | | | | | | | Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
* allocations: test for overflow of requested sizeEdward Thomson2015-02-121-0/+1
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* delta-apply: add git__delta_read_headerDavid Michael Barr2012-12-011-0/+13
|
* errors: Rename the generic return codesVicent Martí2012-05-181-1/+1
|
* Remove old and unused error codesVicent Martí2012-05-021-2/+3
|
* error handling: move the missing parts over to the new error handlingCarlos Martín Nieto2012-04-261-5/+10
|
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-1/+1
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* Tabify everythingVicent Marti2011-09-191-7/+7
| | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
* Cleanup legal dataVicent Marti2011-09-191-0/+6
| | | | | | | | | | 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
* delta-apply.c: Move to new error handling mechanismJakob Pfender2011-05-231-3/+3
|
* delta-apply.c: Use GIT_ENOMEM instead of GIT_ERROR when allocatingJakob Pfender2011-05-231-1/+1
| | | | | | | git__delta_apply used to return with a generic GIT_ERROR when allocating memory for the delta failed. Fix this to return GIT_ENOMEM.
* Change the library include fileVicent Marti2010-12-061-1/+1
| | | | | | | | | | | | Libgit2 is now officially include as #include "<git2.h>" or indidividual files may be included as #include <git2/index.h> Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Give object structures more descriptive namesVicent Marti2010-09-191-1/+1
| | | | | | | | | | The 'git_obj' structure is now called 'git_rawobj', since it represents a raw object read from the ODB. The 'git_repository_object' structure is now called 'git_object', since it's the base object class for all objects. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* msvc: Fix some -W4 warningsRamsay Jones2010-01-201-5/+9
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Fix some (digital-mars) compiler warningsRamsay Jones2009-03-171-1/+1
| | | | | | | | | | | In particular, conditional expressions which contain an assignment statement, where the expression type is not explicitly made to be boolean, elicits the following message: warning 2: possible unintended assignment Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Fix a sparse "symbol not declared" warningRamsay Jones2009-01-281-0/+1
| | | | | | | | | | | In particular, the git__delta_apply() function has not been declared prior to it's definition. In order to suppress the warning, include the delta-apply.h header which provides the public interface. This ensures that the declaration and definition are consistent. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add the binary delta apply algorithm for pack style deltasShawn O. Pearce2009-01-031-0/+104
The git__delta_apply() function can be used to apply a Git style delta, such as those used in pack files or in git patch files, to recover the original object stream. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>