Skip to content

Commit bf0f910

Browse files
Brian GerstLinus Torvalds
authored andcommitted
[PATCH] Kill a bunch of pointer sign warnings for gcc4
- Raw hashes should be unsigned char. - String functions want signed char. - Hash and compress functions want unsigned char. Signed-off By: Brian Gerst <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 02481ae commit bf0f910

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ extern char *sha1_file_name(const unsigned char *sha1);
143143
extern void * map_sha1_file(const unsigned char *sha1, unsigned long *size);
144144
extern void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned long *size);
145145
extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size);
146-
extern int write_sha1_file(char *buf, unsigned long len, const char *type, unsigned char *return_sha1);
146+
extern int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *return_sha1);
147147

148148
extern int check_sha1_signature(unsigned char *sha1, void *buf, unsigned long size, const char *type);
149149

@@ -167,7 +167,7 @@ extern int error(const char *err, ...);
167167
extern int cache_name_compare(const char *name1, int len1, const char *name2, int len2);
168168

169169
extern void *read_object_with_reference(const unsigned char *sha1,
170-
const unsigned char *required_type,
170+
const char *required_type,
171171
unsigned long *size,
172172
unsigned char *sha1_ret);
173173

diff-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static int show_modified(struct cache_entry *old,
6363
{
6464
unsigned int mode, oldmode;
6565
unsigned char *sha1;
66-
unsigned char old_sha1_hex[60];
66+
char old_sha1_hex[60];
6767

6868
if (get_stat_data(new, &sha1, &mode) < 0) {
6969
if (report_missing)

diff-files.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static void show_file(int pfx, struct cache_entry *ce)
4848
}
4949

5050
static void show_modified(int oldmode, int mode,
51-
const char *old_sha1, const char *sha1,
51+
const unsigned char *old_sha1, const unsigned char *sha1,
5252
char *path)
5353
{
5454
char old_sha1_hex[41];
@@ -64,7 +64,7 @@ static void show_modified(int oldmode, int mode,
6464

6565
int main(int argc, char **argv)
6666
{
67-
static const char null_sha1[20] = { 0, };
67+
static const unsigned char null_sha1[20] = { 0, };
6868
int entries = read_cache();
6969
int i;
7070

http-pull.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static int zret;
2424

2525
static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
2626
void *data) {
27-
char expn[4096];
27+
unsigned char expn[4096];
2828
size_t size = eltsize * nmemb;
2929
int posn = 0;
3030
do {
@@ -49,7 +49,7 @@ int fetch(unsigned char *sha1)
4949
{
5050
char *hex = sha1_to_hex(sha1);
5151
char *filename = sha1_file_name(sha1);
52-
char real_sha1[20];
52+
unsigned char real_sha1[20];
5353
char *url;
5454
char *posn;
5555

ls-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static void print_path_prefix(struct path_prefix *prefix)
2424
}
2525

2626
static void list_recursive(void *buffer,
27-
const unsigned char *type,
27+
const char *type,
2828
unsigned long size,
2929
struct path_prefix *prefix)
3030
{

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ int read_cache(void)
344344
}
345345

346346
#define WRITE_BUFFER_SIZE 8192
347-
static char write_buffer[WRITE_BUFFER_SIZE];
347+
static unsigned char write_buffer[WRITE_BUFFER_SIZE];
348348
static unsigned long write_buffer_len;
349349

350350
static int ce_write(SHA_CTX *context, int fd, void *data, unsigned int len)

rpush.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
void service(int fd_in, int fd_out) {
77
ssize_t size;
88
int posn;
9-
char sha1[20];
9+
char unsigned sha1[20];
1010
unsigned long objsize;
1111
void *buf;
1212
do {

sha1_file.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,13 @@ void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned l
313313
int ret, bytes;
314314
z_stream stream;
315315
char buffer[8192];
316-
char *buf;
316+
unsigned char *buf;
317317

318318
/* Get the data stream */
319319
memset(&stream, 0, sizeof(stream));
320320
stream.next_in = map;
321321
stream.avail_in = mapsize;
322-
stream.next_out = buffer;
322+
stream.next_out = (unsigned char *)buffer;
323323
stream.avail_out = sizeof(buffer);
324324

325325
inflateInit(&stream);
@@ -359,7 +359,7 @@ void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size
359359
}
360360

361361
void *read_object_with_reference(const unsigned char *sha1,
362-
const unsigned char *required_type,
362+
const char *required_type,
363363
unsigned long *size,
364364
unsigned char *actual_sha1_return)
365365
{
@@ -403,20 +403,20 @@ void *read_object_with_reference(const unsigned char *sha1,
403403
}
404404
}
405405

406-
int write_sha1_file(char *buf, unsigned long len, const char *type, unsigned char *returnsha1)
406+
int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *returnsha1)
407407
{
408408
int size;
409-
char *compressed;
409+
unsigned char *compressed;
410410
z_stream stream;
411411
unsigned char sha1[20];
412412
SHA_CTX c;
413413
char *filename;
414414
static char tmpfile[PATH_MAX];
415-
char hdr[50];
415+
unsigned char hdr[50];
416416
int fd, hdrlen, ret;
417417

418418
/* Generate the header */
419-
hdrlen = sprintf(hdr, "%s %lu", type, len)+1;
419+
hdrlen = sprintf((char *)hdr, "%s %lu", type, len)+1;
420420

421421
/* Sha1.. */
422422
SHA1_Init(&c);
@@ -516,8 +516,8 @@ int write_sha1_from_fd(const unsigned char *sha1, int fd)
516516
int local;
517517
z_stream stream;
518518
unsigned char real_sha1[20];
519-
char buf[4096];
520-
char discard[4096];
519+
unsigned char buf[4096];
520+
unsigned char discard[4096];
521521
int ret;
522522
SHA_CTX c;
523523

strbuf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ struct strbuf {
44
int alloc;
55
int len;
66
int eof;
7-
unsigned char *buf;
7+
char *buf;
88
};
99

1010
extern void strbuf_init(struct strbuf *);

tar-tree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static void append_extended_header(char **p, const char *keyword,
205205
append_char(p, '\n');
206206
}
207207

208-
static void write_header(const char *, char, const char *, struct path_prefix *,
208+
static void write_header(const unsigned char *, char, const char *, struct path_prefix *,
209209
const char *, unsigned int, void *, unsigned long);
210210

211211
/* stores a pax extended header directly in the block buffer */
@@ -238,7 +238,7 @@ static void write_extended_header(const char *headerfilename, int is_dir,
238238
free(buffer);
239239
}
240240

241-
static void write_global_extended_header(const char *sha1)
241+
static void write_global_extended_header(const unsigned char *sha1)
242242
{
243243
char *p;
244244
unsigned int size;
@@ -253,7 +253,7 @@ static void write_global_extended_header(const char *sha1)
253253
}
254254

255255
/* stores a ustar header directly in the block buffer */
256-
static void write_header(const char *sha1, char typeflag, const char *basepath,
256+
static void write_header(const unsigned char *sha1, char typeflag, const char *basepath,
257257
struct path_prefix *prefix, const char *path,
258258
unsigned int mode, void *buffer, unsigned long size)
259259
{

0 commit comments

Comments
 (0)