diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 15:49:10 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 15:49:10 +0400 |
commit | dcef29b69120cbfe4522f2658b6853fbdd642003 (patch) | |
tree | 3d58fd05182923e6f5c25364cef73a65f3040cb5 /source/blender/blenlib | |
parent | 7e7081551d9afd5eded827900098472585f527de (diff) |
Fix compilation error on platforms where PATH_MAX is not defined
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 34c6e632131..338ceee1e3d 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -255,11 +255,18 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname) 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 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname) dir_ctx->nrfiles++; file++; dlink = dlink->next; +#ifndef MAXPATHLEN + MEM_freeN(fullname); +#endif } } else { |