Skip to content

Commit 63daae4

Browse files
committed
Two trivial -Wcast-qual fixes
Luiz Fernando N. Capitulino noticed the one in tree-walk.h where we cast away constness while computing the legnth of a tree entry. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0ce3964 commit 63daae4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cache-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)
478478
if (0 <= it->entry_count) {
479479
if (size < 20)
480480
goto free_return;
481-
hashcpy(it->sha1, (unsigned char*)buf);
481+
hashcpy(it->sha1, (const unsigned char*)buf);
482482
buf += 20;
483483
size -= 20;
484484
}

tree-walk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, co
2222

2323
static inline int tree_entry_len(const char *name, const unsigned char *sha1)
2424
{
25-
return (char *)sha1 - (char *)name - 1;
25+
return (const char *)sha1 - name - 1;
2626
}
2727

2828
void update_tree_entry(struct tree_desc *);

0 commit comments

Comments
 (0)