]> git.proxmox.com Git - libgit2.git/commitdiff
index: fix cast warnings
authorKirill A. Shutemov <kirill@shutemov.name>
Fri, 15 Jul 2011 14:46:55 +0000 (17:46 +0300)
committerVicent Marti <tanoku@gmail.com>
Mon, 25 Jul 2011 19:12:47 +0000 (21:12 +0200)
/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>
include/git2/index.h
src/index.c

index d34ed0a92b794ae9c4ea89446da4ce30d3e3b261..18ab9b858c7e40bac28eacfb142dce45862f52da 100644 (file)
@@ -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;
 
 /**
index 6390da3d7e9b12b6445676c2e4af1c18d1647bd7..bdae26c773d20b8790884dbb26a3a66db6e6aff7 100644 (file)
@@ -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);