From debb45054a3c4d4da3faac372e993b594e5a0df7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 6 May 1998 06:21:35 +0000 Subject: [PATCH] Solaris 2.6 doesn't support "signed char". What a broken system! --- README | 6 ++++++ checksum.c | 2 +- configure.in | 8 +++++++- match.c | 10 +++++----- rsync.h | 6 ++++++ 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/README b/README index 20d5054b..e11ef88d 100644 --- a/README +++ b/README @@ -72,6 +72,12 @@ To install rsync, first run the "configure" script. This will create a Makefile and config.h appropriate for your system. Then type "make". +Note that on some systems you will have to force configure not to use +gcc because gcc may not support some features (such as 64 bit file +offsets) that your system may support. Set the environment variable CC +to the name of your native compiler before running configure in this +case. + Once built put a copy of rsync in your search path on the local and remote systems (or use "make install"). That's it! diff --git a/checksum.c b/checksum.c index 6186aae3..6dc935e0 100644 --- a/checksum.c +++ b/checksum.c @@ -34,7 +34,7 @@ uint32 get_checksum1(char *buf1,int len) { int i; uint32 s1, s2; - signed char *buf = (signed char *)buf1; + schar *buf = (schar *)buf1; s1 = s2 = 0; for (i = 0; i < (len-4); i+=4) { diff --git a/configure.in b/configure.in index 511620af..65a40a56 100644 --- a/configure.in +++ b/configure.in @@ -60,7 +60,13 @@ echo $ac_n "checking for off64_t ... $ac_c" AC_TRY_RUN([#include #include main() { struct stat64 st; off64_t s; exit((lstat64("/dev/null", &st)==0)?0:1); }], -echo yes;AC_DEFINE(HAVE_LONGLONG), +echo yes;AC_DEFINE(HAVE_OFF64_T), +echo no) + +echo $ac_n "checking for unsigned char ... $ac_c" +AC_TRY_RUN([#include +main() { char c; c=250; exit((c > 0)?0:1); }], +echo yes;AC_DEFINE(HAVE_UNSIGNED_CHAR), echo no) echo $ac_n "checking for utimbuf ... $ac_c" diff --git a/match.c b/match.c index dda156f0..3689af4f 100644 --- a/match.c +++ b/match.c @@ -130,14 +130,14 @@ static void hash_search(int f,struct sum_struct *s, int end; char sum2[SUM_LENGTH]; uint32 s1, s2, sum; - signed char *map; + schar *map; if (verbose > 2) fprintf(FINFO,"hash search b=%d len=%d\n",s->n,(int)len); k = MIN(len, s->n); - map = (signed char *)map_ptr(buf,0,k); + map = (schar *)map_ptr(buf,0,k); sum = get_checksum1((char *)map, k); s1 = sum & 0xFFFF; @@ -178,7 +178,7 @@ static void hash_search(int f,struct sum_struct *s, if (!done_csum2) { int l = MIN(s->n,len-offset); - map = (signed char *)map_ptr(buf,offset,l); + map = (schar *)map_ptr(buf,offset,l); get_checksum2((char *)map,l,sum2); done_csum2 = 1; } @@ -191,7 +191,7 @@ static void hash_search(int f,struct sum_struct *s, matched(f,s,buf,offset,i); offset += s->sums[i].len - 1; k = MIN((len-offset), s->n); - map = (signed char *)map_ptr(buf,offset,k); + map = (schar *)map_ptr(buf,offset,k); sum = get_checksum1((char *)map, k); s1 = sum & 0xFFFF; s2 = sum >> 16; @@ -201,7 +201,7 @@ static void hash_search(int f,struct sum_struct *s, null_tag: /* Trim off the first byte from the checksum */ - map = (signed char *)map_ptr(buf,offset,k+1); + map = (schar *)map_ptr(buf,offset,k+1); s1 -= map[0] + CHAR_OFFSET; s2 -= k * (map[0]+CHAR_OFFSET); diff --git a/rsync.h b/rsync.h index 34eeb575..3418b817 100644 --- a/rsync.h +++ b/rsync.h @@ -179,6 +179,12 @@ #define uchar unsigned char #endif +#if HAVE_UNSIGNED_CHAR +#define schar signed char +#else +#define schar char +#endif + #ifndef int32 #if (SIZEOF_INT == 4) #define int32 int -- 2.34.1