mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 12:40:56 +00:00
index: fix cast warnings
/home/kas/git/public/libgit2/src/index.c: In function ‘git_index_clear’: /home/kas/git/public/libgit2/src/index.c:228:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c:235:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c: In function ‘index_insert’: /home/kas/git/public/libgit2/src/index.c:392:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c:399:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c: In function ‘read_unmerged’: /home/kas/git/public/libgit2/src/index.c:681:35: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c: In function ‘read_entry’: /home/kas/git/public/libgit2/src/index.c:716:33: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
This commit is contained in:
parent
84ef7f3636
commit
7d9cc9f81a
@ -98,14 +98,14 @@ typedef struct git_index_entry {
|
||||
unsigned short flags;
|
||||
unsigned short flags_extended;
|
||||
|
||||
const char *path;
|
||||
char *path;
|
||||
} git_index_entry;
|
||||
|
||||
/** Representation of an unmerged file entry in the index. */
|
||||
typedef struct git_index_entry_unmerged {
|
||||
unsigned int mode[3];
|
||||
git_oid oid[3];
|
||||
const char *path;
|
||||
char *path;
|
||||
} git_index_entry_unmerged;
|
||||
|
||||
/**
|
||||
|
12
src/index.c
12
src/index.c
@ -227,14 +227,14 @@ void git_index_clear(git_index *index)
|
||||
for (i = 0; i < index->entries.length; ++i) {
|
||||
git_index_entry *e;
|
||||
e = git_vector_get(&index->entries, i);
|
||||
free((char *)e->path);
|
||||
free(e->path);
|
||||
free(e);
|
||||
}
|
||||
|
||||
for (i = 0; i < index->unmerged.length; ++i) {
|
||||
git_index_entry_unmerged *e;
|
||||
e = git_vector_get(&index->unmerged, i);
|
||||
free((char *)e->path);
|
||||
free(e->path);
|
||||
free(e);
|
||||
}
|
||||
|
||||
@ -391,14 +391,14 @@ static int index_insert(git_index *index, const git_index_entry *source_entry, i
|
||||
|
||||
/* exists, replace it */
|
||||
entry_array = (git_index_entry **) index->entries.contents;
|
||||
free((char *)entry_array[position]->path);
|
||||
free(entry_array[position]->path);
|
||||
free(entry_array[position]);
|
||||
entry_array[position] = entry;
|
||||
|
||||
return GIT_SUCCESS;
|
||||
|
||||
cleanup_oom:
|
||||
free((char *)entry->path);
|
||||
free(entry->path);
|
||||
free(entry);
|
||||
return GIT_ENOMEM;;
|
||||
}
|
||||
@ -680,7 +680,7 @@ static int read_unmerged(git_index *index, const char *buffer, size_t size)
|
||||
continue;
|
||||
if (size < 20)
|
||||
return git__throw(GIT_ERROR, "Failed to read unmerged entries");
|
||||
git_oid_fromraw(&lost->oid[i], (unsigned char *) buffer);
|
||||
git_oid_fromraw(&lost->oid[i], (const unsigned char *) buffer);
|
||||
size -= 20;
|
||||
buffer += 20;
|
||||
}
|
||||
@ -715,7 +715,7 @@ static size_t read_entry(git_index_entry *dest, const void *buffer, size_t buffe
|
||||
dest->flags = ntohs(source->flags);
|
||||
|
||||
if (dest->flags & GIT_IDXENTRY_EXTENDED) {
|
||||
struct entry_long *source_l = (struct entry_long *)source;
|
||||
const struct entry_long *source_l = (const struct entry_long *)source;
|
||||
path_ptr = source_l->path;
|
||||
|
||||
flags_raw = ntohs(source_l->flags_extended);
|
||||
|
Loading…
Reference in New Issue
Block a user