Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Got rid of the pool-destroy call since this is not around anymore.
[rsync/rsync.git]
/
io.c
diff --git
a/io.c
b/io.c
index
3821e54
..
8fe8284
100644
(file)
--- a/
io.c
+++ b/
io.c
@@
-336,19
+336,21
@@
void increment_active_files(int ndx, int itemizing, enum logcode code)
{
/* TODO: tune these limits? */
while (active_filecnt >= (active_bytecnt >= 128*1024 ? 10 : 50)) {
{
/* TODO: tune these limits? */
while (active_filecnt >= (active_bytecnt >= 128*1024 ? 10 : 50)) {
+#ifdef SUPPORT_HARD_LINKS
if (hlink_list.head)
check_for_finished_hlinks(itemizing, code);
if (hlink_list.head)
check_for_finished_hlinks(itemizing, code);
+#endif
read_msg_fd();
}
active_filecnt++;
read_msg_fd();
}
active_filecnt++;
- active_bytecnt +=
the_file_list->files[ndx]->length
;
+ active_bytecnt +=
F_LENGTH(the_file_list->files[ndx])
;
}
void decrement_active_files(int ndx)
{
active_filecnt--;
}
void decrement_active_files(int ndx)
{
active_filecnt--;
- active_bytecnt -=
the_file_list->files[ndx]->length
;
+ active_bytecnt -=
F_LENGTH(the_file_list->files[ndx])
;
}
/* Try to push messages off the list onto the wire. If we leave with more
}
/* Try to push messages off the list onto the wire. If we leave with more
@@
-405,11
+407,20
@@
int send_msg(enum msgcode code, const char *buf, int len)
return 1;
}
return 1;
}
+void send_msg_int(enum msgcode code, int num)
+{
+ char numbuf[4];
+ SIVAL(numbuf, 0, num);
+ send_msg(code, numbuf, 4);
+}
+
int get_redo_num(int itemizing, enum logcode code)
{
while (1) {
int get_redo_num(int itemizing, enum logcode code)
{
while (1) {
+#ifdef SUPPORT_HARD_LINKS
if (hlink_list.head)
check_for_finished_hlinks(itemizing, code);
if (hlink_list.head)
check_for_finished_hlinks(itemizing, code);
+#endif
if (redo_list.head)
break;
read_msg_fd();
if (redo_list.head)
break;
read_msg_fd();
@@
-874,7
+885,7
@@
static void readfd(int fd, char *buffer, size_t N)
stats.total_read += total;
}
stats.total_read += total;
}
-
in
t read_shortint(int f)
+
unsigned shor
t read_shortint(int f)
{
char b[2];
readfd(f, b, 2);
{
char b[2];
readfd(f, b, 2);
@@
-917,6
+928,12
@@
int64 read_longint(int f)
int cnt;
readfd(f, b, 3);
cnt = int_byte_cnt[CVAL(b, 0)];
int cnt;
readfd(f, b, 3);
cnt = int_byte_cnt[CVAL(b, 0)];
+#if SIZEOF_INT64 < 8
+ if (cnt > 5 || (cnt == 5 && (CVAL(b,0)&0x3F || CVAL(b,1)&0x80))) {
+ rprintf(FERROR, "Integer overflow: attempted 64-bit offset\n");
+ exit_cleanup(RERR_UNSUPPORTED);
+ }
+#endif
if (cnt > 3)
readfd(f, b + 3, cnt - 3);
switch (cnt) {
if (cnt > 3)
readfd(f, b + 3, cnt - 3);
switch (cnt) {
@@
-929,6
+946,7
@@
int64 read_longint(int f)
case 5:
num = NVAL5(b, 0xC0);
break;
case 5:
num = NVAL5(b, 0xC0);
break;
+#if SIZEOF_INT64 >= 8
case 6:
num = NVAL6(b, 0xE0);
break;
case 6:
num = NVAL6(b, 0xE0);
break;
@@
-941,8
+959,9
@@
int64 read_longint(int f)
case 9:
num = NVAL8(b+1, 0);
break;
case 9:
num = NVAL8(b+1, 0);
break;
+#endif
default:
default:
- exit_cleanup(RERR_PROTOCOL); /
/ XXX impossible
+ exit_cleanup(RERR_PROTOCOL); /
* impossible... */
}
}
}
}
@@
-1286,12
+1305,12
@@
static void writefd(int fd, const char *buf, size_t len)
}
}
}
}
-void write_shortint(int f,
in
t x)
+void write_shortint(int f,
unsigned shor
t x)
{
{
-
u
char b[2];
- b[0] = x;
- b[1] =
x >> 8
;
- writefd(f,
(char *)
b, 2);
+ char b[2];
+ b[0] =
(char)
x;
+ b[1] =
(char)(x >> 8)
;
+ writefd(f, b, 2);
}
void write_int(int f, int32 x)
}
void write_int(int f, int32 x)
@@
-1334,65
+1353,74
@@
void write_longint(int f, int64 x)
goto all_bits;
#endif
} else if (x < ((int32)1<<(3*8-1))) {
goto all_bits;
#endif
} else if (x < ((int32)1<<(3*8-1))) {
- b[0] = (x >> 16);
- b[1] =
x >> 8
;
- b[2] = x;
+ b[0] = (
char)(
x >> 16);
+ b[1] =
(char)(x >> 8)
;
+ b[2] =
(char)
x;
writefd(f, b, 3);
} else if (x < ((int64)1<<(4*8-2))) {
writefd(f, b, 3);
} else if (x < ((int64)1<<(4*8-2))) {
- b[0] = (
x >> 24) | 0x80
;
- b[1] =
x >> 16
;
- b[2] =
x >> 8
;
- b[3] = x;
+ b[0] = (
char)((x >> 24) | 0x80)
;
+ b[1] =
(char)(x >> 16)
;
+ b[2] =
(char)(x >> 8)
;
+ b[3] =
(char)
x;
writefd(f, b, 4);
writefd(f, b, 4);
+#if SIZEOF_INT64 < 8
+ } else {
+ b[0] = 0xC0;
+ b[1] = (char)(x >> 24);
+ b[2] = (char)(x >> 16);
+ b[3] = (char)(x >> 8);
+ b[4] = (char)x;
+ writefd(f, b, 5);
+ }
+#else
} else if (x < ((int64)1<<(5*8-3))) {
} else if (x < ((int64)1<<(5*8-3))) {
- b[0] = (
x >> 32) | 0xC0
;
- b[1] =
x >> 24
;
- b[2] =
x >> 16
;
- b[3] =
x >> 8
;
- b[4] = x;
+ b[0] = (
char)((x >> 32) | 0xC0)
;
+ b[1] =
(char)(x >> 24)
;
+ b[2] =
(char)(x >> 16)
;
+ b[3] =
(char)(x >> 8)
;
+ b[4] =
(char)
x;
writefd(f, b, 5);
writefd(f, b, 5);
-#if SIZEOF_INT64 >= 8
} else if (x < ((int64)1<<(6*8-4))) {
} else if (x < ((int64)1<<(6*8-4))) {
- b[0] = (
x >> 40) | 0xE0
;
- b[1] =
x >> 32
;
- b[2] =
x >> 24
;
- b[3] =
x >> 16
;
- b[4] =
x >> 8
;
- b[5] = x;
+ b[0] = (
char)((x >> 40) | 0xE0)
;
+ b[1] =
(char)(x >> 32)
;
+ b[2] =
(char)(x >> 24)
;
+ b[3] =
(char)(x >> 16)
;
+ b[4] =
(char)(x >> 8)
;
+ b[5] =
(char)
x;
writefd(f, b, 6);
} else if (x < ((int64)1<<(7*8-5))) {
writefd(f, b, 6);
} else if (x < ((int64)1<<(7*8-5))) {
- b[0] = (
x >> 48) | 0xF0
;
- b[1] =
x >> 40
;
- b[2] =
x >> 32
;
- b[3] =
x >> 24
;
- b[4] =
x >> 16
;
- b[5] =
x >> 8
;
- b[6] = x;
+ b[0] = (
char)((x >> 48) | 0xF0)
;
+ b[1] =
(char)(x >> 40)
;
+ b[2] =
(char)(x >> 32)
;
+ b[3] =
(char)(x >> 24)
;
+ b[4] =
(char)(x >> 16)
;
+ b[5] =
(char)(x >> 8)
;
+ b[6] =
(char)
x;
writefd(f, b, 7);
} else if (x < ((int64)1<<(8*8-6))) {
writefd(f, b, 7);
} else if (x < ((int64)1<<(8*8-6))) {
- b[0] = (
x >> 56) | 0xF8
;
- b[1] =
x >> 48
;
- b[2] =
x >> 40
;
- b[3] =
x >> 32
;
- b[4] =
x >> 24
;
- b[5] =
x >> 16
;
- b[6] =
x >> 8
;
- b[7] = x;
+ b[0] = (
char)((x >> 56) | 0xF8)
;
+ b[1] =
(char)(x >> 48)
;
+ b[2] =
(char)(x >> 40)
;
+ b[3] =
(char)(x >> 32)
;
+ b[4] =
(char)(x >> 24)
;
+ b[5] =
(char)(x >> 16)
;
+ b[6] =
(char)(x >> 8)
;
+ b[7] =
(char)
x;
writefd(f, b, 8);
} else {
all_bits:
writefd(f, b, 8);
} else {
all_bits:
- b[0] = 0xFC;
- b[1] =
x >> 56
;
- b[2] =
x >> 48
;
- b[3] =
x >> 40
;
- b[4] =
x >> 32
;
- b[5] =
x >> 24
;
- b[6] =
x >> 16
;
- b[7] =
x >> 8
;
- b[8] = x;
+ b[0] =
(char)
0xFC;
+ b[1] =
(char)(x >> 56)
;
+ b[2] =
(char)(x >> 48)
;
+ b[3] =
(char)(x >> 40)
;
+ b[4] =
(char)(x >> 32)
;
+ b[5] =
(char)(x >> 24)
;
+ b[6] =
(char)(x >> 16)
;
+ b[7] =
(char)(x >> 8)
;
+ b[8] =
(char)
x;
writefd(f, b, 9);
writefd(f, b, 9);
-#endif
}
}
+#endif
}
void write_buf(int f, const char *buf, size_t len)
}
void write_buf(int f, const char *buf, size_t len)