Fix for broken linux compiler.

This commit is contained in:
warren%netscape.com 1999-03-19 06:18:08 +00:00
parent b9f3e71ae0
commit 2d6d7aa600
4 changed files with 82 additions and 50 deletions

View File

@ -182,3 +182,39 @@ void nsHashtable::Reset() {
}
////////////////////////////////////////////////////////////////////////////////
nsCStringKey::nsCStringKey(const char* str)
: mStr(mBuf)
{
PRInt32 len = PL_strlen(str);
if (len >= sizeof(mBuf)) {
mStr = PL_strdup(str);
NS_ASSERTION(mStr, "out of memory");
}
else {
PL_strcpy(mStr, str);
}
}
nsCStringKey::~nsCStringKey(void)
{
if (mStr != mBuf)
PL_strfree(mStr);
}
PRUint32 nsCStringKey::HashValue(void) const
{
return (PRUint32) PL_HashString((const void*) mStr);
}
PRBool nsCStringKey::Equals(const nsHashKey* aKey) const
{
return PL_strcmp( ((nsCStringKey*)aKey)->mStr, mStr ) == 0;
}
nsHashKey* nsCStringKey::Clone() const
{
return new nsCStringKey(mStr);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -151,35 +151,15 @@ private:
char* mStr;
public:
nsCStringKey(const char* str)
: mStr(mBuf)
{
PRInt32 len = PL_strlen(str);
if (len >= sizeof(mBuf)) {
mStr = PL_strdup(str);
NS_ASSERTION(mStr, "out of memory");
}
else {
PL_strcpy(mStr, str);
}
}
nsCStringKey(const char* str);
~nsCStringKey(void) {
if (mStr != mBuf)
PL_strfree(mStr);
}
~nsCStringKey(void);
PRUint32 HashValue(void) const {
return (PRUint32) PL_HashString((const void*) mStr);
}
PRUint32 HashValue(void) const;
PRBool Equals(const nsHashKey* aKey) const {
return PL_strcmp( ((nsCStringKey*)aKey)->mStr, mStr ) == 0;
}
PRBool Equals(const nsHashKey* aKey) const;
nsHashKey* Clone() const {
return new nsCStringKey(mStr);
}
nsHashKey* Clone() const;
};

View File

@ -151,35 +151,15 @@ private:
char* mStr;
public:
nsCStringKey(const char* str)
: mStr(mBuf)
{
PRInt32 len = PL_strlen(str);
if (len >= sizeof(mBuf)) {
mStr = PL_strdup(str);
NS_ASSERTION(mStr, "out of memory");
}
else {
PL_strcpy(mStr, str);
}
}
nsCStringKey(const char* str);
~nsCStringKey(void) {
if (mStr != mBuf)
PL_strfree(mStr);
}
~nsCStringKey(void);
PRUint32 HashValue(void) const {
return (PRUint32) PL_HashString((const void*) mStr);
}
PRUint32 HashValue(void) const;
PRBool Equals(const nsHashKey* aKey) const {
return PL_strcmp( ((nsCStringKey*)aKey)->mStr, mStr ) == 0;
}
PRBool Equals(const nsHashKey* aKey) const;
nsHashKey* Clone() const {
return new nsCStringKey(mStr);
}
nsHashKey* Clone() const;
};

View File

@ -182,3 +182,39 @@ void nsHashtable::Reset() {
}
////////////////////////////////////////////////////////////////////////////////
nsCStringKey::nsCStringKey(const char* str)
: mStr(mBuf)
{
PRInt32 len = PL_strlen(str);
if (len >= sizeof(mBuf)) {
mStr = PL_strdup(str);
NS_ASSERTION(mStr, "out of memory");
}
else {
PL_strcpy(mStr, str);
}
}
nsCStringKey::~nsCStringKey(void)
{
if (mStr != mBuf)
PL_strfree(mStr);
}
PRUint32 nsCStringKey::HashValue(void) const
{
return (PRUint32) PL_HashString((const void*) mStr);
}
PRBool nsCStringKey::Equals(const nsHashKey* aKey) const
{
return PL_strcmp( ((nsCStringKey*)aKey)->mStr, mStr ) == 0;
}
nsHashKey* nsCStringKey::Clone() const
{
return new nsCStringKey(mStr);
}
////////////////////////////////////////////////////////////////////////////////