From 696bbb41faf511cc680ab44fcaee9f0d789cf8db Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Wed, 15 Sep 1999 05:28:31 +0000 Subject: [PATCH] Reverting changes accidentally checked in git-svn-id: svn://10.0.0.236/trunk@47537 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsFileSpec.cpp | 12 ++++++------ mozilla/xpcom/io/nsFileSpecStreaming.cpp | 2 +- mozilla/xpcom/io/nsFileSpecUnix.cpp | 22 +++++++++++----------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mozilla/xpcom/io/nsFileSpec.cpp b/mozilla/xpcom/io/nsFileSpec.cpp index 9840dfbd8b7..d5fa46f08f8 100644 --- a/mozilla/xpcom/io/nsFileSpec.cpp +++ b/mozilla/xpcom/io/nsFileSpec.cpp @@ -464,7 +464,7 @@ nsFileURL::nsFileURL(const char* inString, PRBool inCreateDirs) // an unescaped string. nsSimpleCharString unescapedPath(inString + kFileURLPrefixLength); unescapedPath.Unescape(); - nsFilePath path((char *)unescapedPath, inCreateDirs); + nsFilePath path(unescapedPath, inCreateDirs); *this = path; } // nsFileURL::nsFileURL #endif @@ -484,7 +484,7 @@ nsFileURL::nsFileURL(const nsString& inString, PRBool inCreateDirs) // an unescaped string. nsSimpleCharString unescapedPath(aCString + kFileURLPrefixLength); unescapedPath.Unescape(); - nsFilePath path((char *)unescapedPath, inCreateDirs); + nsFilePath path(unescapedPath, inCreateDirs); *this = path; } // nsFileURL::nsFileURL #endif @@ -645,7 +645,7 @@ nsFilePath::nsFilePath(const nsString& inString, PRBool inCreateDirs) if (mPath.IsEmpty()) return; - NS_ASSERTION(strstr((char*)mPath, kFileURLPrefix) != (char*)mPath, "URL passed as path"); + NS_ASSERTION(strstr((const char*)mPath, kFileURLPrefix) != (const char*)mPath, "URL passed as path"); #ifdef XP_PC nsFileSpecHelpers::UnixToNative(mPath); #endif @@ -812,11 +812,11 @@ void nsFileSpec::MakeUnique() = nsFileSpecHelpers::kMaxCoreLeafNameLength - nsCRT::strlen(suffix) - 1; if ((int)nsCRT::strlen(leafName) > (int)kMaxRootLength) leafName[kMaxRootLength] = '\0'; - for (short indx = 1; indx < 1000 && Exists(); indx++) + for (short index = 1; index < 1000 && Exists(); index++) { // start with "Picture-1.jpg" after "Picture.jpg" exists char newName[nsFileSpecHelpers::kMaxFilenameLength + 1]; - sprintf(newName, "%s-%d%s", leafName, indx, suffix); + sprintf(newName, "%s-%d%s", leafName, index, suffix); SetLeafName(newName); } if (*suffix) @@ -993,7 +993,7 @@ PRBool nsFileSpec::operator == (const nsFileSpec& inOther) const if(inStr[inLast] == DIR_SEPARATOR) inStr[inLast] = '\0'; - if (DIR_STRCMP((char *)str, (char *)inStr ) == 0) + if (DIR_STRCMP(str, inStr ) == 0) return PR_TRUE; #undef DIR_SEPARATOR #undef DIR_STRCMP diff --git a/mozilla/xpcom/io/nsFileSpecStreaming.cpp b/mozilla/xpcom/io/nsFileSpecStreaming.cpp index 02933577568..408ab12f6de 100644 --- a/mozilla/xpcom/io/nsFileSpecStreaming.cpp +++ b/mozilla/xpcom/io/nsFileSpecStreaming.cpp @@ -78,7 +78,7 @@ nsOutputStream& operator << (nsOutputStream& s, const nsPersistentFileDescriptor sprintf(littleBuf, "%.8x", dataSize); s << littleBuf; // Now write the data itself - s << (char*)data; + s << (const char*)data; return s; } diff --git a/mozilla/xpcom/io/nsFileSpecUnix.cpp b/mozilla/xpcom/io/nsFileSpecUnix.cpp index de679338217..b568c8ea026 100644 --- a/mozilla/xpcom/io/nsFileSpecUnix.cpp +++ b/mozilla/xpcom/io/nsFileSpecUnix.cpp @@ -85,7 +85,7 @@ void nsFileSpecHelpers::Canonify(nsSimpleCharString& ioPath, PRBool inMakeDirs) if (inMakeDirs) { const mode_t mode = 0700; - nsFileSpecHelpers::MakeAllDirectories((char*)ioPath, mode); + nsFileSpecHelpers::MakeAllDirectories((const char*)ioPath, mode); } errno = 0; // needed? @@ -98,7 +98,7 @@ void nsFileSpecHelpers::Canonify(nsSimpleCharString& ioPath, PRBool inMakeDirs) (void) getcwd(buffer, MAXPATHLEN); strcat(buffer, "/"); - strcat(buffer, (char *)ioPath); + strcat(buffer, ioPath); ioPath = buffer; } @@ -201,7 +201,7 @@ nsresult nsFileSpec::ResolveSymlink(PRBool& wasAliased) wasAliased = PR_FALSE; char resolvedPath[MAXPATHLEN]; - int charCount = readlink((char *)mPath, (char*)&resolvedPath, MAXPATHLEN); + int charCount = readlink(mPath, (char*)&resolvedPath, MAXPATHLEN); if (0 < charCount) { if (MAXPATHLEN > charCount) @@ -218,7 +218,7 @@ nsresult nsFileSpec::ResolveSymlink(PRBool& wasAliased) mPath = (char*)&resolvedPath; } - char* canonicalPath = realpath((char *)mPath, resolvedPath); + char* canonicalPath = realpath((const char *)mPath, resolvedPath); NS_ASSERTION(canonicalPath, "realpath failed"); if (canonicalPath) { mPath = (char*)&resolvedPath; @@ -251,7 +251,7 @@ void nsFileSpec::operator += (const char* inRelativePath) if (!inRelativePath || mPath.IsEmpty()) return; - char endChar = mPath[(int)(strlen((char *)mPath) - 1)]; + char endChar = mPath[(int)(strlen(mPath) - 1)]; if (endChar == '/') mPath += "x"; else @@ -266,7 +266,7 @@ void nsFileSpec::CreateDirectory(int mode) // Note that mPath is canonical! if (mPath.IsEmpty()) return; - mkdir((char *)mPath, mode); + mkdir(mPath, mode); } // nsFileSpec::CreateDirectory //---------------------------------------------------------------------------------------- @@ -343,11 +343,11 @@ nsresult nsFileSpec::Rename(const char* inNewName) if (mPath.IsEmpty() || strchr(inNewName, '/')) return NS_FILE_FAILURE; - char* oldPath = nsCRT::strdup((char *)mPath); + char* oldPath = nsCRT::strdup(mPath); SetLeafName(inNewName); - if (PR_Rename(oldPath, (char *)mPath) != NS_OK) + if (PR_Rename(oldPath, mPath) != NS_OK) { // Could not rename, set back to the original. mPath = oldPath; @@ -425,7 +425,7 @@ nsresult nsFileSpec::Copy(const nsFileSpec& inParentDirectory) const destPath += "/"; destPath += leafname; nsCRT::free(leafname); - result = NS_FILE_RESULT(CrudeFileCopy(GetCString(), (char *)destPath)); + result = NS_FILE_RESULT(CrudeFileCopy(GetCString(), destPath)); } return result; } // nsFileSpec::Copy @@ -445,7 +445,7 @@ nsresult nsFileSpec::Move(const nsFileSpec& inNewParentDirectory) destPath += leafname; nsCRT::free(leafname); - result = NS_FILE_RESULT(CrudeFileCopy(GetCString(), (char*)destPath)); + result = NS_FILE_RESULT(CrudeFileCopy(GetCString(), (const char*)destPath)); if (result == NS_OK) { // cast to fix const-ness @@ -466,7 +466,7 @@ nsresult nsFileSpec::Execute(const char* inArgs ) const if (!mPath.IsEmpty() && !IsDirectory()) { nsSimpleCharString fileNameWithArgs = mPath + " " + inArgs; - result = NS_FILE_RESULT(system((char *)fileNameWithArgs)); + result = NS_FILE_RESULT(system(fileNameWithArgs)); } return result;