зеркало из https://github.com/mozilla/pjs.git
Bug 387023: minor string cleanup in nsAtomTable.cpp. r=bsmedberg, a=bzbarsky.
This commit is contained in:
Родитель
466131324d
Коммит
ee94534b3e
|
@ -288,9 +288,9 @@ AtomTableMatchKey(PLDHashTable *table, const PLDHashEntryHdr *entry,
|
||||||
|
|
||||||
if (strKey->IsUTF16String()) {
|
if (strKey->IsUTF16String()) {
|
||||||
return
|
return
|
||||||
CompareUTF8toUTF16(nsDependentCString(atomString, he->getLength()),
|
CompareUTF8toUTF16(nsDependentCSubstring(atomString, atomString + he->getLength()),
|
||||||
nsDependentString(strKey->getUTF16String(),
|
nsDependentSubstring(strKey->getUTF16String(),
|
||||||
strKey->getLength())) == 0;
|
strKey->getUTF16String() + strKey->getLength())) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRUint32 length = he->getLength();
|
PRUint32 length = he->getLength();
|
||||||
|
@ -544,7 +544,7 @@ NS_IMETHODIMP
|
||||||
AtomImpl::Equals(const nsAString& aString, PRBool* aResult)
|
AtomImpl::Equals(const nsAString& aString, PRBool* aResult)
|
||||||
{
|
{
|
||||||
*aResult = CompareUTF8toUTF16(nsDependentCString(mString, mLength),
|
*aResult = CompareUTF8toUTF16(nsDependentCString(mString, mLength),
|
||||||
PromiseFlatString(aString)) == 0;
|
aString) == 0;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ nsStaticAtomWrapper::Equals(const nsAString& aString, PRBool* aResult)
|
||||||
{
|
{
|
||||||
*aResult = CompareUTF8toUTF16(nsDependentCString(mStaticAtom->mString,
|
*aResult = CompareUTF8toUTF16(nsDependentCString(mStaticAtom->mString,
|
||||||
mLength),
|
mLength),
|
||||||
PromiseFlatString(aString)) == 0;
|
aString) == 0;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -715,7 +715,7 @@ NS_NewAtom(const char* aUTF8String)
|
||||||
NS_COM nsIAtom*
|
NS_COM nsIAtom*
|
||||||
NS_NewAtom(const nsACString& aUTF8String)
|
NS_NewAtom(const nsACString& aUTF8String)
|
||||||
{
|
{
|
||||||
AtomTableEntry *he = GetAtomHashEntry(PromiseFlatCString(aUTF8String).get(),
|
AtomTableEntry *he = GetAtomHashEntry(aUTF8String.Data(),
|
||||||
aUTF8String.Length());
|
aUTF8String.Length());
|
||||||
|
|
||||||
if (!he) {
|
if (!he) {
|
||||||
|
@ -728,10 +728,7 @@ NS_NewAtom(const nsACString& aUTF8String)
|
||||||
if (he->HasValue())
|
if (he->HasValue())
|
||||||
return he->GetAtom();
|
return he->GetAtom();
|
||||||
|
|
||||||
// MSVC.NET doesn't like passing a temporary nsDependentCString() to
|
AtomImpl* atom = new (aUTF8String) AtomImpl();
|
||||||
// operator new, so declare one as a local instead.
|
|
||||||
nsDependentCString str(aUTF8String);
|
|
||||||
AtomImpl* atom = new (str) AtomImpl();
|
|
||||||
he->SetAtomImpl(atom);
|
he->SetAtomImpl(atom);
|
||||||
if (!atom) {
|
if (!atom) {
|
||||||
PL_DHashTableRawRemove(&gAtomTable, he);
|
PL_DHashTableRawRemove(&gAtomTable, he);
|
||||||
|
@ -751,7 +748,7 @@ NS_NewAtom(const PRUnichar* aUTF16String)
|
||||||
NS_COM nsIAtom*
|
NS_COM nsIAtom*
|
||||||
NS_NewAtom(const nsAString& aUTF16String)
|
NS_NewAtom(const nsAString& aUTF16String)
|
||||||
{
|
{
|
||||||
AtomTableEntry *he = GetAtomHashEntry(PromiseFlatString(aUTF16String).get(),
|
AtomTableEntry *he = GetAtomHashEntry(aUTF16String.Data(),
|
||||||
aUTF16String.Length());
|
aUTF16String.Length());
|
||||||
|
|
||||||
if (he->HasValue())
|
if (he->HasValue())
|
||||||
|
@ -780,7 +777,7 @@ NS_NewPermanentAtom(const char* aUTF8String)
|
||||||
NS_COM nsIAtom*
|
NS_COM nsIAtom*
|
||||||
NS_NewPermanentAtom(const nsACString& aUTF8String)
|
NS_NewPermanentAtom(const nsACString& aUTF8String)
|
||||||
{
|
{
|
||||||
AtomTableEntry *he = GetAtomHashEntry(PromiseFlatCString(aUTF8String).get(),
|
AtomTableEntry *he = GetAtomHashEntry(aUTF8String.Data(),
|
||||||
aUTF8String.Length());
|
aUTF8String.Length());
|
||||||
|
|
||||||
if (he->HasValue() && he->IsStaticAtom())
|
if (he->HasValue() && he->IsStaticAtom())
|
||||||
|
|
Загрузка…
Ссылка в новой задаче