Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-07-11 22:50:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-07-11 22:50:07 +0300
commit5c8fc8e505fdfcd82e24dae75e7454b6f7d61530 (patch)
treee6101a8790effc2111985f20dc5ff73cbc443e89
parent8c67b8ffe9fdab6698f20a39d5673b720e3d2756 (diff)
Use const for direntry strings
-rw-r--r--source/blender/blenlib/BLI_fileops_types.h4
-rw-r--r--source/blender/blenlib/intern/BLI_filelist.c4
-rw-r--r--source/blender/editors/space_file/file_draw.c2
-rw-r--r--source/blender/editors/space_file/filelist.c5
4 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h
index 0e6eab687ad..5a1126b05d2 100644
--- a/source/blender/blenlib/BLI_fileops_types.h
+++ b/source/blender/blenlib/BLI_fileops_types.h
@@ -43,8 +43,8 @@ struct ImBuf;
struct direntry {
mode_t type;
- char *relname;
- char *path;
+ const char *relname;
+ const char *path;
#ifdef WIN32 /* keep in sync with the definition of BLI_stat_t in BLI_fileops.h */
# if defined(_MSC_VER) || defined(__MINGW64__)
struct _stat64 s;
diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c
index 786eaa74df8..38a6781c159 100644
--- a/source/blender/blenlib/intern/BLI_filelist.c
+++ b/source/blender/blenlib/intern/BLI_filelist.c
@@ -379,9 +379,9 @@ void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries, void (
IMB_freeImBuf(entry->image);
}
if (entry->relname)
- MEM_freeN(entry->relname);
+ MEM_freeN((void *)entry->relname);
if (entry->path)
- MEM_freeN(entry->path);
+ MEM_freeN((void *)entry->path);
if (entry->poin && free_poin)
free_poin(entry->poin);
}
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 9a5ec197797..be602e7330e 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -282,7 +282,7 @@ static int get_file_icon(struct direntry *file)
return ICON_FILE_BLANK;
}
-static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, int width, int height, bool drag)
+static void file_draw_icon(uiBlock *block, const char *path, int sx, int sy, int icon, int width, int height, bool drag)
{
uiBut *but;
int x, y;
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 4048c9fc1a1..3358812796e 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1252,8 +1252,9 @@ static void filelist_from_main(struct FileList *filelist)
files->relname = BLI_strdup(id->name + 2);
}
else {
- files->relname = MEM_mallocN(sizeof(*files->relname) * (FILE_MAX + (MAX_ID_NAME - 2)), __func__);
- BLI_snprintf(files->relname, FILE_MAX + (MAX_ID_NAME - 2) + 3, "%s | %s", id->lib->name, id->name + 2);
+ char relname[FILE_MAX + (MAX_ID_NAME - 2) + 3];
+ BLI_snprintf(relname, sizeof(relname), "%s | %s", id->lib->name, id->name + 2);
+ files->relname = BLI_strdup(relname);
}
files->type |= S_IFREG;
#if 0 /* XXXXX TODO show the selection status of the objects */