diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/base64.c | 1 | ||||
-rw-r--r-- | src/buf.c | 1 | ||||
-rw-r--r-- | src/checksum.c | 1 | ||||
-rw-r--r-- | src/command.c | 1 | ||||
-rw-r--r-- | src/delta.c | 1 | ||||
-rw-r--r-- | src/emit.c | 1 | ||||
-rw-r--r-- | src/fileutil.c | 17 | ||||
-rw-r--r-- | src/hex.c | 1 | ||||
-rw-r--r-- | src/isprefix.c | 1 | ||||
-rw-r--r-- | src/job.c | 1 | ||||
-rw-r--r-- | src/mdfour.c | 1 | ||||
-rw-r--r-- | src/mksum.c | 1 | ||||
-rw-r--r-- | src/msg.c | 1 | ||||
-rw-r--r-- | src/netint.c | 1 | ||||
-rw-r--r-- | src/patch.c | 5 | ||||
-rw-r--r-- | src/prototab.c | 1 | ||||
-rw-r--r-- | src/rabinkarp.c | 1 | ||||
-rw-r--r-- | src/rdiff.c | 2 | ||||
-rw-r--r-- | src/readsums.c | 1 | ||||
-rw-r--r-- | src/rollsum.c | 5 | ||||
-rw-r--r-- | src/rollsum.h | 4 | ||||
-rw-r--r-- | src/scoop.c | 1 | ||||
-rw-r--r-- | src/stats.c | 1 | ||||
-rw-r--r-- | src/sumset.c | 1 | ||||
-rw-r--r-- | src/trace.c | 2 | ||||
-rw-r--r-- | src/tube.c | 1 | ||||
-rw-r--r-- | src/util.c | 1 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/whole.c | 1 |
29 files changed, 43 insertions, 16 deletions
diff --git a/src/base64.c b/src/base64.c index 39f8579..873746e 100644 --- a/src/base64.c +++ b/src/base64.c @@ -19,6 +19,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdlib.h> #include <string.h> #include "librsync.h" @@ -23,6 +23,7 @@ | Pick a window, Jimmy, you're leaving. */ +#include "config.h" /* IWYU pragma: keep */ #include <assert.h> #include <stdlib.h> #include <errno.h> diff --git a/src/checksum.c b/src/checksum.c index daf5c6a..22069e1 100644 --- a/src/checksum.c +++ b/src/checksum.c @@ -21,6 +21,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdint.h> #include "checksum.h" #include "blake2.h" diff --git a/src/command.c b/src/command.c index 0db2f66..20b2b54 100644 --- a/src/command.c +++ b/src/command.c @@ -19,6 +19,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include <stddef.h> #include "command.h" diff --git a/src/delta.c b/src/delta.c index 2d7fdbc..de65a8c 100644 --- a/src/delta.c +++ b/src/delta.c @@ -88,6 +88,7 @@ * and scan_pos adjusted. Everything gets complicated because the tube can * block. When the tube is blocked, no data can be processed. */ +#include "config.h" /* IWYU pragma: keep */ #include <assert.h> #include <stdlib.h> #include "librsync.h" @@ -19,6 +19,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include <assert.h> #include "librsync.h" #include "emit.h" diff --git a/src/fileutil.c b/src/fileutil.c index a58e52c..676d2d0 100644 --- a/src/fileutil.c +++ b/src/fileutil.c @@ -20,28 +20,31 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" +/* This provides a compatiblity layer for file operations on different + platforms. We need to tell IWYU to keep some headers because they are + required on some platforms but not others. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #ifdef HAVE_UNISTD_H -# include <unistd.h> +# include <unistd.h> /* IWYU pragma: keep */ #endif #ifdef HAVE_FCNTL_H -# include <fcntl.h> +# include <fcntl.h> /* IWYU pragma: keep */ #endif #ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> +# include <sys/types.h> /* IWYU pragma: keep */ #endif #ifdef HAVE_SYS_FILE_H -# include <sys/file.h> +# include <sys/file.h> /* IWYU pragma: keep */ #endif #ifdef HAVE_SYS_STAT_H -# include <sys/stat.h> +# include <sys/stat.h> /* IWYU pragma: keep */ #endif #ifdef HAVE_IO_H -# include <io.h> +# include <io.h> /* IWYU pragma: keep */ #endif #include "librsync.h" #include "trace.h" @@ -17,6 +17,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include "librsync.h" void rs_hexify(char *to_buf, void const *from, int from_len) diff --git a/src/isprefix.c b/src/isprefix.c index aa879e7..becba35 100644 --- a/src/isprefix.c +++ b/src/isprefix.c @@ -18,6 +18,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include "isprefix.h" int isprefix(char const *tip, char const *iceberg) @@ -25,6 +25,7 @@ | sheltering. */ +#include "config.h" /* IWYU pragma: keep */ #include <assert.h> #include <stdlib.h> #include <time.h> diff --git a/src/mdfour.c b/src/mdfour.c index a32728b..8c0c2d7 100644 --- a/src/mdfour.c +++ b/src/mdfour.c @@ -21,6 +21,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdint.h> #include <string.h> #include "librsync.h" diff --git a/src/mksum.c b/src/mksum.c index 5982bb1..a7bcf84 100644 --- a/src/mksum.c +++ b/src/mksum.c @@ -27,6 +27,7 @@ * whatever data is available. When a whole block has arrived, or we've reached * the end of the file, we write the checksum out. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdlib.h> #include "librsync.h" #include "job.h" @@ -40,6 +40,7 @@ * description of a job, including only the fields relevant to the current * encoding function. */ +#include "config.h" /* IWYU pragma: keep */ #include "librsync.h" char const *rs_strerror(rs_result r) diff --git a/src/netint.c b/src/netint.c index 7d38071..ce3f8e3 100644 --- a/src/netint.c +++ b/src/netint.c @@ -27,6 +27,7 @@ | -- Sun Microsystems */ +#include "config.h" /* IWYU pragma: keep */ #include <assert.h> #include "librsync.h" #include "netint.h" diff --git a/src/patch.c b/src/patch.c index e288d7d..7e353d9 100644 --- a/src/patch.c +++ b/src/patch.c @@ -26,6 +26,7 @@ /** \file patch.c * Apply a delta to an old file to generate a new file. */ +#include "config.h" /* IWYU pragma: keep */ #include <assert.h> #include <stdlib.h> #include <string.h> @@ -166,7 +167,7 @@ static rs_result rs_patch_s_copying(rs_job_t *job) if (!len) return RS_BLOCKED; /* Adjust request to min of amount requested and space available. */ - if (len < req) + if ((rs_long_t)len < req) req = (rs_long_t)len; rs_trace("copy " FMT_LONG " bytes from basis at offset " FMT_LONG "", req, job->basis_pos); @@ -180,7 +181,7 @@ static rs_result rs_patch_s_copying(rs_job_t *job) /* Actual copied length cannot be greater than requested length. */ assert(len <= req); /* Backwards-compatible defensively handle this for NDEBUG builds. */ - if (len > req) { + if ((rs_long_t)len > req) { rs_warn("copy_cb() returned more than the requested length"); len = (size_t)req; } diff --git a/src/prototab.c b/src/prototab.c index 92a4256..aa693f5 100644 --- a/src/prototab.c +++ b/src/prototab.c @@ -20,6 +20,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include "command.h" #include "prototab.h" diff --git a/src/rabinkarp.c b/src/rabinkarp.c index 085b549..ae6247e 100644 --- a/src/rabinkarp.c +++ b/src/rabinkarp.c @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include "rabinkarp.h" /* Constant for RABINKARP_MULT^2. */ diff --git a/src/rdiff.c b/src/rdiff.c index 78a3047..29ca892 100644 --- a/src/rdiff.c +++ b/src/rdiff.c @@ -43,12 +43,12 @@ * * \todo Add an option for delta to check whether the files are identical. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <popt.h> #include <stdio.h> -#include "config.h" #include "librsync.h" #include "isprefix.h" diff --git a/src/readsums.c b/src/readsums.c index 4f7cd62..61ba84a 100644 --- a/src/readsums.c +++ b/src/readsums.c @@ -23,6 +23,7 @@ /** \file readsums.c * Load signatures from a file. */ +#include "config.h" /* IWYU pragma: keep */ #include "librsync.h" #include "job.h" #include "sumset.h" diff --git a/src/rollsum.c b/src/rollsum.c index 03d450e..90c8780 100644 --- a/src/rollsum.c +++ b/src/rollsum.c @@ -19,6 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include "rollsum.h" #define DO1(buf,i) {s1 += buf[i]; s2 += s1;} @@ -46,8 +47,8 @@ void RollsumUpdate(Rollsum *sum, const unsigned char *buf, size_t len) n--; } /* Increment s1 and s2 by the amounts added by the char offset. */ - s1 += len * ROLLSUM_CHAR_OFFSET; - s2 += ((len * (len + 1)) / 2) * ROLLSUM_CHAR_OFFSET; + s1 += (uint_fast16_t)len * ROLLSUM_CHAR_OFFSET; + s2 += (uint_fast16_t)((len * (len + 1)) / 2) * ROLLSUM_CHAR_OFFSET; sum->count += len; /* Increment sum count. */ sum->s1 = s1; sum->s2 = s2; diff --git a/src/rollsum.h b/src/rollsum.h index 9f33dd0..f5a2aae 100644 --- a/src/rollsum.h +++ b/src/rollsum.h @@ -52,7 +52,7 @@ static inline void RollsumRotate(Rollsum *sum, unsigned char out, unsigned char in) { sum->s1 += in - out; - sum->s2 += sum->s1 - sum->count * (out + ROLLSUM_CHAR_OFFSET); + sum->s2 += sum->s1 - (uint_fast16_t)sum->count * (out + ROLLSUM_CHAR_OFFSET); } static inline void RollsumRollin(Rollsum *sum, unsigned char in) @@ -65,7 +65,7 @@ static inline void RollsumRollin(Rollsum *sum, unsigned char in) static inline void RollsumRollout(Rollsum *sum, unsigned char out) { sum->s1 -= out + ROLLSUM_CHAR_OFFSET; - sum->s2 -= sum->count * (out + ROLLSUM_CHAR_OFFSET); + sum->s2 -= (uint_fast16_t)sum->count * (out + ROLLSUM_CHAR_OFFSET); sum->count--; } diff --git a/src/scoop.c b/src/scoop.c index 6ac3999..7c30b92 100644 --- a/src/scoop.c +++ b/src/scoop.c @@ -52,6 +52,7 @@ * would be kind of nice to not do any memory allocation after startup, as * bzlib does this. */ +#include "config.h" /* IWYU pragma: keep */ #include <assert.h> #include <stdlib.h> #include <string.h> diff --git a/src/stats.c b/src/stats.c index ecb7d28..5fabb8d 100644 --- a/src/stats.c +++ b/src/stats.c @@ -23,6 +23,7 @@ * \todo Other things to show in statistics: number of input and output bytes, * number of times we blocked waiting for input or output, number of blocks. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdio.h> #include "librsync.h" #include "trace.h" diff --git a/src/sumset.c b/src/sumset.c index d95b6f4..5a87261 100644 --- a/src/sumset.c +++ b/src/sumset.c @@ -20,6 +20,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdlib.h> #include <string.h> #include "librsync.h" diff --git a/src/trace.c b/src/trace.c index 426e1be..75112ff 100644 --- a/src/trace.c +++ b/src/trace.c @@ -26,9 +26,9 @@ | There are lumps in it. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdio.h> #include <stdarg.h> -#include "config.h" #include "librsync.h" #include "trace.h" #include "util.h" @@ -51,6 +51,7 @@ * in that case we might need to copy into some temporary buffer space, and * then back out again later. */ +#include "config.h" /* IWYU pragma: keep */ #include <assert.h> #include <stdlib.h> #include <string.h> @@ -23,6 +23,7 @@ | On heroin, I have all the answers. */ +#include "config.h" /* IWYU pragma: keep */ #include <stdlib.h> #include <string.h> #include "librsync.h" diff --git a/src/version.c b/src/version.c index ebc3983..1817f8f 100644 --- a/src/version.c +++ b/src/version.c @@ -19,7 +19,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" +#include "config.h" /* IWYU pragma: keep */ #include "librsync_export.h" LIBRSYNC_EXPORT char const rs_librsync_version[] = PACKAGE " " VERSION; diff --git a/src/whole.c b/src/whole.c index e667f88..ebce253 100644 --- a/src/whole.c +++ b/src/whole.c @@ -27,6 +27,7 @@ | -- Alan Perlis */ +#include "config.h" /* IWYU pragma: keep */ #include <stdio.h> #include <string.h> #include "librsync.h" |