summaryrefslogtreecommitdiff
path: root/src/checksum.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix #248 by putting `#include "config.h"` in most src/*.c files. (#249)Donovan Baarda2023-02-191-0/+1
| | | | | | | | | | | | | | | | | | * Fix #248 by putting `#include "config.h"` in all src/*.c files. The iwyu tool doesn't handle `config.h` files well, and these includes were incorrectly removed, which breaks things on some platforms. Add them back to most `src/*.c` files with `/* IWYU pragma: keep */` to make iwyu ignore them. We skip `src/hashtable.c` because it is a standalone tool that is platform independent. Also add `/* IWYU pragma: keep */` to includes in `src/fileutil.c` that are needed on some platforms but not others. This means we can remove the special exemptions to skip this file for the `iwyu` and `iwyu-fix` targets in `CMakeLists.txt`. Add some explicit typecasts to `rollsum.[ch]` and `patch.c` to silence warnings on windows. Update NEWS.md for `config.h` include fixes and added typecasts.
* Fix all iwyu #include warnings for all files except fileutil.c.Donovan Baarda2021-08-201-1/+2
| | | | | | | | | | | This was mostly done by piping iwyu_tool output to `fix_include --noblank_lines` with the exception of hashtable.h and its unittest which required manual tweaking, plus a few manual tweaks in some places. For fileutil.c it was excluded and only manually tweaked a tiny bit. It has conditional includes based on config.h settings which seems to confuse iwyu_tool and fix_includes to the point where it recommended removing several of them which wouldn't compile any more.
* Add checksum_test.c test and move RS_*_SUM_LENGTH consts to checksum.c.Donovan Baarda2019-09-111-0/+3
| | | | | The checksum_test.c showed it makes more sense to put the checksum length constants into checksum.c where they are most useful.
* Minor tidyups and comment improvements in checksum.[ch].Donovan Baarda2019-09-101-0/+1
|
* Stop using mix32() with RabinKarp rollsums.Donovan Baarda2019-09-061-5/+11
| | | | | | | | | | | | | | | The RabinKarp weaksums are already very well distributed so mix32() is just an overhead we don't need. However, we still need mix32() for Rollsums. In sumset.c set HASHTABLE_NMIX32 to turn off mix32() in the hashtable. Instead apply mix32() in rs_signature_add_block() for Rollsums when they are added into the signature. In checksum.h apply mix32() to Rollsum digests in weaksum_digest(). Change rs_calc_weak_sum() to directly call Rollsum or rabinkarp methods to avoid switching on kind for each weaksum method, and so that we can avoid having mix32() applied for Rollsums. Document that rs_calc_weak_sum() does not apply mix32() but weaksum_digest() does.
* Replace differnt strongsum calculators with rs_calc_strong_sum().Donovan Baarda2019-09-061-14/+13
| | | | | | | | | | In checksum.[hc] remove the specific md4 and blake2 strongsum calculators and replace them with a rs_calc_strong_sum() method that takes the kind as an argument. In sumset.h use rs_signature_*_kind() methods to simplify the rs_signature_calc_strong_sum() and rs_signature_calc_weak_sum() methods, using the new rs_calc_strong_sum().
* Implement RabinKarp delta support.Donovan Baarda2019-09-061-1/+2
| | | | | | | | | | | | | | In checksum.h add strongsum_kind_t enum for the strongsum kinds. in sumset.h add rs_signature_weaksum_kind() and rs_signature_strongsum_kind() to get the sum kinds used by a signature. Improve rs_signature_check() using bitmasks against magic to validate different pieces. In job.h change the weak_sum field to be a weaksum_t. In delta.c use weaksum_*() methods instead of Rollsum*() methods. Use rs_signature_weaksum_kind() to get and initialize job->weak_sum to the right kind.
* Add RabinKarp support to generating signatures.Donovan Baarda2019-09-061-14/+5
| | | | | | | | | | | | | | | | | | | | In checksum.[ch] implement a weaksum_t wrapper around Rollsum and RabinKarp rollsums. In sumset.[ch] add support for RabinKarp magic's and add rs_signature_calc_weak_sum() that uses the weaksum_t wrapper to calculate the right kind of weaksum for the signature magic value. In mksum.c use rs_signature_calc_weak_sum() to calculate the correct weaksum type. Update tests/signature.test to include testing of RabinKarp signature types. Update tests/sumset_test.c to include testing of new magic types. Note that although this adds support for generating RabinKarp compatible signatures, delta calculation doesn't yet use them correctly. It will appear to work, but will find no matches.
* Run 'make tidyc' after fixing tidyc to be more repeatable.Donovan Baarda2018-02-251-3/+3
|
* Ugh! The paragraph formatting indent does is not stable. Why?Donovan Baarda2018-02-241-5/+5
| | | | Multiple runs of tidyc seem to have eventually stabilised to this.
* Run 'make tidyc' over code.Donovan Baarda2018-02-231-14/+10
|
* Minor tidyups to comments in preparation for autoformatting.Donovan Baarda2018-02-121-1/+1
|
* Tidy rs_weak_sum_t related code.Donovan Baarda2016-08-161-29/+11
| | | | | | | | | | In checksum.c make rs_calc_weak_sum() use the implementation in rollsum.[hc]. Tidy checksum.h removing now unused RS_CHAR_OFFSET. In librsync.h change rs_weak_sum_t from "unsigned int" to uint32_t. In mksum.c use rs_weak_sum_t instead of "unsigned int" as the type of a calculated weaksum.
* Remove obsolete CVS/RCS file stampsMartin Pool2015-11-291-1/+0
|
* Move *.c *.h project files into src dirAdam Schubert2015-05-111-0/+90