1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 15:20:15 +02:00

Fix build failure caused by undefined PATH_MAX.

Use PATH_MAX for PLATFORM_MAX_PATH only if it is defined and replace all
instances of PATH_MAX by PLATFORM_MAX_PATH.
This commit is contained in:
benjamin.drung@gmail.com 2013-11-21 20:52:17 +00:00
parent c7c15e09d8
commit 7d4bc6917b
3 changed files with 7 additions and 3 deletions

View File

@ -69,6 +69,7 @@ class wxWindow;
void QuitAudacity(bool bForce); void QuitAudacity(bool bForce);
void QuitAudacity(); void QuitAudacity();
// Please try to support unlimited path length instead of using PLATFORM_MAX_PATH!
// Define one constant for maximum path value, so we don't have to do // Define one constant for maximum path value, so we don't have to do
// platform-specific conditionals everywhere we want to check it. // platform-specific conditionals everywhere we want to check it.
#define PLATFORM_MAX_PATH 260 // Play it safe for default, with same value as Windows' MAX_PATH. #define PLATFORM_MAX_PATH 260 // Play it safe for default, with same value as Windows' MAX_PATH.
@ -81,9 +82,12 @@ void QuitAudacity();
#ifdef __WXGTK__ #ifdef __WXGTK__
#include "configunix.h" #include "configunix.h"
// Some systems do not restrict the path length and therefore PATH_MAX is undefined
#ifdef PATH_MAX
#undef PLATFORM_MAX_PATH #undef PLATFORM_MAX_PATH
#define PLATFORM_MAX_PATH PATH_MAX #define PLATFORM_MAX_PATH PATH_MAX
#endif #endif
#endif
#ifdef __WXX11__ #ifdef __WXX11__
#include "configunix.h" #include "configunix.h"

View File

@ -225,10 +225,10 @@ wxString FileNames::PathFromAddr(void *addr)
#if defined(__WXMAC__) || defined(__WXGTK__) #if defined(__WXMAC__) || defined(__WXGTK__)
Dl_info info; Dl_info info;
if (dladdr(addr, &info)) { if (dladdr(addr, &info)) {
char realname[PATH_MAX + 1]; char realname[PLATFORM_MAX_PATH + 1];
int len; int len;
name = LAT1CTOWX(info.dli_fname); name = LAT1CTOWX(info.dli_fname);
len = readlink(OSINPUT(name.GetFullPath()), realname, PATH_MAX); len = readlink(OSINPUT(name.GetFullPath()), realname, PLATFORM_MAX_PATH);
if (len > 0) { if (len > 0) {
realname[len] = 0; realname[len] = 0;
name.SetFullName(LAT1CTOWX(realname)); name.SetFullName(LAT1CTOWX(realname));

View File

@ -2142,7 +2142,7 @@ bool VSTEffect::Load()
} }
// Convert back to path // Convert back to path
UInt8 exePath[PATH_MAX]; UInt8 exePath[PLATFORM_MAX_PATH];
success = CFURLGetFileSystemRepresentation(exeRef, true, exePath, sizeof(exePath)); success = CFURLGetFileSystemRepresentation(exeRef, true, exePath, sizeof(exePath));
// Done with the executable reference // Done with the executable reference