[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59290] trunk/blender/source/blender/ blenlib/intern/storage.c: Fix compilation error on platforms where PATH_MAX is not defined
Sergey Sharybin
sergey.vfx at gmail.com
Mon Aug 19 13:49:10 CEST 2013
Revision: 59290
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59290
Author: nazgul
Date: 2013-08-19 11:49:10 +0000 (Mon, 19 Aug 2013)
Log Message:
-----------
Fix compilation error on platforms where PATH_MAX is not defined
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/storage.c
Modified: trunk/blender/source/blender/blenlib/intern/storage.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/storage.c 2013-08-19 11:37:42 UTC (rev 59289)
+++ trunk/blender/source/blender/blenlib/intern/storage.c 2013-08-19 11:49:10 UTC (rev 59290)
@@ -255,11 +255,18 @@
struct dirlink * dlink = (struct dirlink *) dirbase.first;
struct direntry *file = &dir_ctx->files[dir_ctx->nrfiles];
while (dlink) {
- char fullname[PATH_MAX];
+#ifdef PATH_MAX
+ char static_fullname[PATH_MAX];
+ char *fullname = static_fullname;
+ size_t fullname_size = PATH_MAX;
+#else
+ size_t fullname_size = strlen(dirname) + strlen(dlink->name) + 2;
+ char *fullname = MEM_mallocN(fullname_size, "bli_builddir fullname");
+#endif
memset(file, 0, sizeof(struct direntry));
file->relname = dlink->name;
file->path = BLI_strdupcat(dirname, dlink->name);
- BLI_join_dirfile(fullname, sizeof(fullname), dirname, dlink->name);
+ BLI_join_dirfile(fullname, fullname_size, dirname, dlink->name);
// use 64 bit file size, only needed for WIN32 and WIN64.
// Excluding other than current MSVC compiler until able to test
#ifdef WIN32
@@ -281,6 +288,9 @@
dir_ctx->nrfiles++;
file++;
dlink = dlink->next;
+#ifndef MAXPATHLEN
+ MEM_freeN(fullname);
+#endif
}
}
else {
More information about the Bf-blender-cvs
mailing list