Bug 379339 StringBegins/EndsWith inconsistent with nsReadableUtils.cpp r=bsmedberg sr=darin

This commit is contained in:
neil@parkwaycc.co.uk 2007-05-07 04:09:54 -07:00
Родитель 0c671547ab
Коммит 212b1c5362
1 изменённых файлов: 8 добавлений и 8 удалений

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

@ -1228,32 +1228,32 @@ inline PRBool
StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring,
nsAString::ComparatorFunc aComparator = nsAString::DefaultComparator)
{
return StringHead(aSource, aSubstring.Length()).
Equals(aSubstring, aComparator);
return aSubstring.Length() <= aSource.Length() &&
StringHead(aSource, aSubstring.Length()).Equals(aSubstring, aComparator);
}
inline PRBool
StringEndsWith(const nsAString& aSource, const nsAString& aSubstring,
nsAString::ComparatorFunc aComparator = nsAString::DefaultComparator)
{
return StringTail(aSource, aSubstring.Length()).
Equals(aSubstring, aComparator);
return aSubstring.Length() <= aSource.Length() &&
StringTail(aSource, aSubstring.Length()).Equals(aSubstring, aComparator);
}
inline PRBool
StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring,
nsACString::ComparatorFunc aComparator = nsACString::DefaultComparator)
{
return StringHead(aSource, aSubstring.Length()).
Equals(aSubstring, aComparator);
return aSubstring.Length() <= aSource.Length() &&
StringHead(aSource, aSubstring.Length()).Equals(aSubstring, aComparator);
}
inline PRBool
StringEndsWith(const nsACString& aSource, const nsACString& aSubstring,
nsACString::ComparatorFunc aComparator = nsACString::DefaultComparator)
{
return StringTail(aSource, aSubstring.Length()).
Equals(aSubstring, aComparator);
return aSubstring.Length() <= aSource.Length() &&
StringTail(aSource, aSubstring.Length()).Equals(aSubstring, aComparator);
}
/**