From 0b0abb10e4d0086c609a479d1e786e6f83d3580d Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Tue, 28 Nov 2000 23:27:38 +0000 Subject: [PATCH] #56767 r/a=cls,leaf Remove XP_PC - use XP_WIN or XP_OS2 explicitly git-svn-id: svn://10.0.0.236/trunk@82990 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsDirectoryService.cpp | 123 +++++++++--------- mozilla/xpcom/io/nsDirectoryService.h | 12 +- mozilla/xpcom/io/nsDirectoryServiceDefs.h | 10 +- mozilla/xpcom/io/nsFileSpec.cpp | 52 ++++---- mozilla/xpcom/io/nsFileSpec.h | 10 +- mozilla/xpcom/io/nsFileStream.cpp | 2 +- mozilla/xpcom/io/nsFileStream.h | 4 +- mozilla/xpcom/io/nsLinebreakConverter.cpp | 2 +- mozilla/xpcom/io/nsLocalFile.h | 23 ++-- mozilla/xpcom/io/nsLocalFileCommon.cpp | 8 +- mozilla/xpcom/io/nsLocalFileOS2.cpp | 2 +- mozilla/xpcom/io/nsLocalFileOS2.h | 2 +- mozilla/xpcom/io/nsLocalFileWin.cpp | 2 +- mozilla/xpcom/io/nsSpecialSystemDirectory.cpp | 16 +-- mozilla/xpcom/io/nsStdFileStream.h | 12 +- 15 files changed, 136 insertions(+), 144 deletions(-) diff --git a/mozilla/xpcom/io/nsDirectoryService.cpp b/mozilla/xpcom/io/nsDirectoryService.cpp index c6dd98bb8d0..619b5b78ee3 100644 --- a/mozilla/xpcom/io/nsDirectoryService.cpp +++ b/mozilla/xpcom/io/nsDirectoryService.cpp @@ -33,9 +33,7 @@ #include #include #include -#elif defined(XP_OS2) -#define MAX_PATH _MAX_PATH -#elif defined(XP_PC) +#elif defined(XP_WIN) #include #include #include @@ -45,6 +43,8 @@ #include #include #include "prenv.h" +#elif defined(XP_OS2) +#define MAX_PATH _MAX_PATH #elif defined(XP_BEOS) #include #include @@ -68,7 +68,7 @@ #ifdef XP_MAC #define APP_REGISTRY_NAME "Application Registry" -#elif defined(XP_PC) +#elif defined(XP_WIN) || defined(XP_OS2) #define APP_REGISTRY_NAME "registry.dat" #else #define APP_REGISTRY_NAME "appreg" @@ -76,20 +76,20 @@ // define home directory // For Windows platform, We are choosing Appdata folder as HOME -#ifdef XP_OS2 -#define HOME_DIR NS_OS2_HOME_DIR -#elif defined (XP_PC) +#if defined (XP_WIN) #define HOME_DIR NS_WIN_APPDATA_DIR #elif defined (XP_MAC) #define HOME_DIR NS_MAC_HOME_DIR #elif defined (XP_UNIX) #define HOME_DIR NS_UNIX_HOME_DIR +#elif defined (XP_OS2) +#define HOME_DIR NS_OS2_HOME_DIR #elif defined (XP_BEOS) #define HOME_DIR NS_BEOS_HOME_DIR #endif // define default product directory -#if defined(XP_PC) || defined(XP_MAC) || defined(XP_BEOS) +#if defined(XP_WIN) || defined(XP_MAC) || defined(XP_OS2) || defined(XP_BEOS) #define DEFAULT_PRODUCT_DIR "Mozilla" #elif defined (XP_UNIX) #define DEFAULT_PRODUCT_DIR ".mozilla" @@ -131,18 +131,7 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile) -#ifdef XP_PC -#ifdef XP_OS2 - PPIB ppib; - PTIB ptib; - char buffer[CCHMAXPATH]; - DosGetInfoBlocks( &ptib, &ppib); - DosQueryModuleName( ppib->pib_hmte, CCHMAXPATH, buffer); - *strrchr( buffer, '\\') = '\0'; // XXX DBCS misery - localFile->InitWithPath(buffer); - *aFile = localFile; - return NS_OK; -#else +#ifdef XP_WIN char buf[MAX_PATH]; if ( ::GetModuleFileName(0, buf, sizeof(buf)) ) { // chop of the executable name by finding the rightmost backslash @@ -154,7 +143,6 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile) *aFile = localFile; return NS_OK; } -#endif #elif defined(XP_MAC) // get info for the the current process to determine the directory @@ -241,6 +229,17 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile) } } +#elif defined(XP_OS2) + PPIB ppib; + PTIB ptib; + char buffer[CCHMAXPATH]; + DosGetInfoBlocks( &ptib, &ppib); + DosQueryModuleName( ppib->pib_hmte, CCHMAXPATH, buffer); + *strrchr( buffer, '\\') = '\0'; // XXX DBCS misery + localFile->InitWithPath(buffer); + *aFile = localFile; + return NS_OK; + #elif defined(XP_BEOS) char *moz5 = getenv("MOZILLA_FIVE_HOME"); @@ -305,12 +304,7 @@ nsIAtom* nsDirectoryService::sDocumentsDirectory = nsnull; nsIAtom* nsDirectoryService::sInternetSearchDirectory = nsnull; nsIAtom* nsDirectoryService::sHomeDirectory = nsnull; nsIAtom* nsDirectoryService::sDefaultDownloadDirectory = nsnull; -#elif defined (XP_OS2) -nsIAtom* nsDirectoryService::sSystemDirectory = nsnull; -nsIAtom* nsDirectoryService::sOS2Directory = nsnull; -nsIAtom* nsDirectoryService::sHomeDirectory = nsnull; -nsIAtom* nsDirectoryService::sDesktopDirectory = nsnull; -#elif defined (XP_PC) +#elif defined (XP_WIN) nsIAtom* nsDirectoryService::sSystemDirectory = nsnull; nsIAtom* nsDirectoryService::sWindowsDirectory = nsnull; nsIAtom* nsDirectoryService::sHomeDirectory = nsnull; @@ -341,6 +335,11 @@ nsIAtom* nsDirectoryService::sPrinthood = nsnull; nsIAtom* nsDirectoryService::sLocalDirectory = nsnull; nsIAtom* nsDirectoryService::sLibDirectory = nsnull; nsIAtom* nsDirectoryService::sHomeDirectory = nsnull; +#elif defined (XP_OS2) +nsIAtom* nsDirectoryService::sSystemDirectory = nsnull; +nsIAtom* nsDirectoryService::sOS2Directory = nsnull; +nsIAtom* nsDirectoryService::sHomeDirectory = nsnull; +nsIAtom* nsDirectoryService::sDesktopDirectory = nsnull; #elif defined (XP_BEOS) nsIAtom* nsDirectoryService::sSettingsDirectory = nsnull; nsIAtom* nsDirectoryService::sHomeDirectory = nsnull; @@ -407,12 +406,7 @@ nsDirectoryService::Init(const char *productName) nsDirectoryService::sInternetSearchDirectory = NS_NewAtom(NS_MAC_INTERNET_SEARCH_DIR); nsDirectoryService::sHomeDirectory = NS_NewAtom(NS_MAC_HOME_DIR); nsDirectoryService::sDefaultDownloadDirectory = NS_NewAtom(NS_MAC_DEFAULT_DOWNLOAD_DIR); -#elif defined (XP_OS2) - nsDirectoryService::sSystemDirectory = NS_NewAtom(NS_OS_SYSTEM_DIR); - nsDirectoryService::sOS2Directory = NS_NewAtom(NS_OS2_DIR); - nsDirectoryService::sHomeDirectory = NS_NewAtom(NS_OS2_HOME_DIR); - nsDirectoryService::sDesktopDirectory = NS_NewAtom(NS_OS2_DESKTOP_DIR); -#elif defined (XP_PC) +#elif defined (XP_WIN) nsDirectoryService::sSystemDirectory = NS_NewAtom(NS_OS_SYSTEM_DIR); nsDirectoryService::sWindowsDirectory = NS_NewAtom(NS_WIN_WINDOWS_DIR); nsDirectoryService::sHomeDirectory = NS_NewAtom(NS_WIN_HOME_DIR); @@ -443,6 +437,11 @@ nsDirectoryService::Init(const char *productName) nsDirectoryService::sLocalDirectory = NS_NewAtom(NS_UNIX_LOCAL_DIR); nsDirectoryService::sLibDirectory = NS_NewAtom(NS_UNIX_LIB_DIR); nsDirectoryService::sHomeDirectory = NS_NewAtom(NS_UNIX_HOME_DIR); +#elif defined (XP_OS2) + nsDirectoryService::sSystemDirectory = NS_NewAtom(NS_OS_SYSTEM_DIR); + nsDirectoryService::sOS2Directory = NS_NewAtom(NS_OS2_DIR); + nsDirectoryService::sHomeDirectory = NS_NewAtom(NS_OS2_HOME_DIR); + nsDirectoryService::sDesktopDirectory = NS_NewAtom(NS_OS2_DESKTOP_DIR); #elif defined (XP_BEOS) nsDirectoryService::sSystemDirectory = NS_NewAtom(NS_OS_SYSTEM_DIR); nsDirectoryService::sSettingsDirectory = NS_NewAtom(NS_BEOS_SETTINGS_DIR); @@ -488,12 +487,7 @@ nsDirectoryService::~nsDirectoryService() NS_IF_RELEASE(nsDirectoryService::sDocumentsDirectory); NS_IF_RELEASE(nsDirectoryService::sInternetSearchDirectory); NS_IF_RELEASE(nsDirectoryService::sHomeDirectory); -#elif defined (XP_OS2) - NS_IF_RELEASE(nsDirectoryService::sSystemDirectory); - NS_IF_RELEASE(nsDirectoryService::sOS2Directory); - NS_IF_RELEASE(nsDirectoryService::sHomeDirectory); - NS_IF_RELEASE(nsDirectoryService::sDesktopDirectory); -#elif defined (XP_PC) +#elif defined (XP_WIN) NS_IF_RELEASE(nsDirectoryService::sSystemDirectory); NS_IF_RELEASE(nsDirectoryService::sWindowsDirectory); NS_IF_RELEASE(nsDirectoryService::sHomeDirectory); @@ -524,6 +518,11 @@ nsDirectoryService::~nsDirectoryService() NS_IF_RELEASE(nsDirectoryService::sLocalDirectory); NS_IF_RELEASE(nsDirectoryService::sLibDirectory); NS_IF_RELEASE(nsDirectoryService::sHomeDirectory); +#elif defined (XP_OS2) + NS_IF_RELEASE(nsDirectoryService::sSystemDirectory); + NS_IF_RELEASE(nsDirectoryService::sOS2Directory); + NS_IF_RELEASE(nsDirectoryService::sHomeDirectory); + NS_IF_RELEASE(nsDirectoryService::sDesktopDirectory); #elif defined (XP_BEOS) NS_IF_RELEASE(nsDirectoryService::sSettingsDirectory); NS_IF_RELEASE(nsDirectoryService::sHomeDirectory); @@ -728,7 +727,7 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret nsCOMPtr homeDir; GetFile(HOME_DIR, persistent, getter_AddRefs(homeDir)); -#if defined(XP_PC) && !defined(XP_OS2) +#if defined(XP_WIN) PRBool dirExists = PR_FALSE; PRBool invalidHome = PR_FALSE; if (homeDir) @@ -895,28 +894,7 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_DefaultDownloadDirectory); rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); } -#elif defined (XP_OS2) - else if (inAtom == nsDirectoryService::sSystemDirectory) - { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_SystemDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); - } - else if (inAtom == nsDirectoryService::sOS2Directory) - { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_OS2Directory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); - } - else if (inAtom == nsDirectoryService::sHomeDirectory) - { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_HomeDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); - } - else if (inAtom == nsDirectoryService::sDesktopDirectory) - { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_DesktopDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); - } -#elif defined (XP_PC) +#elif defined (XP_WIN) else if (inAtom == nsDirectoryService::sSystemDirectory) { nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_SystemDirectory); @@ -1064,6 +1042,27 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Unix_HomeDirectory); rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); } +#elif defined (XP_OS2) + else if (inAtom == nsDirectoryService::sSystemDirectory) + { + nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_SystemDirectory); + rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + } + else if (inAtom == nsDirectoryService::sOS2Directory) + { + nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_OS2Directory); + rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + } + else if (inAtom == nsDirectoryService::sHomeDirectory) + { + nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_HomeDirectory); + rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + } + else if (inAtom == nsDirectoryService::sDesktopDirectory) + { + nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_DesktopDirectory); + rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + } #elif defined (XP_BEOS) else if (inAtom == nsDirectoryService::sSettingsDirectory) { diff --git a/mozilla/xpcom/io/nsDirectoryService.h b/mozilla/xpcom/io/nsDirectoryService.h index 10ec7b90741..56cf5156720 100644 --- a/mozilla/xpcom/io/nsDirectoryService.h +++ b/mozilla/xpcom/io/nsDirectoryService.h @@ -88,12 +88,7 @@ private: static nsIAtom *sInternetSearchDirectory; static nsIAtom *sHomeDirectory; static nsIAtom *sDefaultDownloadDirectory; -#elif defined (XP_OS2) - static nsIAtom *sSystemDirectory; - static nsIAtom *sOS2Directory; - static nsIAtom *sHomeDirectory; - static nsIAtom *sDesktopDirectory; -#elif defined (XP_PC) +#elif defined (XP_WIN) static nsIAtom *sSystemDirectory; static nsIAtom *sWindowsDirectory; static nsIAtom *sHomeDirectory; @@ -124,6 +119,11 @@ private: static nsIAtom *sLocalDirectory; static nsIAtom *sLibDirectory; static nsIAtom *sHomeDirectory; +#elif defined (XP_OS2) + static nsIAtom *sSystemDirectory; + static nsIAtom *sOS2Directory; + static nsIAtom *sHomeDirectory; + static nsIAtom *sDesktopDirectory; #elif defined (XP_BEOS) static nsIAtom *sSettingsDirectory; static nsIAtom *sHomeDirectory; diff --git a/mozilla/xpcom/io/nsDirectoryServiceDefs.h b/mozilla/xpcom/io/nsDirectoryServiceDefs.h index 97b75b483c1..7af921f89be 100755 --- a/mozilla/xpcom/io/nsDirectoryServiceDefs.h +++ b/mozilla/xpcom/io/nsDirectoryServiceDefs.h @@ -67,11 +67,7 @@ #define NS_MAC_INTERNET_SEARCH_DIR "ISrch" #define NS_MAC_HOME_DIR "Home" #define NS_MAC_DEFAULT_DOWNLOAD_DIR "DfltDwnld" -#elif defined (XP_OS2) - #define NS_OS2_DIR "0S2Dir" - #define NS_OS2_HOME_DIR "Home" - #define NS_OS2_DESKTOP_DIR "Desk" -#elif defined (XP_PC) +#elif defined (XP_WIN) #define NS_WIN_WINDOWS_DIR "WinD" #define NS_WIN_HOME_DIR "Home" #define NS_WIN_DESKTOP_DIR "DeskV" // virtual folder at the root of the namespace @@ -101,6 +97,10 @@ #define NS_UNIX_LOCAL_DIR "Locl" #define NS_UNIX_LIB_DIR "LibD" #define NS_UNIX_HOME_DIR "Home" +#elif defined (XP_OS2) + #define NS_OS2_DIR "0S2Dir" + #define NS_OS2_HOME_DIR "Home" + #define NS_OS2_DESKTOP_DIR "Desk" #elif defined (XP_BEOS) #define NS_BEOS_SETTINGS_DIR "Setngs" #define NS_BEOS_HOME_DIR "Home" diff --git a/mozilla/xpcom/io/nsFileSpec.cpp b/mozilla/xpcom/io/nsFileSpec.cpp index 089b3c75e69..4621adbcb44 100644 --- a/mozilla/xpcom/io/nsFileSpec.cpp +++ b/mozilla/xpcom/io/nsFileSpec.cpp @@ -43,7 +43,7 @@ #include #include -#if defined(XP_PC) && !defined(XP_OS2) +#if defined(XP_WIN) #include #endif @@ -288,7 +288,7 @@ NS_NAMESPACE nsFileSpecHelpers NS_NAMESPACE_PROTOTYPE void Canonify(nsSimpleCharString& ioPath, PRBool inMakeDirs); NS_NAMESPACE_PROTOTYPE void MakeAllDirectories(const char* inPath, int mode); #endif -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) NS_NAMESPACE_PROTOTYPE void NativeToUnix(nsSimpleCharString& ioPath); NS_NAMESPACE_PROTOTYPE void UnixToNative(nsSimpleCharString& ioPath); #endif @@ -316,7 +316,7 @@ void nsSimpleCharString::LeafReplace(char inSeparator, const char* inLeafName) return; } char* chars = mData->mString; -#if defined(XP_PC) && !defined(XP_OS2) +#if defined(XP_WIN) // XXX OS/2 should use strrchr() of DBCS verison, too char* lastSeparator = (char*) _mbsrchr((const unsigned char*) chars, inSeparator); #else @@ -329,7 +329,7 @@ void nsSimpleCharString::LeafReplace(char inSeparator, const char* inLeafName) char savedCh = *lastSeparator; char *savedLastSeparator = lastSeparator; *lastSeparator = '\0'; -#if defined(XP_PC) && !defined(XP_OS2) +#if defined(XP_WIN) // XXX OS/2 should use strrchr() of DBCS verison, too lastSeparator = (char*) _mbsrchr((const unsigned char*) chars, inSeparator); #else @@ -369,7 +369,7 @@ char* nsSimpleCharString::GetLeaf(char inSeparator) const return nsnull; char* chars = mData->mString; -#if defined(XP_PC) && !defined(XP_OS2) +#if defined(XP_WIN) const char* lastSeparator = (const char*) _mbsrchr((const unsigned char *) chars, inSeparator); #else const char* lastSeparator = strrchr(chars, inSeparator); @@ -386,7 +386,7 @@ char* nsSimpleCharString::GetLeaf(char inSeparator) const // So now, separator was the last character. Poke in a null instead. *(char*)lastSeparator = '\0'; // Should use const_cast, but Unix has old compiler. -#if defined(XP_PC) && !defined(XP_OS2) +#if defined(XP_WIN) leafPointer = (const char*) _mbsrchr((const unsigned char *) chars, inSeparator); #else leafPointer = strrchr(chars, inSeparator); @@ -394,7 +394,7 @@ char* nsSimpleCharString::GetLeaf(char inSeparator) const char* result = leafPointer ? nsCRT::strdup(++leafPointer) : nsCRT::strdup(chars); // Restore the poked null before returning. *(char*)lastSeparator = inSeparator; -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) // If it's a drive letter use the colon notation. if (!leafPointer && result[2] == 0 && result[1] == '|') result[1] = ':'; @@ -407,7 +407,7 @@ char* nsSimpleCharString::GetLeaf(char inSeparator) const #pragma mark - #endif -#if defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS) +#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) //---------------------------------------------------------------------------------------- void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode) @@ -425,7 +425,7 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode) const char kSeparator = '/'; // I repeat: this should be a unix-style path. const int kSkipFirst = 1; -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) // Either this is a relative path, or we ensure that it has // a drive letter specifier. NS_ASSERTION( pathCopy[0] != '/' || pathCopy[2] == '|', "No drive letter!" ); @@ -437,7 +437,7 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode) nsFileSpec spec; *currentEnd = '\0'; -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) /* if we have a drive letter path, we must make sure that the inital path has a '/' on it, or Canonify will turn "/c|" into a path relative to the running executable. @@ -480,14 +480,12 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode) nsCRT::free(pathCopy); } // nsFileSpecHelpers::MakeAllDirectories -#endif // XP_PC || XP_UNIX +#endif // XP_UNIX || XP_WIN || XP_OS2 || XP_BEOS #ifdef XP_MAC #pragma mark - #endif -#if defined(XP_OS2) -#include "nsFileSpecOS2.cpp" // OS/2-specific implementations -#elif defined(XP_PC) +#if defined(XP_WIN) #include "nsFileSpecWin.cpp" // Windows-specific implementations #elif defined(XP_MAC) //#include "nsFileSpecMac.cpp" // Macintosh-specific implementations @@ -499,6 +497,8 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode) #include "nsFileSpecBeOS.cpp" // BeOS-specific implementations #elif defined(XP_UNIX) #include "nsFileSpecUnix.cpp" // Unix-specific implementations +#elif defined(XP_OS2) +#include "nsFileSpecOS2.cpp" // OS/2-specific implementations #endif //======================================================================================== @@ -629,7 +629,7 @@ void nsFileURL::operator = (const nsFilePath& inOther) mURL = kFileURLPrefix; char* original = (char*)(const char*)inOther; // we shall modify, but restore. if (!original || !*original) return; -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) // because we don't want to escape the '|' character, change it to a letter. NS_ASSERTION(original[2] == '|', "No drive letter part!"); original[2] = 'x'; @@ -685,12 +685,12 @@ nsFilePath::nsFilePath(const char* inString, PRBool inCreateDirs) NS_ASSERTION(strstr(inString, kFileURLPrefix) != inString, "URL passed as path"); -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) nsFileSpecHelpers::UnixToNative(mPath); #endif // Make canonical and absolute. nsFileSpecHelpers::Canonify(mPath, inCreateDirs); -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) NS_ASSERTION( mPath[1] == ':', "unexpected canonical path" ); nsFileSpecHelpers::NativeToUnix(mPath); #endif @@ -707,12 +707,12 @@ nsFilePath::nsFilePath(const nsString& inString, PRBool inCreateDirs) return; NS_ASSERTION(strstr((const char*)mPath, kFileURLPrefix) != (const char*)mPath, "URL passed as path"); -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) nsFileSpecHelpers::UnixToNative(mPath); #endif // Make canonical and absolute. nsFileSpecHelpers::Canonify(mPath, inCreateDirs); -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) NS_ASSERTION( mPath[1] == ':', "unexpected canonical path" ); nsFileSpecHelpers::NativeToUnix(mPath); #endif @@ -765,12 +765,12 @@ void nsFilePath::operator = (const char* inString) mPath = inString; if (mPath.IsEmpty()) return; -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) nsFileSpecHelpers::UnixToNative(mPath); #endif // Make canonical and absolute. nsFileSpecHelpers::Canonify(mPath, PR_FALSE /* XXX? */); -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) nsFileSpecHelpers::NativeToUnix(mPath); #endif } @@ -975,7 +975,7 @@ void nsFileSpec::operator = (const nsFilePath& inPath) } #endif //XP_UNIX -#if defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS) +#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) //---------------------------------------------------------------------------------------- nsFileSpec::nsFileSpec(const nsFileSpec& inSpec) //---------------------------------------------------------------------------------------- @@ -1024,7 +1024,7 @@ void nsFileSpec::operator = (const char* inString) nsFileSpecHelpers::Canonify(mPath, PR_FALSE /* XXX? */); mError = NS_OK; } -#endif //XP_UNIX,PC,XP_BEOS +#endif //XP_UNIX,XP_WIN,XP_OS2,XP_BEOS //---------------------------------------------------------------------------------------- nsFileSpec nsFileSpec::operator + (const char* inRelativePath) const @@ -1060,7 +1060,7 @@ PRBool nsFileSpec::operator == (const nsFileSpec& inOther) const // Length() is size of buffer, not length of string PRUint32 strLast = str.Length() - 1, inLast = inStr.Length() - 1; -#if defined(XP_PC) +#if defined(XP_WIN) || defined(XP_OS2) #define DIR_SEPARATOR '\\' // XXX doesn't NSPR have this? /* windows does not care about case. */ #ifdef XP_OS2 @@ -1375,7 +1375,7 @@ nsNSPRPath::operator const char*() const // cannot be changed, so we have to do the dirty work. //---------------------------------------------------------------------------------------- { -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) if (!modifiedNSPRPath) { // If this is the first call, initialize modifiedNSPRPath. Start by cloning @@ -1406,7 +1406,7 @@ nsNSPRPath::operator const char*() const nsNSPRPath::~nsNSPRPath() //---------------------------------------------------------------------------------------- { -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) if (modifiedNSPRPath) nsCRT::free(modifiedNSPRPath); #endif diff --git a/mozilla/xpcom/io/nsFileSpec.h b/mozilla/xpcom/io/nsFileSpec.h index 5d9cfaf3e6d..6eb935b0745 100644 --- a/mozilla/xpcom/io/nsFileSpec.h +++ b/mozilla/xpcom/io/nsFileSpec.h @@ -137,7 +137,7 @@ //======================================================================================== // Compiler-specific macros, as needed //======================================================================================== -#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2))) +#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || defined(XP_WIN)) #define NS_USING_NAMESPACE #endif @@ -174,7 +174,7 @@ #include "prio.h" #endif #include -#elif defined(XP_PC) +#elif defined(XP_WIN) // This clashes with some of the Win32 system headers (specifically, // winbase.h). Hopefully they'll have been included first; else we may @@ -777,13 +777,13 @@ class NS_COM nsDirectoryIterator PRBool mExists; PRBool mResoveSymLinks; -#if defined(XP_UNIX) || defined(XP_BEOS) || defined (XP_PC) +#if defined(XP_UNIX) || defined(XP_BEOS) || defined (XP_WIN) || defined(XP_OS2) nsFileSpec mStarting; #endif #if defined(XP_UNIX) || defined(XP_BEOS) DIR* mDir; -#elif defined(XP_PC) +#elif defined(XP_WIN) || defined(XP_OS2) PRDir* mDir; // XXX why not use PRDir for Unix too? #elif defined(XP_MAC) short mVRefNum; @@ -823,7 +823,7 @@ public: private: nsFilePath mFilePath; - char* modifiedNSPRPath; // Currently used only on XP_PC + char* modifiedNSPRPath; // Currently used only on XP_WIN,XP_OS2 }; // class nsNSPRPath diff --git a/mozilla/xpcom/io/nsFileStream.cpp b/mozilla/xpcom/io/nsFileStream.cpp index e3599994541..85e1de29949 100644 --- a/mozilla/xpcom/io/nsFileStream.cpp +++ b/mozilla/xpcom/io/nsFileStream.cpp @@ -418,7 +418,7 @@ nsSaveViaTempStream::~nsSaveViaTempStream() nsOutputStream& nsEndl(nsOutputStream& os) //---------------------------------------------------------------------------------------- { -#ifdef XP_PC +#if defined(XP_WIN) || defined(XP_OS2) os.write("\r\n", 2); #elif defined (XP_MAC) os.put('\r'); diff --git a/mozilla/xpcom/io/nsFileStream.h b/mozilla/xpcom/io/nsFileStream.h index e29abb7b7ec..758e4a5f544 100644 --- a/mozilla/xpcom/io/nsFileStream.h +++ b/mozilla/xpcom/io/nsFileStream.h @@ -103,11 +103,11 @@ class nsIFileSpec; //======================================================================================== // Compiler-specific macros, as needed //======================================================================================== -#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2))) +#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || defined(XP_WIN)) #define NS_USING_NAMESPACE #endif -#if !defined(NS_USING_STL) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2))) +#if !defined(NS_USING_STL) && (defined(__MWERKS__) || defined(XP_WIN)) #define NS_USING_STL #endif diff --git a/mozilla/xpcom/io/nsLinebreakConverter.cpp b/mozilla/xpcom/io/nsLinebreakConverter.cpp index 68c299b39b5..c8961216492 100644 --- a/mozilla/xpcom/io/nsLinebreakConverter.cpp +++ b/mozilla/xpcom/io/nsLinebreakConverter.cpp @@ -26,7 +26,7 @@ #include "nsCRT.h" -#if defined(XP_PC) && defined(_MSC_VER) && (_MSC_VER <= 1100) +#if defined(XP_WIN) && defined(_MSC_VER) && (_MSC_VER <= 1100) #define LOSER_CHAR_CAST(t) (char *)(t) #define LOSER_UNICHAR_CAST(t) (PRUnichar *)(t) #else diff --git a/mozilla/xpcom/io/nsLocalFile.h b/mozilla/xpcom/io/nsLocalFile.h index c6f5dd1d7e1..223dfc0a09c 100644 --- a/mozilla/xpcom/io/nsLocalFile.h +++ b/mozilla/xpcom/io/nsLocalFile.h @@ -38,23 +38,16 @@ // so here we will export it. Other users should not depend // on this. -#ifdef XP_OS2 +#ifdef XP_WIN +#include "nsLocalFileWin.h" +#elif defined(XP_UNIX) || defined(XP_BEOS) +#include "nsLocalFileUnix.h" +#elif defined(XP_MAC) +#include "nsLocalFileMac.h" +#elif defined(XP_OS2) #include "nsLocalFileOS2.h" #else -#ifdef XP_PC -#include "nsLocalFileWin.h" -#else -#if defined(XP_UNIX) || defined(XP_BEOS) -#include "nsLocalFileUnix.h" -#else -#ifdef XP_MAC -#include "nsLocalFileMac.h" -#else #error NOT_IMPLEMENTED -#endif /* XP_MAC */ -#endif /* XP_UNIX */ -#endif /* XP_PC */ -#endif /* XP_OS2 */ #endif - +#endif diff --git a/mozilla/xpcom/io/nsLocalFileCommon.cpp b/mozilla/xpcom/io/nsLocalFileCommon.cpp index 61350e34d6d..389c5b95cc8 100644 --- a/mozilla/xpcom/io/nsLocalFileCommon.cpp +++ b/mozilla/xpcom/io/nsLocalFileCommon.cpp @@ -31,12 +31,12 @@ #include "nsFileSpec.h" // evil ftang hack -#ifdef XP_PC -#ifdef XP_OS2 -#include "nsLocalFileOS2.h" -#else +#ifdef XP_WIN #include "nsLocalFileWin.h" #endif + +#ifdef XP_OS2 +#include "nsLocalFileOS2.h" #endif #ifdef XP_MAC diff --git a/mozilla/xpcom/io/nsLocalFileOS2.cpp b/mozilla/xpcom/io/nsLocalFileOS2.cpp index 348ff019eab..7455ad1c076 100644 --- a/mozilla/xpcom/io/nsLocalFileOS2.cpp +++ b/mozilla/xpcom/io/nsLocalFileOS2.cpp @@ -2117,7 +2117,7 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL) char* ePath = (char*) nsMemory::Clone((char*)mWorkingPath, strlen(mWorkingPath)+1); if (ePath == nsnull) return NS_ERROR_OUT_OF_MEMORY; -#if defined (XP_PC) +#if defined (XP_WIN) || defined(XP_OS2) // Replace \ with / to convert to an url char* s = ePath; while (*s) diff --git a/mozilla/xpcom/io/nsLocalFileOS2.h b/mozilla/xpcom/io/nsLocalFileOS2.h index 2b78a3b5d42..a3b0bfbe817 100644 --- a/mozilla/xpcom/io/nsLocalFileOS2.h +++ b/mozilla/xpcom/io/nsLocalFileOS2.h @@ -122,7 +122,7 @@ private: // this will be the resolve path which will *NEVER* be return to the user nsCString mResolvedPath; -#if defined(XP_PC) && !defined(XP_OS2) +#if defined(XP_WIN) IPersistFile* mPersistFile; IShellLink* mShellLink; #endif diff --git a/mozilla/xpcom/io/nsLocalFileWin.cpp b/mozilla/xpcom/io/nsLocalFileWin.cpp index 71ae000b3cf..6c6f774a18b 100644 --- a/mozilla/xpcom/io/nsLocalFileWin.cpp +++ b/mozilla/xpcom/io/nsLocalFileWin.cpp @@ -1854,7 +1854,7 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL) char* ePath = (char*) nsMemory::Clone(mWorkingPath, strlen(mWorkingPath)+1); if (ePath == nsnull) return NS_ERROR_OUT_OF_MEMORY; -#if defined (XP_PC) +#if defined (XP_WIN) // Replace \ with / to convert to an url char* s = ePath; while (*s) diff --git a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp index f730a1ca4b2..dcfba5a6238 100644 --- a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp +++ b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp @@ -32,7 +32,7 @@ #include #include #include "nsIInternetConfigService.h" -#elif defined(XP_PC) && !defined (XP_OS2) +#elif defined(XP_WIN) #include #include #include @@ -99,7 +99,7 @@ private: static nsHashtable *systemDirectoriesLocations = NULL; -#if defined (XP_PC) && !defined (XP_OS2) +#if defined (XP_WIN) //---------------------------------------------------------------------------------------- static char* MakeUpperCase(char* aPath) //---------------------------------------------------------------------------------------- @@ -155,7 +155,7 @@ Clean: pMalloc->Release(); } // GetWindowsFolder -#endif // XP_PC && !XP_OS2 +#endif // XP_WIN //---------------------------------------------------------------------------------------- static void GetCurrentWorkingDirectory(nsFileSpec& aFileSpec) @@ -169,7 +169,7 @@ static void GetCurrentWorkingDirectory(nsFileSpec& aFileSpec) static void GetCurrentProcessDirectory(nsFileSpec& aFileSpec) //---------------------------------------------------------------------------------------- { -#if defined (XP_PC) && !defined (XP_OS2) +#if defined (XP_WIN) char buf[MAX_PATH]; if ( ::GetModuleFileName(0, buf, sizeof(buf)) ) { // chop of the executable name by finding the rightmost backslash @@ -332,7 +332,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect { case OS_DriveDirectory: -#if defined (XP_PC) && !defined (XP_OS2) +#if defined (XP_WIN) { char path[_MAX_PATH]; PRInt32 len = GetWindowsDirectory( path, _MAX_PATH ); @@ -368,7 +368,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect case OS_TemporaryDirectory: -#if defined (XP_PC) && !defined (XP_OS2) +#if defined (XP_WIN) { char path[_MAX_PATH]; DWORD len = GetTempPath(_MAX_PATH, path); @@ -559,7 +559,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect break; #endif -#if defined (XP_PC) && !defined (XP_OS2) +#if defined (XP_WIN) case Win_SystemDirectory: { char path[_MAX_PATH]; @@ -743,7 +743,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect GetWindowsFolder(CSIDL_PRINTHOOD, *this); break; } -#endif // XP_PC && !XP_OS2 +#endif // XP_WIN #ifdef XP_UNIX case Unix_LocalDirectory: diff --git a/mozilla/xpcom/io/nsStdFileStream.h b/mozilla/xpcom/io/nsStdFileStream.h index e79a3fa42f1..cbb4b121f73 100644 --- a/mozilla/xpcom/io/nsStdFileStream.h +++ b/mozilla/xpcom/io/nsStdFileStream.h @@ -90,11 +90,11 @@ //======================================================================================== // Compiler-specific macros, as needed //======================================================================================== -#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2))) +#if !defined(NS_USING_NAMESPACE) && (defined(__MWERKS__) || defined(XP_WIN)) #define NS_USING_NAMESPACE #endif -#if !defined(NS_USING_STL) && (defined(__MWERKS__) || (defined(XP_PC) && !defined(XP_OS2))) +#if !defined(NS_USING_STL) && (defined(__MWERKS__) || defined(XP_WIN)) #define NS_USING_STL #endif @@ -446,7 +446,7 @@ INT_TYPE FILE_BUFFER_TYPE::overflow(int_type c) #else #ifdef NS_EXPLICIT_FUNC_TEMPLATE_ARG const ofacet_type& ft=use_facet(getloc()); -#elif defined(XP_PC) +#elif defined(XP_WIN) || defined(XP_OS2) const ofacet_type& ft=use_facet(getloc(), (ofacet_type*)0, false); #else const ofacet_type& ft=use_facet(getloc(), (ofacet_type*)0); @@ -510,7 +510,7 @@ streamsize FILE_BUFFER_TYPE::xsputn(const char_type* s, streamsize n) #else #ifdef NS_EXPLICIT_FUNC_TEMPLATE_ARG const ofacet_type& ft=use_facet(loc); -#elif defined(XP_PC) +#elif defined(XP_WIN) || defined(XP_OS2) const ofacet_type& ft=use_facet(getloc(), (ofacet_type*)0, false); #else const ofacet_type& ft=use_facet(getloc(), (ofacet_type*)0); @@ -530,7 +530,7 @@ streamsize FILE_BUFFER_TYPE::xsputn(const char_type* s, streamsize n) result conv; #ifdef NS_EXPLICIT_FUNC_TEMPLATE_ARG if ((conv=use_facet(getloc()). -#elif defined(XP_PC) +#elif defined(XP_WIN) || defined(XP_OS2) if ((conv=use_facet(getloc(), (ofacet_type*)0, false). #else if ((conv=use_facet(getloc(), (ofacet_type*)0). @@ -645,7 +645,7 @@ POS_TYPE FILE_BUFFER_TYPE::seekpos(pos_type sp, IOS_BASE::openmode) { if (!mFileDesc || sp==pos_type(-1)) return -1; -#if defined(XP_PC) || defined(XP_UNIX) || defined(XP_BEOS) +#if defined(XP_WIN) || defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS) PRInt32 position = sp; #else PRInt32 position = sp.offset();