[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34795] trunk/blender: last commit.
Campbell Barton
ideasman42 at gmail.com
Sat Feb 12 12:50:16 CET 2011
Revision: 34795
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34795
Author: campbellbarton
Date: 2011-02-12 11:50:14 +0000 (Sat, 12 Feb 2011)
Log Message:
-----------
last commit. r34794 didn't fix all cases of bad BLI_getwdN() use.
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34794
Modified Paths:
--------------
trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
trunk/blender/source/blender/blenlib/BLI_utildefines.h
trunk/blender/source/blender/blenlib/intern/path_util.c
trunk/blender/source/blender/blenlib/intern/storage.c
trunk/blender/source/blender/editors/space_file/filelist.c
Modified: trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
===================================================================
--- trunk/blender/intern/guardedalloc/MEM_guardedalloc.h 2011-02-12 10:37:37 UTC (rev 34794)
+++ trunk/blender/intern/guardedalloc/MEM_guardedalloc.h 2011-02-12 11:50:14 UTC (rev 34795)
@@ -59,13 +59,14 @@
#include "stdio.h" /* needed for FILE* */
#include "BLO_sys_types.h" /* needed for uintptr_t */
-#ifdef __GNUC__
-# define WARN_UNUSED __attribute__((warn_unused_result))
-#else
-# define WARN_UNUSED
+#ifndef WARN_UNUSED
+# ifdef __GNUC__
+# define WARN_UNUSED __attribute__((warn_unused_result))
+# else
+# define WARN_UNUSED
+# endif
#endif
-
#ifdef __cplusplus
extern "C" {
#endif
Modified: trunk/blender/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_utildefines.h 2011-02-12 10:37:37 UTC (rev 34794)
+++ trunk/blender/source/blender/blenlib/BLI_utildefines.h 2011-02-12 11:50:14 UTC (rev 34795)
@@ -169,6 +169,11 @@
# define UNUSED(x) UNUSED_ ## x
#endif
+#ifdef __GNUC__
+# define WARN_UNUSED __attribute__((warn_unused_result))
+#else
+# define WARN_UNUSED
+#endif
/*little macro so inline keyword works*/
#if defined(_MSC_VER)
Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c 2011-02-12 10:37:37 UTC (rev 34794)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c 2011-02-12 11:50:14 UTC (rev 34795)
@@ -752,7 +752,7 @@
#endif
if (wasrelative==1) {
- char cwd[FILE_MAXDIR + FILE_MAXFILE];
+ char cwd[FILE_MAXDIR + FILE_MAXFILE]= "";
BLI_getwdN(cwd, sizeof(cwd)); /* incase the full path to the blend isnt used */
if (cwd[0] == '\0') {
Modified: trunk/blender/source/blender/blenlib/intern/storage.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/storage.c 2011-02-12 10:37:37 UTC (rev 34794)
+++ trunk/blender/source/blender/blenlib/intern/storage.c 2011-02-12 11:50:14 UTC (rev 34795)
@@ -89,6 +89,7 @@
#include "BLI_listbase.h"
#include "BLI_linklist.h"
+#include "BLI_storage.h"
#include "BLI_storage_types.h"
#include "BLI_string.h"
@@ -105,16 +106,13 @@
char *BLI_getwdN(char *dir, const int maxncpy)
{
- if (dir) {
- const char *pwd= getenv("PWD");
- if (pwd){
- BLI_strncpy(dir, pwd, maxncpy);
- return(dir);
- }
-
- return getcwd(dir, maxncpy);
+ const char *pwd= getenv("PWD");
+ if (pwd){
+ BLI_strncpy(dir, pwd, maxncpy);
+ return dir;
}
- return(0);
+
+ return getcwd(dir, maxncpy);
}
@@ -475,7 +473,7 @@
return S_ISDIR(BLI_exist(file));
}
-LinkNode *BLI_read_file_as_lines(char *name)
+LinkNode *BLI_read_file_as_lines(const char *name)
{
FILE *fp= fopen(name, "r");
LinkNode *lines= NULL;
Modified: trunk/blender/source/blender/editors/space_file/filelist.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filelist.c 2011-02-12 10:37:37 UTC (rev 34794)
+++ trunk/blender/source/blender/editors/space_file/filelist.c 2011-02-12 11:50:14 UTC (rev 34795)
@@ -833,13 +833,13 @@
static void filelist_read_dir(struct FileList* filelist)
{
- char wdir[FILE_MAX];
+ char wdir[FILE_MAX]= "";
if (!filelist) return;
filelist->fidx = 0;
filelist->filelist = 0;
- BLI_getwdN(wdir, sizeof(wdir));
+ BLI_getwdN(wdir, sizeof(wdir)); /* backup cwd to restore after */
BLI_cleanup_dir(G.main->name, filelist->dir);
filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist));
More information about the Bf-blender-cvs
mailing list