diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-11 10:51:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-11 10:51:12 +0300 |
commit | 030253cdf665648eb5a16f3be910ceae26979f30 (patch) | |
tree | 1c6f2732bd77840c6056c11d788bf786bdf39299 /source/blender/blenlib | |
parent | 80a650dfb1e73363ae6924dc5738b732bb89ded4 (diff) |
fix for building, also use const char in more places.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_bpath.h | 24 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_storage.h | 14 | ||||
-rw-r--r-- | source/blender/blenlib/intern/bpath.c | 31 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 8 |
4 files changed, 40 insertions, 37 deletions
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h index 34b9e282061..47dfea8b91a 100644 --- a/source/blender/blenlib/BLI_bpath.h +++ b/source/blender/blenlib/BLI_bpath.h @@ -41,39 +41,39 @@ struct BPathIteratorSeqData { struct BPathIterator { char* path; - char* lib; - char* name; + const char* lib; + const char* name; void* data; int len; int type; - void (*setpath_callback)(struct BPathIterator *, char *); + void (*setpath_callback)(struct BPathIterator *, const char *); void (*getpath_callback)(struct BPathIterator *, char *); - char* base_path; /* base path, the directry the blend file is in - normally G.main->name */ + const char* base_path; /* base path, the directry the blend file is in - normally G.main->name */ /* only for seq data */ struct BPathIteratorSeqData seqdata; }; -void BLI_bpathIterator_init (struct BPathIterator *bpi, char *base_path); +void BLI_bpathIterator_init (struct BPathIterator *bpi, const char *base_path); void BLI_bpathIterator_free (struct BPathIterator *bpi); -char* BLI_bpathIterator_getLib (struct BPathIterator *bpi); -char* BLI_bpathIterator_getName (struct BPathIterator *bpi); +const char* BLI_bpathIterator_getLib (struct BPathIterator *bpi); +const char* BLI_bpathIterator_getName (struct BPathIterator *bpi); int BLI_bpathIterator_getType (struct BPathIterator *bpi); int BLI_bpathIterator_getPathMaxLen (struct BPathIterator *bpi); void BLI_bpathIterator_step (struct BPathIterator *bpi); int BLI_bpathIterator_isDone (struct BPathIterator *bpi); void BLI_bpathIterator_getPath (struct BPathIterator *bpi, char *path); void BLI_bpathIterator_getPathExpanded (struct BPathIterator *bpi, char *path_expanded); -void BLI_bpathIterator_setPath (struct BPathIterator *bpi, char *path); +void BLI_bpathIterator_setPath (struct BPathIterator *bpi, const char *path); /* high level funcs */ /* creates a text file with missing files if there are any */ -void checkMissingFiles(char *basepath, ReportList *reports); -void makeFilesRelative(char *basepath, ReportList *reports); -void makeFilesAbsolute(char *basepath, ReportList *reports); -void findMissingFiles(char *basepath, char *str); +void checkMissingFiles(const char *basepath, ReportList *reports); +void makeFilesRelative(const char *basepath, ReportList *reports); +void makeFilesAbsolute(const char *basepath, ReportList *reports); +void findMissingFiles(const char *basepath, const char *str); #endif // BLI_BPATH_H diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h index e52ea1600eb..0996b19a854 100644 --- a/source/blender/blenlib/BLI_storage.h +++ b/source/blender/blenlib/BLI_storage.h @@ -38,19 +38,19 @@ struct direntry; void BLI_adddirstrings(void); -void BLI_builddir(char *dirname, char *relname); +void BLI_builddir(const char *dirname, const char *relname); int BLI_compare(struct direntry *entry1, struct direntry *entry2); size_t BLI_filesize(int file); size_t BLI_filepathsize(const char *path); -double BLI_diskfree(char *dir); -char *BLI_getwdN(char *dir); +double BLI_diskfree(const char *dir); +char *BLI_getwdN(const char *dir); -unsigned int BLI_getdir(char *dirname, struct direntry **filelist); +unsigned int BLI_getdir(const char *dirname, struct direntry **filelist); /** * @attention Do not confuse with BLI_exists */ -int BLI_exist(char *name); +int BLI_exist(const char *name); /** * Read a file as ASCII lines. An empty list is * returned if the file cannot be opened or read. @@ -62,9 +62,9 @@ int BLI_exist(char *name); * @retval A list of strings representing the file lines. */ -int BLI_is_dir(char *file); +int BLI_is_dir(const char *file); -struct LinkNode *BLI_read_file_as_lines(char *name); +struct LinkNode *BLI_read_file_as_lines(const char *name); /** * Free the list returned by BLI_read_file_as_lines. diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 8711857f83a..06932f24bcb 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -79,7 +79,7 @@ enum BPathTypes { BPATH_DONE }; -void BLI_bpathIterator_init( struct BPathIterator *bpi, char *base_path ) { +void BLI_bpathIterator_init( struct BPathIterator *bpi, const char *base_path ) { bpi->type = BPATH_IMAGE; bpi->data = NULL; @@ -112,7 +112,7 @@ void BLI_bpathIterator_getPath( struct BPathIterator *bpi, char *path) { } } -void BLI_bpathIterator_setPath( struct BPathIterator *bpi, char *path) { +void BLI_bpathIterator_setPath( struct BPathIterator *bpi, const char *path) { if (bpi->setpath_callback) { bpi->setpath_callback( bpi, path ); } else { @@ -121,7 +121,7 @@ void BLI_bpathIterator_setPath( struct BPathIterator *bpi, char *path) { } void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_expanded) { - char *libpath; + const char *libpath; BLI_bpathIterator_getPath(bpi, path_expanded); libpath = BLI_bpathIterator_getLib(bpi); @@ -133,10 +133,10 @@ void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_ex } BLI_cleanup_file(NULL, path_expanded); } -char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) { +const char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) { return bpi->lib; } -char* BLI_bpathIterator_getName( struct BPathIterator *bpi) { +const char* BLI_bpathIterator_getName( struct BPathIterator *bpi) { return bpi->name; } int BLI_bpathIterator_getType( struct BPathIterator *bpi) { @@ -275,7 +275,7 @@ static void seq_getpath(struct BPathIterator *bpi, char *path) { } } -static void seq_setpath(struct BPathIterator *bpi, char *path) { +static void seq_setpath(struct BPathIterator *bpi, const char *path) { Sequence *seq = (Sequence *)bpi->data; if (seq==NULL) return; @@ -443,7 +443,7 @@ int BLI_bpathIterator_isDone( struct BPathIterator *bpi) { static void bpath_as_report(struct BPathIterator *bpi, const char *message, ReportList *reports) { char *prefix; - char *name; + const char *name; char path_expanded[FILE_MAXDIR*2]; if(reports==NULL) @@ -484,7 +484,7 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo } /* high level function */ -void checkMissingFiles(char *basepath, ReportList *reports) { +void checkMissingFiles(const char *basepath, ReportList *reports) { struct BPathIterator bpi; /* be sure there is low chance of the path being too short */ @@ -503,10 +503,11 @@ void checkMissingFiles(char *basepath, ReportList *reports) { } /* dont log any errors at the moment, should probably do this */ -void makeFilesRelative(char *basepath, ReportList *reports) { +void makeFilesRelative(const char *basepath, ReportList *reports) { int tot= 0, changed= 0, failed= 0, linked= 0; struct BPathIterator bpi; - char filepath[FILE_MAX], *libpath; + char filepath[FILE_MAX]; + const char *libpath; /* be sure there is low chance of the path being too short */ char filepath_relative[(FILE_MAXDIR * 2) + FILE_MAXFILE]; @@ -551,12 +552,13 @@ void makeFilesRelative(char *basepath, ReportList *reports) { /* dont log any errors at the moment, should probably do this - * Verry similar to makeFilesRelative - keep in sync! */ -void makeFilesAbsolute(char *basepath, ReportList *reports) +void makeFilesAbsolute(const char *basepath, ReportList *reports) { int tot= 0, changed= 0, failed= 0, linked= 0; struct BPathIterator bpi; - char filepath[FILE_MAX], *libpath; + char filepath[FILE_MAX]; + const char *libpath; /* be sure there is low chance of the path being too short */ char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE]; @@ -652,12 +654,13 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char } /* high level function - call from fileselector */ -void findMissingFiles(char *basepath, char *str) { +void findMissingFiles(const char *basepath, const char *str) { struct BPathIterator bpi; /* be sure there is low chance of the path being too short */ char filepath_expanded[FILE_MAXDIR*2]; - char filepath[FILE_MAX], *libpath; + char filepath[FILE_MAX]; + const char *libpath; int filesize, recur_depth; char dirname[FILE_MAX], filename_new[FILE_MAX]; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 9c31557619b..5122dea3b8c 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -146,7 +146,7 @@ int BLI_compare(struct direntry *entry1, struct direntry *entry2) } -double BLI_diskfree(char *dir) +double BLI_diskfree(const char *dir) { #ifdef WIN32 DWORD sectorspc, bytesps, freec, clusters; @@ -201,7 +201,7 @@ double BLI_diskfree(char *dir) #endif } -void BLI_builddir(char *dirname, char *relname) +void BLI_builddir(const char *dirname, char *relname) { struct dirent *fname; struct dirlink *dlink; @@ -397,7 +397,7 @@ void BLI_adddirstrings() } } -unsigned int BLI_getdir(char *dirname, struct direntry **filelist) +unsigned int BLI_getdir(const char *dirname, struct direntry **filelist) { // reset global variables // memory stored in files is free()'d in @@ -443,7 +443,7 @@ size_t BLI_filepathsize(const char *path) } -int BLI_exist(char *name) +int BLI_exist(const char *name) { #if defined(WIN32) && !defined(__MINGW32__) struct _stat64i32 st; |