Skip to content

Commit

Permalink
Fix some signedness warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
cph6 committed Sep 19, 2010
1 parent cc319eb commit 69feacc
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions c/libzsync/zsync.c
Expand Up @@ -87,7 +87,7 @@ struct zsync_state {
* holding the in-progress local version of the target */
off_t filelen; /* Length of the target file */
int blocks; /* Number of blocks in the target */
long blocksize; /* Blocksize */
size_t blocksize; /* Blocksize */

/* Checksum of the entire file, and checksum alg */
char *checksum;
Expand Down Expand Up @@ -601,7 +601,7 @@ static int zsync_sha1(struct zsync_state *zs, int fh) {
SHA1_CTX shactx;

{ /* Do SHA1 of file contents */
char buf[4096];
unsigned char buf[4096];
int rc;

SHA1Init(&shactx);
Expand Down Expand Up @@ -655,7 +655,7 @@ static int zsync_recompress(struct zsync_state *zs) {

{ /* Add input filename, shell-escaped, to the command line */
int i = 0;
int j = strlen(cmd);
size_t j = strlen(cmd);
char c;

while ((c = zs->cur_filename[i++]) != 0 && j < sizeof(cmd) - 2) {
Expand Down Expand Up @@ -690,7 +690,7 @@ static int zsync_recompress(struct zsync_state *zs) {
while (!feof(g)) {
char buf[1024];
int r;
char *p = buf;
const char *p = buf;

if ((r = fread(buf, 1, sizeof(buf), g)) < 0) {
perror("fread");
Expand Down Expand Up @@ -776,7 +776,7 @@ void zsync_configure_zstream_for_zdata(const struct zsync_state *zs,

/* Read in 32k of leading uncompressed context - needed because the deflate
* compression method includes back-references to previously-seen strings. */
char wbuf[32768];
unsigned char wbuf[32768];
rcksum_read_known_data(zs->rs, wbuf, pos - lookback, lookback);

/* Fake an output buffer of 32k filled with data to zlib */
Expand Down Expand Up @@ -815,7 +815,7 @@ struct zsync_receiver {
struct zsync_state *zs; /* The zsync_state that we are downloading for */
struct z_stream_s strm; /* Decompression object */
int url_type; /* Compressed or not */
char *outbuf; /* Working buffer to keep incomplete blocks of data */
unsigned char *outbuf; /* Working buffer to keep incomplete blocks of data */
off_t outoffset; /* and the position in that buffer */
};

Expand Down Expand Up @@ -854,7 +854,7 @@ static int zsync_receive_data_uncompressed(struct zsync_receiver *zr,
const unsigned char *buf,
off_t offset, size_t len) {
int ret = 0;
int blocksize = zr->zs->blocksize;
size_t blocksize = zr->zs->blocksize;

if (0 != (offset % blocksize)) {
size_t x = len;
Expand Down Expand Up @@ -916,7 +916,7 @@ static int zsync_receive_data_compressed(struct zsync_receiver *zr,
size_t len) {
int ret = 0;
int eoz = 0;
int blocksize = zr->zs->blocksize;
size_t blocksize = zr->zs->blocksize;

if (!len)
return 0;
Expand Down Expand Up @@ -968,9 +968,8 @@ static int zsync_receive_data_compressed(struct zsync_receiver *zr,
zr->outoffset += blocksize;
}
else {
/* We were reading a block fragment; update outoffset, and we are nwo block-aligned. */
zr->outoffset +=
(((char *)(zr->strm.next_out)) - (zr->outbuf));
/* We were reading a block fragment; update outoffset, and we are now block-aligned. */
zr->outoffset += (zr->strm.next_out - zr->outbuf);
}
zr->strm.avail_out = blocksize;
zr->strm.next_out = zr->outbuf;
Expand Down

0 comments on commit 69feacc

Please sign in to comment.