aboutsummaryrefslogtreecommitdiffstats
path: root/checksum.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2006-11-21 08:35:58 +0000
committerWayne Davison <wayned@samba.org>2006-11-21 08:35:58 +0000
commit264042760bd909eeca281dc8c937357e98bf6bf8 (patch)
treeb4c302f4453df23aa47d35d340fbabfe4e537e45 /checksum.c
parent1e999f9f1b6940a4b355054b5f15435c3030996c (diff)
downloadandroid_external_rsync-264042760bd909eeca281dc8c937357e98bf6bf8.tar.gz
android_external_rsync-264042760bd909eeca281dc8c937357e98bf6bf8.tar.bz2
android_external_rsync-264042760bd909eeca281dc8c937357e98bf6bf8.zip
Use an explicit cast when a value gets stored in a smaller var.
Diffstat (limited to 'checksum.c')
-rw-r--r--checksum.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/checksum.c b/checksum.c
index c8b6cdf6..9b620230 100644
--- a/checksum.c
+++ b/checksum.c
@@ -95,11 +95,11 @@ void get_checksum2(char *buf, int32 len, char *sum)
void file_checksum(char *fname,char *sum,OFF_T size)
{
- OFF_T i;
struct map_struct *buf;
- int fd;
- OFF_T len = size;
+ OFF_T i, len = size;
struct mdfour m;
+ int32 remainder;
+ int fd;
memset(sum,0,MD4_SUM_LENGTH);
@@ -120,8 +120,9 @@ void file_checksum(char *fname,char *sum,OFF_T size)
* by failing to call mdfour_tail() for block sizes that
* are multiples of 64. This is fixed by calling mdfour_update()
* even when there are no more bytes. */
- if (len - i > 0 || protocol_version >= 27)
- mdfour_update(&m, (uchar *)map_ptr(buf, i, len-i), len-i);
+ remainder = (int32)(len - i);
+ if (remainder > 0 || protocol_version >= 27)
+ mdfour_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
mdfour_result(&m, (uchar *)sum);