[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41185] trunk/blender/source/blender: Code cleanup: remove BLI_exist, now there is only BLI_exists.
Campbell Barton
ideasman42 at gmail.com
Sat Oct 22 02:26:17 CEST 2011
"BLI_exist: Do not confuse with BLI_exists" --- was very confusing.
Thanks for fixing :)
On Sat, Oct 22, 2011 at 9:33 AM, Brecht Van Lommel
<brechtvanlommel at pandora.be> wrote:
> Revision: 41185
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41185
> Author: blendix
> Date: 2011-10-21 22:33:41 +0000 (Fri, 21 Oct 2011)
> Log Message:
> -----------
> Code cleanup: remove BLI_exist, now there is only BLI_exists. One function just
> called the other, they did the same thing.
>
> Modified Paths:
> --------------
> trunk/blender/source/blender/blenfont/intern/blf_dir.c
> trunk/blender/source/blender/blenkernel/intern/pointcache.c
> trunk/blender/source/blender/blenlib/BLI_fileops.h
> trunk/blender/source/blender/blenlib/BLI_path_util.h
> trunk/blender/source/blender/blenlib/BLI_storage.h
> trunk/blender/source/blender/blenlib/intern/fileops.c
> trunk/blender/source/blender/blenlib/intern/path_util.c
> trunk/blender/source/blender/blenlib/intern/storage.c
> trunk/blender/source/blender/collada/collada.cpp
> trunk/blender/source/blender/editors/physics/physics_fluid.c
> trunk/blender/source/blender/editors/space_file/file_ops.c
> trunk/blender/source/blender/editors/space_file/fsmenu.c
> trunk/blender/source/blender/makesrna/intern/rna_fluidsim.c
> trunk/blender/source/blender/render/intern/source/pipeline.c
>
> Modified: trunk/blender/source/blender/blenfont/intern/blf_dir.c
> ===================================================================
> --- trunk/blender/source/blender/blenfont/intern/blf_dir.c 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/blenfont/intern/blf_dir.c 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -136,7 +136,7 @@
>
> for(dir=global_font_dir.first; dir; dir= dir->next) {
> BLI_join_dirfile(full_path, sizeof(full_path), dir->path, file);
> - if (BLI_exist(full_path)) {
> + if (BLI_exists(full_path)) {
> s= BLI_strdup(full_path);
> break;
> }
> @@ -144,7 +144,7 @@
>
> if (!s) {
> /* check the current directory, why not ? */
> - if (BLI_exist(file))
> + if (BLI_exists(file))
> s= BLI_strdup(file);
> }
>
> @@ -198,13 +198,13 @@
> s[2]= 'm';
>
> /* first check .afm */
> - if (BLI_exist(s))
> + if (BLI_exists(s))
> return s;
>
> /* and now check .pfm */
> s[0]= 'p';
>
> - if (BLI_exist(s))
> + if (BLI_exists(s))
> return s;
> }
> MEM_freeN(mfile);
>
> Modified: trunk/blender/source/blender/blenkernel/intern/pointcache.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/pointcache.c 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/blenkernel/intern/pointcache.c 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -2363,7 +2363,7 @@
>
> ptcache_path(NULL, path);
>
> - if (BLI_exist(path)) {
> + if (BLI_exists(path)) {
> /* The pointcache dir exists? - remove all pointcache */
>
> DIR *dir;
>
> Modified: trunk/blender/source/blender/blenlib/BLI_fileops.h
> ===================================================================
> --- trunk/blender/source/blender/blenlib/BLI_fileops.h 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/blenlib/BLI_fileops.h 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -46,10 +46,6 @@
> int BLI_link(const char *file, const char *to);
> int BLI_is_writable(const char *filename);
>
> -/**
> - * @attention Do not confuse with BLI_exist
> - */
> -int BLI_exists(const char *file);
> int BLI_copy_fileops(const char *file, const char *to);
> int BLI_rename(const char *from, const char *to);
> int BLI_gzip(const char *from, const char *to);
> @@ -58,11 +54,6 @@
> int BLI_move(const char *file, const char *to);
> int BLI_touch(const char *file);
>
> -/* only for the sane unix world: direct calls to system functions :( */
> -#ifndef WIN32
> -void BLI_setCmdCallBack(int (*f)(char*));
> -#endif
> -
> #ifdef __cplusplus
> }
> #endif
>
> Modified: trunk/blender/source/blender/blenlib/BLI_path_util.h
> ===================================================================
> --- trunk/blender/source/blender/blenlib/BLI_path_util.h 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/blenlib/BLI_path_util.h 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -65,10 +65,6 @@
> #define BLENDER_SYSTEM_PLUGINS 54
> #define BLENDER_SYSTEM_PYTHON 54
>
> -#define BLENDER_TEMP 80
> -
> -#define BLENDER_USERFOLDER(id) (id >= BLENDER_USER_CONFIG && id <= BLENDER_USER_PLUGINS)
> -
> /* for BLI_get_folder_version only */
> #define BLENDER_RESOURCE_PATH_USER 0
> #define BLENDER_RESOURCE_PATH_LOCAL 1
> @@ -79,17 +75,6 @@
> #define BLENDER_HISTORY_FILE "recent-files.txt"
>
> #ifdef WIN32
> -#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s"
> -#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s"
> -#elif defined(__APPLE__)
> -#define BLENDER_USER_FORMAT "%s/Blender/%s"
> -#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s"
> -#else
> -#define BLENDER_USER_FORMAT "%s/.blender/%s"
> -#define BLENDER_SYSTEM_FORMAT "%s/blender/%s"
> -#endif
> -
> -#ifdef WIN32
> #define SEP '\\'
> #define ALTSEP '/'
> #else
>
> Modified: trunk/blender/source/blender/blenlib/BLI_storage.h
> ===================================================================
> --- trunk/blender/source/blender/blenlib/BLI_storage.h 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/blenlib/BLI_storage.h 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -33,46 +33,35 @@
> * \ingroup bli
> */
>
> -#ifdef WIN32
> -/* for size_t, only needed on win32 for some reason */
> +/* for size_t (needed on windows) */
> #include <stddef.h>
> -#endif
>
> struct direntry;
>
> -
> -void BLI_adddirstrings(void);
> -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(const char *dir);
> char *BLI_getwdN(char *dir, const int maxncpy);
>
> unsigned int BLI_getdir(const char *dirname, struct direntry **filelist);
> -/**
> - * @attention Do not confuse with BLI_exists
> - */
> -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.
> - *
> - * @attention The returned list should be free'd with
> - * BLI_free_file_lines.
> - *
> - * @param name The name of the file to read.
> - * @retval A list of strings representing the file lines.
> - */
>
> + /* test if file or directory exists */
> +int BLI_exists(const char *name);
> + /* test if there is a directory at the specified path */
> int BLI_is_dir(const char *file);
>
> -struct LinkNode *BLI_read_file_as_lines(const char *name);
> +/**
> + * Read a file as ASCII lines. An empty list is
> + * returned if the file cannot be opened or read.
> + *
> + * @attention The returned list should be free'd with
> + * BLI_free_file_lines.
> + *
> + * @param name The name of the file to read.
> + * @retval A list of strings representing the file lines.
> + */
>
> - /**
> - * Free the list returned by BLI_read_file_as_lines.
> - */
> +struct LinkNode *BLI_read_file_as_lines(const char *name);
> void BLI_free_file_lines(struct LinkNode *lines);
>
> /* Compare if one was last modified before the other */
>
> Modified: trunk/blender/source/blender/blenlib/intern/fileops.c
> ===================================================================
> --- trunk/blender/source/blender/blenlib/intern/fileops.c 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/blenlib/intern/fileops.c 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -195,10 +195,6 @@
> return 0;
> }
>
> -int BLI_exists(const char *file) {
> - return BLI_exist(file);
> -}
> -
> #ifdef WIN32
>
> static char str[MAXPATHLEN+12];
>
> Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
> ===================================================================
> --- trunk/blender/source/blender/blenlib/intern/path_util.c 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/blenlib/intern/path_util.c 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -84,6 +84,18 @@
>
> #endif /* WIN32 */
>
> +/* standard paths */
> +#ifdef WIN32
> +#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s"
> +#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s"
> +#elif defined(__APPLE__)
> +#define BLENDER_USER_FORMAT "%s/Blender/%s"
> +#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s"
> +#else
> +#define BLENDER_USER_FORMAT "%s/.blender/%s"
> +#define BLENDER_SYSTEM_FORMAT "%s/blender/%s"
> +#endif
> +
> /* local */
> #define UNIQUE_NAME_MAX 128
>
> @@ -1635,7 +1647,7 @@
> int retval = 0;
> int type;
>
> - type = BLI_exist(name);
> + type = BLI_exists(name);
> if ((type == 0) || S_ISDIR(type)) {
> #ifdef _WIN32
> char filename[FILE_MAXDIR+FILE_MAXFILE];
> @@ -1655,7 +1667,7 @@
> strcat(filename, extensions);
> }
>
> - type = BLI_exist(filename);
> + type = BLI_exists(filename);
> if (type && (! S_ISDIR(type))) {
> retval = 1;
> strcpy(name, filename);
>
> Modified: trunk/blender/source/blender/blenlib/intern/storage.c
> ===================================================================
> --- trunk/blender/source/blender/blenlib/intern/storage.c 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/blenlib/intern/storage.c 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -438,7 +438,7 @@
> }
>
>
> -int BLI_exist(const char *name)
> +int BLI_exists(const char *name)
> {
> #if defined(WIN32) && !defined(__MINGW32__)
> struct _stat64i32 st;
> @@ -471,7 +471,7 @@
> /* would be better in fileops.c except that it needs stat.h so add here */
> int BLI_is_dir(const char *file)
> {
> - return S_ISDIR(BLI_exist(file));
> + return S_ISDIR(BLI_exists(file));
> }
>
> LinkNode *BLI_read_file_as_lines(const char *name)
>
> Modified: trunk/blender/source/blender/collada/collada.cpp
> ===================================================================
> --- trunk/blender/source/blender/collada/collada.cpp 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/collada/collada.cpp 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -60,7 +60,7 @@
> export_settings.filepath = (char *)filepath;
>
> /* annoying, collada crashes if file cant be created! [#27162] */
> - if(!BLI_exist(filepath)) {
> + if(!BLI_exists(filepath)) {
> BLI_make_existing_file(filepath); /* makes the dir if its not there */
> if(BLI_touch(filepath) == 0) {
> return 0;
>
> Modified: trunk/blender/source/blender/editors/physics/physics_fluid.c
> ===================================================================
> --- trunk/blender/source/blender/editors/physics/physics_fluid.c 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/editors/physics/physics_fluid.c 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -833,7 +833,7 @@
>
> curFrame++;
>
> - if((exists = BLI_exist(targetFile)))
> + if((exists = BLI_exists(targetFile)))
> {
> BLI_delete(targetFile, 0, 0);
> BLI_delete(targetFileVel, 0, 0);
>
> Modified: trunk/blender/source/blender/editors/space_file/file_ops.c
> ===================================================================
> --- trunk/blender/source/blender/editors/space_file/file_ops.c 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/editors/space_file/file_ops.c 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -749,7 +749,7 @@
>
> file_sfile_to_operator(op, sfile, filepath);
>
> - if (BLI_exist(sfile->params->dir))
> + if (BLI_exists(sfile->params->dir))
> fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir, 0, 1);
>
> BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE);
>
> Modified: trunk/blender/source/blender/editors/space_file/fsmenu.c
> ===================================================================
> --- trunk/blender/source/blender/editors/space_file/fsmenu.c 2011-10-21 20:26:54 UTC (rev 41184)
> +++ trunk/blender/source/blender/editors/space_file/fsmenu.c 2011-10-21 22:33:41 UTC (rev 41185)
> @@ -278,7 +278,7 @@
> if (line[len-1] == '\n') {
> line[len-1] = '\0';
> }
> - if (BLI_exist(line)) {
>
> @@ Diff output truncated at 10240 characters. @@
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
--
- Campbell
More information about the Bf-committers
mailing list