Bug 299992 and followup bug 304874 - Preliminary work which moves pldhash and the templatized hashtables to the XPCOM glue,

as well as centralizes nsINIParser in the glue, r=darin+shaver+brendan+dougt a=asa+cbeard


git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@178289 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bsmedberg%covad.net
2005-08-19 19:36:59 +00:00
parent 8df9aad83d
commit 868d7ccf4a
43 changed files with 924 additions and 3014 deletions

View File

@@ -1079,48 +1079,6 @@ StringEndsWith( const nsACString& aSource, const nsACString& aSubstring,
template <class CharT>
class CalculateHashCode
{
public:
typedef CharT char_type;
typedef PRUint32 hashcode_type;
typedef CharT value_type;
CalculateHashCode() : mHashCode(0) { }
hashcode_type GetHashCode() const { return mHashCode; }
PRUint32 write( const CharT* chars, PRUint32 N )
{
for ( const CharT *end = chars + N; chars < end; ++chars)
mHashCode = (mHashCode>>28) ^ (mHashCode<<4) ^ PRUint32(*chars);
return N;
}
private:
hashcode_type mHashCode;
};
NS_COM PRUint32 HashString( const nsAString& aStr )
{
CalculateHashCode<nsAString::char_type> sink;
nsAString::const_iterator begin, end;
aStr.BeginReading(begin);
aStr.EndReading(end);
copy_string(begin, end, sink);
return sink.GetHashCode();
}
NS_COM PRUint32 HashString( const nsACString& aStr )
{
CalculateHashCode<nsACString::char_type> sink;
nsACString::const_iterator begin, end;
aStr.BeginReading(begin);
aStr.EndReading(end);
copy_string(begin, end, sink);
return sink.GetHashCode();
}
static const PRUnichar empty_buffer[1] = { '\0' };
NS_COM const nsAFlatString& EmptyString()