General const correctness fixes

We shouldn't attempt to assign constant strings into char*, as the
string is not writable at runtime.  Likewise we should always be
treating unsigned values as unsigned values, not as signed values.

Most of these are very straightforward.  The only exception is the
(unnecessary) xstrdup/free in builtin-branch.c for the detached
head case.  Since this is a user-level interactive type program
and that particular code path is executed no more than once, I feel
that the extra xstrdup call is well worth the easy elimination of
this warning.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Shawn O. Pearce
2007-03-06 20:44:17 -05:00
committed by Junio C Hamano
parent ff1f99453f
commit 3a55602eec
16 changed files with 40 additions and 42 deletions

View File

@ -132,7 +132,7 @@ static void convert_tree(void *buffer, unsigned long size, unsigned char *result
unsigned long orig_size = size;
while (size) {
int len = 1+strlen(buffer);
size_t len = 1+strlen(buffer);
convert_binary_sha1((char *) buffer + len);