mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 1317954 - Converts for(...; ...; ...) loops to use the new range-based loops in C++11 in xpcom/. r=froydnj
MozReview-Commit-ID: 9mKXvXyYa6U --HG-- extra : rebase_source : 55f74f93829b52b2c347a62520a79ab867adca35
This commit is contained in:
parent
c328cc3473
commit
d7f83a7ea6
@ -13,9 +13,7 @@ void nsID::Clear()
|
||||
m0 = 0;
|
||||
m1 = 0;
|
||||
m2 = 0;
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
m3[i] = 0;
|
||||
}
|
||||
memset(m3, 0, sizeof(m3));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1557,8 +1557,8 @@ nsLocalFile::IsExecutable(bool* aResult)
|
||||
"jar" // java application bundle
|
||||
};
|
||||
nsDependentSubstring ext = Substring(path, dotIdx + 1);
|
||||
for (size_t i = 0; i < ArrayLength(executableExts); i++) {
|
||||
if (ext.EqualsASCII(executableExts[i])) {
|
||||
for (auto executableExt : executableExts) {
|
||||
if (ext.EqualsASCII(executableExt)) {
|
||||
// Found a match. Set result and quit.
|
||||
*aResult = true;
|
||||
return NS_OK;
|
||||
|
@ -284,14 +284,14 @@ TEST(Hashtables, DataHashtable)
|
||||
// check a data-hashtable
|
||||
nsDataHashtable<nsUint32HashKey,const char*> UniToEntity(ENTITY_COUNT);
|
||||
|
||||
for (uint32_t i = 0; i < ENTITY_COUNT; ++i) {
|
||||
UniToEntity.Put(gEntities[i].mUnicode, gEntities[i].mStr);
|
||||
for (auto& entity : gEntities) {
|
||||
UniToEntity.Put(entity.mUnicode, entity.mStr);
|
||||
}
|
||||
|
||||
const char* str;
|
||||
|
||||
for (uint32_t i = 0; i < ENTITY_COUNT; ++i) {
|
||||
ASSERT_TRUE(UniToEntity.Get(gEntities[i].mUnicode, &str));
|
||||
for (auto& entity : gEntities) {
|
||||
ASSERT_TRUE(UniToEntity.Get(entity.mUnicode, &str));
|
||||
}
|
||||
|
||||
ASSERT_FALSE(UniToEntity.Get(99446, &str));
|
||||
@ -317,15 +317,15 @@ TEST(Hashtables, ClassHashtable)
|
||||
// check a class-hashtable
|
||||
nsClassHashtable<nsCStringHashKey,TestUniChar> EntToUniClass(ENTITY_COUNT);
|
||||
|
||||
for (uint32_t i = 0; i < ENTITY_COUNT; ++i) {
|
||||
TestUniChar* temp = new TestUniChar(gEntities[i].mUnicode);
|
||||
EntToUniClass.Put(nsDependentCString(gEntities[i].mStr), temp);
|
||||
for (auto& entity : gEntities) {
|
||||
TestUniChar* temp = new TestUniChar(entity.mUnicode);
|
||||
EntToUniClass.Put(nsDependentCString(entity.mStr), temp);
|
||||
}
|
||||
|
||||
TestUniChar* myChar;
|
||||
|
||||
for (uint32_t i = 0; i < ENTITY_COUNT; ++i) {
|
||||
ASSERT_TRUE(EntToUniClass.Get(nsDependentCString(gEntities[i].mStr), &myChar));
|
||||
for (auto& entity : gEntities) {
|
||||
ASSERT_TRUE(EntToUniClass.Get(nsDependentCString(entity.mStr), &myChar));
|
||||
}
|
||||
|
||||
ASSERT_FALSE(EntToUniClass.Get(NS_LITERAL_CSTRING("xxxx"), &myChar));
|
||||
@ -396,17 +396,17 @@ TEST(Hashtables, InterfaceHashtable)
|
||||
// check an interface-hashtable with an uint32_t key
|
||||
nsInterfaceHashtable<nsUint32HashKey,IFoo> UniToEntClass2(ENTITY_COUNT);
|
||||
|
||||
for (uint32_t i = 0; i < ENTITY_COUNT; ++i) {
|
||||
for (auto& entity : gEntities) {
|
||||
nsCOMPtr<IFoo> foo;
|
||||
CreateIFoo(getter_AddRefs(foo));
|
||||
foo->SetString(nsDependentCString(gEntities[i].mStr));
|
||||
foo->SetString(nsDependentCString(entity.mStr));
|
||||
|
||||
UniToEntClass2.Put(gEntities[i].mUnicode, foo);
|
||||
UniToEntClass2.Put(entity.mUnicode, foo);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < ENTITY_COUNT; ++i) {
|
||||
for (auto& entity : gEntities) {
|
||||
nsCOMPtr<IFoo> myEnt;
|
||||
ASSERT_TRUE(UniToEntClass2.Get(gEntities[i].mUnicode, getter_AddRefs(myEnt)));
|
||||
ASSERT_TRUE(UniToEntClass2.Get(entity.mUnicode, getter_AddRefs(myEnt)));
|
||||
|
||||
nsAutoCString myEntStr;
|
||||
myEnt->GetString(myEntStr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user