From 8f98c4c73208f1827264aa3a3672df6cd2da21b5 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Mon, 9 Feb 2009 13:16:14 +0200 Subject: [PATCH] Cherry-pick fix for bug 412610 (MAXPATHLEN) --- js/src/jsfile.cpp | 5 +++++ modules/lcms/include/lcms.h | 7 ++++++- modules/libreg/src/reg.c | 8 ++++++++ widget/src/xremoteclient/XRemoteClient.cpp | 5 +++++ xpcom/io/SpecialSystemDirectory.cpp | 5 ++++- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/js/src/jsfile.cpp b/js/src/jsfile.cpp index 15d323d9e33c..3f57f0ea702c 100644 --- a/js/src/jsfile.cpp +++ b/js/src/jsfile.cpp @@ -62,6 +62,7 @@ # include # include # include +# include # define FILESEPARATOR '/' # define FILESEPARATOR2 '\0' # define CURRENT_DIR "/" @@ -105,7 +106,11 @@ #define utfstring "binary" #define unicodestring "unicode" +#ifdef PATH_MAX +#define MAX_PATH_LENGTH PATH_MAX +#else #define MAX_PATH_LENGTH 1024 +#endif #define MODE_SIZE 256 #define NUMBER_SIZE 32 #define MAX_LINE_LENGTH 256 diff --git a/modules/lcms/include/lcms.h b/modules/lcms/include/lcms.h index 6f5b9f0fd492..ba79fdd01770 100644 --- a/modules/lcms/include/lcms.h +++ b/modules/lcms/include/lcms.h @@ -203,6 +203,7 @@ typedef pthread_rwlock_t LCMS_RWLOCK_T; #if defined(__GNUC__) || defined(__FreeBSD__) # include +# include #endif #ifndef LCMS_WIN_TYPES_ALREADY_DEFINED @@ -233,7 +234,11 @@ typedef void *LPVOID; #define HIWORD(l) ((WORD)((DWORD)(l) >> 16)) #ifndef MAX_PATH -# define MAX_PATH (256) +# ifdef PATH_MAX +# define MAX_PATH PATH_MAX +# else +# define MAX_PATH (256) +# endif #endif #define cdecl diff --git a/modules/libreg/src/reg.c b/modules/libreg/src/reg.c index d6df1c02a13d..e63113252650 100644 --- a/modules/libreg/src/reg.c +++ b/modules/libreg/src/reg.c @@ -69,6 +69,10 @@ #include #endif +#ifdef XP_UNIX +#include +#endif + #ifdef STANDALONE_REGISTRY #include #include @@ -91,8 +95,12 @@ #define MAX_PATH PATH_MAX #elif defined(XP_UNIX) #ifndef MAX_PATH +#ifdef PATH_MAX +#define MAX_PATH PATH_MAX +#else #define MAX_PATH 1024 #endif +#endif #elif defined(XP_OS2) #ifndef MAX_PATH #define MAX_PATH 260 diff --git a/widget/src/xremoteclient/XRemoteClient.cpp b/widget/src/xremoteclient/XRemoteClient.cpp index 8650866bfeea..0e91d7fdaaf1 100644 --- a/widget/src/xremoteclient/XRemoteClient.cpp +++ b/widget/src/xremoteclient/XRemoteClient.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #ifdef POLL_WITH_XCONNECTIONNUMBER #include @@ -76,8 +77,12 @@ #endif #ifndef MAX_PATH +#ifdef PATH_MAX +#define MAX_PATH PATH_MAX +#else #define MAX_PATH 1024 #endif +#endif #define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0])) diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 38975ebf1ac2..5cb881dd5572 100644 --- a/xpcom/io/SpecialSystemDirectory.cpp +++ b/xpcom/io/SpecialSystemDirectory.cpp @@ -76,6 +76,7 @@ #elif defined(XP_UNIX) +#include #include #include #include @@ -100,7 +101,9 @@ #endif #ifndef MAXPATHLEN -#ifdef MAX_PATH +#ifdef PATH_MAX +#define MAXPATHLEN PATH_MAX +#elif defined(MAX_PATH) #define MAXPATHLEN MAX_PATH #elif defined(_MAX_PATH) #define MAXPATHLEN _MAX_PATH