Now using PL_* functions in nsprPath()

ifdef'ing the deallocation of nsprPath()
This commit is contained in:
dougt%netscape.com 1999-04-15 19:39:23 +00:00
Родитель e2e2fb5cc8
Коммит 10c079470d
4 изменённых файлов: 20 добавлений и 10 удалений

Просмотреть файл

@ -282,10 +282,11 @@ class NS_BASE nsFileSpec
{
public:
nsFileSpec();
// These two meathods take *native* file paths.
NS_EXPLICIT nsFileSpec(const char* inString, PRBool inCreateDirs = PR_FALSE);
NS_EXPLICIT nsFileSpec(const nsString& inString, PRBool inCreateDirs = PR_FALSE);
// These above two meathods take *native* file paths.
NS_EXPLICIT nsFileSpec(const nsFilePath& inPath);
NS_EXPLICIT nsFileSpec(const nsFileURL& inURL);
@ -293,12 +294,14 @@ class NS_BASE nsFileSpec
nsFileSpec(const nsFileSpec& inPath);
virtual ~nsFileSpec();
// These two operands take *native* file paths.
void operator = (const char* inPath);
void operator = (const nsString& inPath)
{
const nsAutoCString path(inPath);
*this = path;
}
void operator = (const nsFilePath& inPath);
void operator = (const nsFileURL& inURL);
void operator = (const nsFileSpec& inOther);

Просмотреть файл

@ -1159,7 +1159,7 @@ nsprPath::operator const char*()
if (modifiedNSPRPath != nsnull)
delete [] modifiedNSPRPath;
modifiedNSPRPath = strdup( mFilePath );
modifiedNSPRPath = PL_strdup( mFilePath );
char* resultPath = modifiedNSPRPath;
/* strip the leading seperator */
@ -1171,8 +1171,8 @@ nsprPath::operator const char*()
resultPath[1] = ':';
/* Remove the ending seperator */
if(resultPath[strlen(resultPath) - 1 ] == '/')
resultPath[strlen(resultPath) - 1 ] = '\0';
if(resultPath[PL_strlen(resultPath) - 1 ] == '/')
resultPath[PL_strlen(resultPath) - 1 ] = '\0';
return resultPath;
@ -1185,6 +1185,8 @@ nsprPath::operator const char*()
nsprPath::~nsprPath()
//----------------------------------------------------------------------------------------
{
#ifdef XP_PC
if (modifiedNSPRPath != nsnull)
delete [] modifiedNSPRPath;
#endif
}

Просмотреть файл

@ -1159,7 +1159,7 @@ nsprPath::operator const char*()
if (modifiedNSPRPath != nsnull)
delete [] modifiedNSPRPath;
modifiedNSPRPath = strdup( mFilePath );
modifiedNSPRPath = PL_strdup( mFilePath );
char* resultPath = modifiedNSPRPath;
/* strip the leading seperator */
@ -1171,8 +1171,8 @@ nsprPath::operator const char*()
resultPath[1] = ':';
/* Remove the ending seperator */
if(resultPath[strlen(resultPath) - 1 ] == '/')
resultPath[strlen(resultPath) - 1 ] = '\0';
if(resultPath[PL_strlen(resultPath) - 1 ] == '/')
resultPath[PL_strlen(resultPath) - 1 ] = '\0';
return resultPath;
@ -1185,6 +1185,8 @@ nsprPath::operator const char*()
nsprPath::~nsprPath()
//----------------------------------------------------------------------------------------
{
#ifdef XP_PC
if (modifiedNSPRPath != nsnull)
delete [] modifiedNSPRPath;
#endif
}

Просмотреть файл

@ -282,10 +282,11 @@ class NS_BASE nsFileSpec
{
public:
nsFileSpec();
// These two meathods take *native* file paths.
NS_EXPLICIT nsFileSpec(const char* inString, PRBool inCreateDirs = PR_FALSE);
NS_EXPLICIT nsFileSpec(const nsString& inString, PRBool inCreateDirs = PR_FALSE);
// These above two meathods take *native* file paths.
NS_EXPLICIT nsFileSpec(const nsFilePath& inPath);
NS_EXPLICIT nsFileSpec(const nsFileURL& inURL);
@ -293,12 +294,14 @@ class NS_BASE nsFileSpec
nsFileSpec(const nsFileSpec& inPath);
virtual ~nsFileSpec();
// These two operands take *native* file paths.
void operator = (const char* inPath);
void operator = (const nsString& inPath)
{
const nsAutoCString path(inPath);
*this = path;
}
void operator = (const nsFilePath& inPath);
void operator = (const nsFileURL& inURL);
void operator = (const nsFileSpec& inOther);