diff options
author | Donovan Baarda <abo@minkirri.apana.org.au> | 2021-09-14 17:10:02 +1000 |
---|---|---|
committer | Donovan Baarda <abo@minkirri.apana.org.au> | 2021-09-14 17:10:02 +1000 |
commit | 902abe2d11786099c7f14215b7e3aee98e9de754 (patch) | |
tree | cecb93735d13c74c7889b0e3e5a23b512127c1b8 | |
parent | 6f7a5f7f82c165a66048e5b644835f7b1bcc1e52 (diff) | |
download | librsync-902abe2d11786099c7f14215b7e3aee98e9de754.tar.gz |
Remove use of ssize_t which doesn't exist on Windows.
It turns out ssize_t is a Posix thing that doesn't exist on Windows. I
originally started using it in stream.h so that negative values could be used
to indicate errors when iterating through buffers. We don't use or need that,
so we can just use size_t instead.
-rw-r--r-- | src/stream.h | 18 | ||||
-rw-r--r-- | src/tube.c | 3 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/stream.h b/src/stream.h index f4c330e..3aa7bee 100644 --- a/src/stream.h +++ b/src/stream.h @@ -135,7 +135,7 @@ static inline void *rs_scoop_getbuf(rs_job_t *job, size_t *len) * * Example: \code * size_t len=rs_scoop_avail(job); - * ssize_t ilen; + * size_t ilen; * * for (buf = rs_scoop_iterbuf(job, &len, &ilen); ilen > 0; * buf = rs_scoop_nextbuf(job, &len, &ilen)) @@ -145,36 +145,34 @@ static inline void *rs_scoop_getbuf(rs_job_t *job, size_t *len) * At each iteration buf and ilen are the data and its length for the current * iteration. During an iteration you can change ilen to indicate only part of * the buffer was processed and the next iteration will take this into account. - * Setting ilen <= 0 to indicate blocking or errors will terminate iteration. + * Setting ilen = 0 to indicate blocking or errors will terminate iteration. * The pos and len are updated to the remaining data to iterate through, * including the current iteration. * * At the end of iteration buf and pos will point at the next location in the * scoop after the iterated data, len and ilen will be zero, or the remaining - * data and last ilen if iteration was terminated by setting ilen <= 0. + * data and last ilen if iteration was terminated by setting ilen = 0. * * \param *job - the job instance to use. * * \param *len - the size_t amount of data to iterate over. * - * \param *ilen - the ssize_t amount of data in the current iteration. + * \param *ilen - the size_t amount of data in the current iteration. * * \return A pointer to data in the current iteration. */ -static inline void *rs_scoop_iterbuf(rs_job_t *job, size_t *len, - ssize_t *ilen) +static inline void *rs_scoop_iterbuf(rs_job_t *job, size_t *len, size_t *ilen) { *ilen = *len; - return rs_scoop_getbuf(job, (size_t *)ilen); + return rs_scoop_getbuf(job, ilen); } /** Get the next iteration of contiguous data buffers from the scoop. * * This advances the scoop for the previous iteration, and gets the next * iteration. \sa rs_scoop_iterbuf */ -static inline void *rs_scoop_nextbuf(rs_job_t *job, size_t *len, - ssize_t *ilen) +static inline void *rs_scoop_nextbuf(rs_job_t *job, size_t *len, size_t *ilen) { - if (*ilen <= 0) + if (*ilen == 0) return rs_scoop_buf(job); rs_scoop_advance(job, *ilen); *len -= *ilen; @@ -92,8 +92,7 @@ static void rs_tube_catchup_copy(rs_job_t *job) size_t copy_len = job->copy_len; size_t avail_in = rs_scoop_avail(job); size_t avail_out = stream->avail_out; - size_t len; - ssize_t ilen; + size_t len, ilen; void *next; if (copy_len > avail_in) |