[PATCH] Fix several gcc4 signedness warnings
Here is a patch that fixes several gcc4 warnings about different signedness, all between char and unsigned char. I tried to keep the patch minimal so resertod to casts in three places. Signed-off-by: Mika Kukkonen <mikukkon@iki.fi> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
dc14841102
commit
d565b3412a
12
mkdelta.c
12
mkdelta.c
@ -36,10 +36,10 @@ static int replace_object(char *buf, unsigned long size, unsigned char *sha1)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *create_object(char *buf, unsigned long len, char *hdr, int hdrlen,
|
static void *create_object(unsigned char *buf, unsigned long len,
|
||||||
unsigned long *retsize)
|
char *hdr, int hdrlen, unsigned long *retsize)
|
||||||
{
|
{
|
||||||
char *compressed;
|
unsigned char *compressed;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ static void *create_object(char *buf, unsigned long len, char *hdr, int hdrlen,
|
|||||||
stream.avail_out = size;
|
stream.avail_out = size;
|
||||||
|
|
||||||
/* First header.. */
|
/* First header.. */
|
||||||
stream.next_in = hdr;
|
stream.next_in = (unsigned char *)hdr;
|
||||||
stream.avail_in = hdrlen;
|
stream.avail_in = hdrlen;
|
||||||
while (deflate(&stream, 0) == Z_OK)
|
while (deflate(&stream, 0) == Z_OK)
|
||||||
/* nothing */;
|
/* nothing */;
|
||||||
@ -69,7 +69,7 @@ static void *create_object(char *buf, unsigned long len, char *hdr, int hdrlen,
|
|||||||
return compressed;
|
return compressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int restore_original_object(char *buf, unsigned long len,
|
static int restore_original_object(unsigned char *buf, unsigned long len,
|
||||||
char *type, unsigned char *sha1)
|
char *type, unsigned char *sha1)
|
||||||
{
|
{
|
||||||
char hdr[50];
|
char hdr[50];
|
||||||
@ -84,7 +84,7 @@ static int restore_original_object(char *buf, unsigned long len,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *create_delta_object(char *buf, unsigned long len,
|
static void *create_delta_object(unsigned char *buf, unsigned long len,
|
||||||
unsigned char *sha1_ref, unsigned long *size)
|
unsigned char *sha1_ref, unsigned long *size)
|
||||||
{
|
{
|
||||||
char hdr[50];
|
char hdr[50];
|
||||||
|
2
pull.c
2
pull.c
@ -49,7 +49,7 @@ static int make_sure_we_have_it(const char *what, unsigned char *sha1)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (get_delta) {
|
if (get_delta) {
|
||||||
char delta_sha1[20];
|
unsigned char delta_sha1[20];
|
||||||
status = sha1_delta_base(sha1, delta_sha1);
|
status = sha1_delta_base(sha1, delta_sha1);
|
||||||
if (0 < status)
|
if (0 < status)
|
||||||
status = make_sure_we_have_it(what, delta_sha1);
|
status = make_sure_we_have_it(what, delta_sha1);
|
||||||
|
@ -332,7 +332,7 @@ int unpack_sha1_header(z_stream *stream, void *map, unsigned long mapsize, void
|
|||||||
void *unpack_sha1_rest(z_stream *stream, void *buffer, unsigned long size)
|
void *unpack_sha1_rest(z_stream *stream, void *buffer, unsigned long size)
|
||||||
{
|
{
|
||||||
int bytes = strlen(buffer) + 1;
|
int bytes = strlen(buffer) + 1;
|
||||||
char *buf = xmalloc(1+size);
|
unsigned char *buf = xmalloc(1+size);
|
||||||
|
|
||||||
memcpy(buf, buffer + bytes, stream->total_out - bytes);
|
memcpy(buf, buffer + bytes, stream->total_out - bytes);
|
||||||
bytes = stream->total_out - bytes;
|
bytes = stream->total_out - bytes;
|
||||||
@ -472,7 +472,7 @@ int sha1_file_size(const unsigned char *sha1, unsigned long *sizep)
|
|||||||
* The initial part of the delta starts at delta_data_head +
|
* The initial part of the delta starts at delta_data_head +
|
||||||
* 20. Borrow code from patch-delta to read the result size.
|
* 20. Borrow code from patch-delta to read the result size.
|
||||||
*/
|
*/
|
||||||
data = hdr + strlen(hdr) + 1 + 20;
|
data = (unsigned char *)(hdr + strlen(hdr) + 1 + 20);
|
||||||
|
|
||||||
/* Skip over the source size; we are not interested in
|
/* Skip over the source size; we are not interested in
|
||||||
* it and we cannot verify it because we do not want
|
* it and we cannot verify it because we do not want
|
||||||
|
@ -8,7 +8,7 @@ unsigned char remote_version = 0;
|
|||||||
int serve_object(int fd_in, int fd_out) {
|
int serve_object(int fd_in, int fd_out) {
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
int posn = 0;
|
int posn = 0;
|
||||||
char sha1[20];
|
unsigned char sha1[20];
|
||||||
unsigned long objsize;
|
unsigned long objsize;
|
||||||
void *buf;
|
void *buf;
|
||||||
signed char remote;
|
signed char remote;
|
||||||
|
@ -430,8 +430,8 @@ int main(int argc, char **argv)
|
|||||||
if (!archive_time)
|
if (!archive_time)
|
||||||
archive_time = time(NULL);
|
archive_time = time(NULL);
|
||||||
if (basedir)
|
if (basedir)
|
||||||
write_header("0", TYPEFLAG_DIR, NULL, NULL, basedir, 040755,
|
write_header((unsigned char *)"0", TYPEFLAG_DIR, NULL, NULL,
|
||||||
NULL, 0);
|
basedir, 040755, NULL, 0);
|
||||||
traverse_tree(buffer, size, NULL);
|
traverse_tree(buffer, size, NULL);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
write_trailer();
|
write_trailer();
|
||||||
|
Loading…
Reference in New Issue
Block a user