mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 04:39:03 +02:00
Bug 1204403 - Fix -Wshadow warnings in xpcom. r=mccr8
This commit is contained in:
parent
bfd0628cd5
commit
0dbaae1ce2
26 changed files with 215 additions and 187 deletions
|
|
@ -144,13 +144,13 @@ public:
|
|||
do { \
|
||||
size_t amount = _amount; /* evaluate _amount only once */ \
|
||||
if (amount > 0) { \
|
||||
nsresult rv; \
|
||||
rv = aHandleReport->Callback(NS_LITERAL_CSTRING("System"), _path, \
|
||||
nsresult rvReport; \
|
||||
rvReport = aHandleReport->Callback(NS_LITERAL_CSTRING("System"), _path, \
|
||||
KIND_NONHEAP, _units, amount, _desc, \
|
||||
aData); \
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { \
|
||||
if (NS_WARN_IF(NS_FAILED(rvReport))) { \
|
||||
_cleanup; \
|
||||
return rv; \
|
||||
return rvReport; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
@ -373,14 +373,15 @@ private:
|
|||
char devMinor[17];
|
||||
unsigned int inode;
|
||||
char line[1025];
|
||||
|
||||
// This variable holds the path of the current entry, or is void
|
||||
// if we're scanning for the start of a new entry.
|
||||
nsAutoCString path;
|
||||
nsAutoCString currentPath;
|
||||
int pathOffset;
|
||||
|
||||
path.SetIsVoid(true);
|
||||
currentPath.SetIsVoid(true);
|
||||
while (fgets(line, sizeof(line), aFile)) {
|
||||
if (path.IsVoid()) {
|
||||
if (currentPath.IsVoid()) {
|
||||
int n = sscanf(line,
|
||||
"%llx-%llx %4s %llx "
|
||||
"%16[0-9a-fA-F]:%16[0-9a-fA-F] %u %n",
|
||||
|
|
@ -388,8 +389,8 @@ private:
|
|||
devMinor, &inode, &pathOffset);
|
||||
|
||||
if (n >= argCount - 1) {
|
||||
path.Assign(line + pathOffset);
|
||||
path.StripChars("\n");
|
||||
currentPath.Assign(line + pathOffset);
|
||||
currentPath.StripChars("\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
@ -404,14 +405,14 @@ private:
|
|||
size_t pss = pss_kb * 1024;
|
||||
if (pss > 0) {
|
||||
nsAutoCString name, description, tag;
|
||||
GetReporterNameAndDescription(path.get(), perms, name, description, tag);
|
||||
GetReporterNameAndDescription(currentPath.get(), perms, name, description, tag);
|
||||
|
||||
nsAutoCString path("mem/processes/");
|
||||
path.Append(aProcessName);
|
||||
path.Append('/');
|
||||
path.Append(name);
|
||||
nsAutoCString processMemPath("mem/processes/");
|
||||
processMemPath.Append(aProcessName);
|
||||
processMemPath.Append('/');
|
||||
processMemPath.Append(name);
|
||||
|
||||
REPORT(path, pss, description);
|
||||
REPORT(processMemPath, pss, description);
|
||||
|
||||
// Increment the appropriate aProcessSizes values, and the total.
|
||||
aProcessSizes->Add(tag, pss);
|
||||
|
|
@ -419,7 +420,7 @@ private:
|
|||
}
|
||||
|
||||
// Now that we've seen the PSS, we're done with this entry.
|
||||
path.SetIsVoid(true);
|
||||
currentPath.SetIsVoid(true);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,3 +152,6 @@ LOCAL_INCLUDES += [
|
|||
|
||||
if CONFIG['MOZ_WIDGET_GTK']:
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ NS_STATUS_REPORTER_IMPLEMENT(StatusReporter, "StatusReporter State", getStatus)
|
|||
do { \
|
||||
const char* s2 = (s); \
|
||||
uint32_t dummy; \
|
||||
nsresult rv = (o)->Write((s2), strlen(s2), &dummy); \
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) \
|
||||
return rv; \
|
||||
nsresult rvDump = (o)->Write((s2), strlen(s2), &dummy); \
|
||||
if (NS_WARN_IF(NS_FAILED(rvDump))) \
|
||||
return rvDump; \
|
||||
} while (0)
|
||||
|
||||
static nsresult
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ SOURCES += [
|
|||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
|
|
|
|||
|
|
@ -100,3 +100,6 @@ LOCAL_INCLUDES += [
|
|||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -1016,9 +1016,9 @@ nsDiscriminatedUnion::ConvertToStringWithSize(uint32_t* aSize, char** aStr) cons
|
|||
// *aSize = *mUTF8StringValue->Length();
|
||||
// *aStr = ToNewCString(*mUTF8StringValue);
|
||||
// But this will have to do for now.
|
||||
NS_ConvertUTF8toUTF16 tempString(*u.mUTF8StringValue);
|
||||
*aSize = tempString.Length();
|
||||
*aStr = ToNewCString(tempString);
|
||||
const NS_ConvertUTF8toUTF16 tempString16(*u.mUTF8StringValue);
|
||||
*aSize = tempString16.Length();
|
||||
*aStr = ToNewCString(tempString16);
|
||||
break;
|
||||
}
|
||||
case nsIDataType::VTYPE_CHAR_STR: {
|
||||
|
|
|
|||
|
|
@ -50,17 +50,17 @@ GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
|
|||
const char* aLoaderStr,
|
||||
const char* aType)
|
||||
{
|
||||
nsCOMPtr<nsIComponentRegistrar> r = do_QueryInterface(aCompMgr);
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(aCompMgr);
|
||||
for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e) {
|
||||
r->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation,
|
||||
aLoaderStr, aType);
|
||||
registrar->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation,
|
||||
aLoaderStr, aType);
|
||||
}
|
||||
|
||||
for (const Module::ContractIDEntry* e = mData->mContractIDs;
|
||||
e && e->contractid;
|
||||
++e) {
|
||||
r->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation,
|
||||
aLoaderStr, aType);
|
||||
registrar->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation,
|
||||
aLoaderStr, aType);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICategoryManager> catman;
|
||||
|
|
@ -71,9 +71,9 @@ GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
|
|||
catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
}
|
||||
|
||||
nsAutoCString r;
|
||||
nsAutoCString prevValue;
|
||||
catman->AddCategoryEntry(e->category, e->entry, e->value, true, true,
|
||||
getter_Copies(r));
|
||||
getter_Copies(prevValue));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,3 +120,6 @@ USE_LIBS += [
|
|||
NO_EXPAND_LIBS = True
|
||||
|
||||
DIST_INSTALL = True
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -278,19 +278,19 @@ NS_IsAsciiDigit(char16_t aChar)
|
|||
return aChar >= '0' && aChar <= '9';
|
||||
}
|
||||
|
||||
|
||||
#ifndef XPCOM_GLUE_AVOID_NSPR
|
||||
#define TABLE_SIZE 36
|
||||
static const char table[] = {
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
||||
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9'
|
||||
};
|
||||
|
||||
void
|
||||
NS_MakeRandomString(char* aBuf, int32_t aBufLen)
|
||||
{
|
||||
#define TABLE_SIZE 36
|
||||
static const char table[] = {
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
||||
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9'
|
||||
};
|
||||
|
||||
// turn PR_Now() into milliseconds since epoch
|
||||
// and salt rand with that.
|
||||
static unsigned int seed = 0;
|
||||
|
|
@ -435,5 +435,3 @@ fprintf_stderr(FILE* aFile, const char* aFmt, ...)
|
|||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -267,8 +267,8 @@ nsTArray_base<Alloc, Copy>::ShiftData(index_type aStart,
|
|||
aStart *= aElemSize;
|
||||
aNewLen *= aElemSize;
|
||||
aOldLen *= aElemSize;
|
||||
char* base = reinterpret_cast<char*>(mHdr + 1) + aStart;
|
||||
Copy::MoveElements(base + aNewLen, base + aOldLen, num, aElemSize);
|
||||
char* baseAddr = reinterpret_cast<char*>(mHdr + 1) + aStart;
|
||||
Copy::MoveElements(baseAddr + aNewLen, baseAddr + aOldLen, num, aElemSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -289,20 +289,20 @@ TEST(ThreadUtils, main)
|
|||
|
||||
// Test legacy functions.
|
||||
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
nsCOMPtr<nsIRunnable> r1 =
|
||||
NS_NewRunnableMethod(rpt, &ThreadUtilsObject::Test0);
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 1, rpt->mCount);
|
||||
|
||||
r = NS_NewRunnableMethodWithArg<int>(rpt, &ThreadUtilsObject::Test1i, 11);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArg<int>(rpt, &ThreadUtilsObject::Test1i, 11);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(11, rpt->mA0);
|
||||
|
||||
// Test variadic function with simple POD arguments.
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs(rpt, &ThreadUtilsObject::Test0);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs(rpt, &ThreadUtilsObject::Test0);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 1, rpt->mCount);
|
||||
|
||||
static_assert(
|
||||
|
|
@ -314,29 +314,29 @@ TEST(ThreadUtils, main)
|
|||
StoreCopyPassByValue<int>>::value,
|
||||
"detail::ParameterStorage<StoreCopyPassByValue<int>>::Type should be StoreCopyPassByValue<int>");
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, 12);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, 12);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(12, rpt->mA0);
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs<int, int>(
|
||||
rpt, &ThreadUtilsObject::Test2i, 21, 22);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int, int>(
|
||||
rpt, &ThreadUtilsObject::Test2i, 21, 22);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 3, rpt->mCount);
|
||||
EXPECT_EQ(21, rpt->mA0);
|
||||
EXPECT_EQ(22, rpt->mA1);
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs<int, int, int>(
|
||||
rpt, &ThreadUtilsObject::Test3i, 31, 32, 33);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int, int, int>(
|
||||
rpt, &ThreadUtilsObject::Test3i, 31, 32, 33);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 4, rpt->mCount);
|
||||
EXPECT_EQ(31, rpt->mA0);
|
||||
EXPECT_EQ(32, rpt->mA1);
|
||||
EXPECT_EQ(33, rpt->mA2);
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs<int, int, int, int>(
|
||||
rpt, &ThreadUtilsObject::Test4i, 41, 42, 43, 44);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int, int, int, int>(
|
||||
rpt, &ThreadUtilsObject::Test4i, 41, 42, 43, 44);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 5, rpt->mCount);
|
||||
EXPECT_EQ(41, rpt->mA0);
|
||||
EXPECT_EQ(42, rpt->mA1);
|
||||
|
|
@ -347,8 +347,8 @@ TEST(ThreadUtils, main)
|
|||
|
||||
// Passing a short to make sure forwarding works with an inexact type match.
|
||||
short int si = 11;
|
||||
r = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, si);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, si);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(si, rpt->mA0);
|
||||
|
||||
|
|
@ -373,8 +373,8 @@ TEST(ThreadUtils, main)
|
|||
"detail::ParameterStorage<int*>::Type::passed_type should be int*");
|
||||
{
|
||||
int i = 12;
|
||||
r = NS_NewRunnableMethodWithArgs<int*>(rpt, &ThreadUtilsObject::Test1pi, &i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int*>(rpt, &ThreadUtilsObject::Test1pi, &i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
|
|
@ -400,8 +400,8 @@ TEST(ThreadUtils, main)
|
|||
"detail::ParameterStorage<const int*>::Type::passed_type should be const int*");
|
||||
{
|
||||
int i = 1201;
|
||||
r = NS_NewRunnableMethodWithArgs<const int*>(rpt, &ThreadUtilsObject::Test1pci, &i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<const int*>(rpt, &ThreadUtilsObject::Test1pci, &i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
|
|
@ -415,9 +415,9 @@ TEST(ThreadUtils, main)
|
|||
"StoreCopyPassByPtr<int>::passed_type should be int*");
|
||||
{
|
||||
int i = 1202;
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByPtr<int>>(
|
||||
rpt, &ThreadUtilsObject::Test1pi, i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<StoreCopyPassByPtr<int>>(
|
||||
rpt, &ThreadUtilsObject::Test1pi, i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
|
|
@ -431,9 +431,9 @@ TEST(ThreadUtils, main)
|
|||
"StoreCopyPassByConstPtr<int>::passed_type should be const int*");
|
||||
{
|
||||
int i = 1203;
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstPtr<int>>(
|
||||
rpt, &ThreadUtilsObject::Test1pci, i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstPtr<int>>(
|
||||
rpt, &ThreadUtilsObject::Test1pci, i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
|
|
@ -491,8 +491,8 @@ TEST(ThreadUtils, main)
|
|||
"ParameterStorage<int&>::Type::passed_type should be int&");
|
||||
{
|
||||
int i = 13;
|
||||
r = NS_NewRunnableMethodWithArgs<int&>(rpt, &ThreadUtilsObject::Test1ri, i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int&>(rpt, &ThreadUtilsObject::Test1ri, i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
|
|
@ -512,10 +512,10 @@ TEST(ThreadUtils, main)
|
|||
"ParameterStorage<int&&>::Type::passed_type should be int&&");
|
||||
{
|
||||
int i = 14;
|
||||
r = NS_NewRunnableMethodWithArgs<int&&>(
|
||||
r1 = NS_NewRunnableMethodWithArgs<int&&>(
|
||||
rpt, &ThreadUtilsObject::Test1rri, mozilla::Move(i));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(14, rpt->mA0);
|
||||
|
||||
|
|
@ -534,10 +534,10 @@ TEST(ThreadUtils, main)
|
|||
"ParameterStorage<UniquePtr<int>&&>::Type::passed_type should be UniquePtr<int>&&");
|
||||
{
|
||||
mozilla::UniquePtr<int> upi;
|
||||
r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(-1, rpt->mA0);
|
||||
rpt->mA0 = 0;
|
||||
|
|
@ -557,48 +557,48 @@ TEST(ThreadUtils, main)
|
|||
"ParameterStorage<StoreCopyPassByRRef<UniquePtr<int>>>::Type::passed_type should be UniquePtr<int>&&");
|
||||
{
|
||||
mozilla::UniquePtr<int> upi;
|
||||
r = NS_NewRunnableMethodWithArgs
|
||||
<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
r1 = NS_NewRunnableMethodWithArgs
|
||||
<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(-1, rpt->mA0);
|
||||
|
||||
// Unique pointer as xvalue.
|
||||
{
|
||||
mozilla::UniquePtr<int> upi = mozilla::MakeUnique<int>(1);
|
||||
r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(1, rpt->mA0);
|
||||
|
||||
{
|
||||
mozilla::UniquePtr<int> upi = mozilla::MakeUnique<int>(1);
|
||||
r = NS_NewRunnableMethodWithArgs
|
||||
<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>
|
||||
(rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
r1 = NS_NewRunnableMethodWithArgs
|
||||
<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>
|
||||
(rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(1, rpt->mA0);
|
||||
|
||||
// Unique pointer as prvalue.
|
||||
r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::MakeUnique<int>(2));
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::MakeUnique<int>(2));
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(2, rpt->mA0);
|
||||
|
||||
// Unique pointer as lvalue to lref.
|
||||
{
|
||||
mozilla::UniquePtr<int> upi;
|
||||
r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&>(
|
||||
rpt, &ThreadUtilsObject::Test1rupi, upi);
|
||||
r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&>(
|
||||
rpt, &ThreadUtilsObject::Test1rupi, upi);
|
||||
// Passed as lref, so Run() must be called while local upi is still alive!
|
||||
r->Run();
|
||||
r1->Run();
|
||||
}
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(-1, rpt->mA0);
|
||||
|
|
@ -608,15 +608,15 @@ TEST(ThreadUtils, main)
|
|||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by value\n", __LINE__); }
|
||||
{ // Block around nsCOMPtr lifetime.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r2;
|
||||
{ // Block around Spy lifetime.
|
||||
if (gDebug) { printf("%d - Spy s(10)\n", __LINE__); }
|
||||
Spy s(10);
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, s)\n", __LINE__); }
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByValue, s);
|
||||
if (gDebug) { printf("%d - r2 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, s)\n", __LINE__); }
|
||||
r2 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByValue, s);
|
||||
EXPECT_EQ(2, gAlive);
|
||||
EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
|
||||
Spy::ClearActions();
|
||||
|
|
@ -626,7 +626,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r2->Run();
|
||||
EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
|
||||
EXPECT_EQ(10, rpt->mSpy.mID);
|
||||
EXPECT_LE(1, gDestructions);
|
||||
|
|
@ -641,8 +641,8 @@ TEST(ThreadUtils, main)
|
|||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by value\n", __LINE__); }
|
||||
{
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, Spy(11))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r3 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, Spy(11))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r3 =
|
||||
NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByValue, Spy(11));
|
||||
EXPECT_EQ(1, gAlive);
|
||||
|
|
@ -650,7 +650,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_LE(1, gMoveConstructions);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r3->Run();
|
||||
EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
|
||||
EXPECT_EQ(11, rpt->mSpy.mID);
|
||||
EXPECT_LE(1, gDestructions);
|
||||
|
|
@ -664,13 +664,13 @@ TEST(ThreadUtils, main)
|
|||
|
||||
Spy::ClearAll();
|
||||
{ // Store copy from xvalue, pass by value.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r4;
|
||||
{
|
||||
Spy s(12);
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
r4 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByValue, mozilla::Move(s));
|
||||
EXPECT_LE(1, gMoveConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
|
|
@ -681,7 +681,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gAlive);
|
||||
EXPECT_EQ(0, gZombies);
|
||||
Spy::ClearActions();
|
||||
r->Run();
|
||||
r4->Run();
|
||||
EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
|
||||
EXPECT_EQ(12, rpt->mSpy.mID);
|
||||
EXPECT_LE(1, gDestructions);
|
||||
|
|
@ -695,15 +695,15 @@ TEST(ThreadUtils, main)
|
|||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by const lvalue ref\n", __LINE__); }
|
||||
{ // Block around nsCOMPtr lifetime.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r5;
|
||||
{ // Block around Spy lifetime.
|
||||
if (gDebug) { printf("%d - Spy s(20)\n", __LINE__); }
|
||||
Spy s(20);
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, s)\n", __LINE__); }
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByConstLRef, s);
|
||||
if (gDebug) { printf("%d - r5 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, s)\n", __LINE__); }
|
||||
r5 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByConstLRef, s);
|
||||
EXPECT_EQ(2, gAlive);
|
||||
EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
|
||||
Spy::ClearActions();
|
||||
|
|
@ -713,7 +713,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r5->Run();
|
||||
EXPECT_EQ(0, gCopyConstructions); // No copies in call.
|
||||
EXPECT_EQ(20, rpt->mSpy.mID);
|
||||
EXPECT_EQ(0, gDestructions);
|
||||
|
|
@ -728,8 +728,8 @@ TEST(ThreadUtils, main)
|
|||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by const lvalue ref\n", __LINE__); }
|
||||
{
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, Spy(21))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r6 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, Spy(21))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r6 =
|
||||
NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByConstLRef, Spy(21));
|
||||
EXPECT_EQ(1, gAlive);
|
||||
|
|
@ -737,7 +737,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_LE(1, gMoveConstructions);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r6->Run();
|
||||
EXPECT_EQ(0, gCopyConstructions); // No copies in call.
|
||||
EXPECT_EQ(21, rpt->mSpy.mID);
|
||||
EXPECT_EQ(0, gDestructions);
|
||||
|
|
@ -752,15 +752,15 @@ TEST(ThreadUtils, main)
|
|||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by rvalue ref\n", __LINE__); }
|
||||
{ // Block around nsCOMPtr lifetime.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r7;
|
||||
{ // Block around Spy lifetime.
|
||||
if (gDebug) { printf("%d - Spy s(30)\n", __LINE__); }
|
||||
Spy s(30);
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, s)\n", __LINE__); }
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByRRef, s);
|
||||
if (gDebug) { printf("%d - r7 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, s)\n", __LINE__); }
|
||||
r7 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByRRef, s);
|
||||
EXPECT_EQ(2, gAlive);
|
||||
EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
|
||||
Spy::ClearActions();
|
||||
|
|
@ -770,7 +770,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r7->Run();
|
||||
EXPECT_LE(1, gMoves); // Move in call.
|
||||
EXPECT_EQ(30, rpt->mSpy.mID);
|
||||
EXPECT_EQ(0, gDestructions);
|
||||
|
|
@ -786,8 +786,8 @@ TEST(ThreadUtils, main)
|
|||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by rvalue ref\n", __LINE__); }
|
||||
{
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, Spy(31))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r8 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, Spy(31))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r8 =
|
||||
NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByRRef, Spy(31));
|
||||
EXPECT_EQ(1, gAlive);
|
||||
|
|
@ -795,7 +795,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_LE(1, gMoveConstructions);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r8->Run();
|
||||
EXPECT_LE(1, gMoves); // Move in call.
|
||||
EXPECT_EQ(31, rpt->mSpy.mID);
|
||||
EXPECT_EQ(0, gDestructions);
|
||||
|
|
@ -816,8 +816,8 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy&>(&TestByLRef, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r9 = NS_NewRunnableMethodWithArgs<Spy&>(&TestByLRef, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r9 =
|
||||
NS_NewRunnableMethodWithArgs<Spy&>(
|
||||
rpt, &ThreadUtilsObject::TestByLRef, s);
|
||||
EXPECT_EQ(0, gAllConstructions);
|
||||
|
|
@ -825,7 +825,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r9->Run();
|
||||
EXPECT_LE(1, gAssignments); // Assignment from reference in call.
|
||||
EXPECT_EQ(40, rpt->mSpy.mID);
|
||||
EXPECT_EQ(&s, rpt->mSpyPtr);
|
||||
|
|
@ -841,7 +841,7 @@ TEST(ThreadUtils, main)
|
|||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store nsRefPtr, pass by pointer\n", __LINE__); }
|
||||
{ // Block around nsCOMPtr lifetime.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r10;
|
||||
SpyWithISupports* ptr = 0;
|
||||
{ // Block around nsRefPtr<Spy> lifetime.
|
||||
if (gDebug) { printf("%d - nsRefPtr<SpyWithISupports> s(new SpyWithISupports(45))\n", __LINE__); }
|
||||
|
|
@ -849,9 +849,9 @@ TEST(ThreadUtils, main)
|
|||
ptr = s.get();
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<Spy>>(&TestByRRef, s.get())\n", __LINE__); }
|
||||
r = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<SpyWithISupports>>(
|
||||
rpt, &ThreadUtilsObject::TestByPointer, s.get());
|
||||
if (gDebug) { printf("%d - r10 = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<Spy>>(&TestByRRef, s.get())\n", __LINE__); }
|
||||
r10 = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<SpyWithISupports>>(
|
||||
rpt, &ThreadUtilsObject::TestByPointer, s.get());
|
||||
EXPECT_LE(0, gAllConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
|
|
@ -861,7 +861,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r10->Run();
|
||||
EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
|
||||
EXPECT_EQ(45, rpt->mSpy.mID);
|
||||
EXPECT_EQ(ptr, rpt->mSpyPtr);
|
||||
|
|
@ -882,8 +882,8 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r11 = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r11 =
|
||||
NS_NewRunnableMethodWithArgs<Spy*>(
|
||||
rpt, &ThreadUtilsObject::TestByPointer, &s);
|
||||
EXPECT_EQ(0, gAllConstructions);
|
||||
|
|
@ -891,7 +891,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r11->Run();
|
||||
EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
|
||||
EXPECT_EQ(55, rpt->mSpy.mID);
|
||||
EXPECT_EQ(&s, rpt->mSpyPtr);
|
||||
|
|
@ -912,8 +912,8 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r12 = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r12 =
|
||||
NS_NewRunnableMethodWithArgs<const Spy*>(
|
||||
rpt, &ThreadUtilsObject::TestByPointerToConst, &s);
|
||||
EXPECT_EQ(0, gAllConstructions);
|
||||
|
|
@ -921,7 +921,7 @@ TEST(ThreadUtils, main)
|
|||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r12->Run();
|
||||
EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
|
||||
EXPECT_EQ(60, rpt->mSpy.mID);
|
||||
EXPECT_EQ(&s, rpt->mSpyPtr);
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
|||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
#include "nsCRT.h"
|
||||
#include "plstr.h"
|
||||
|
||||
static const char hexChars[] = "0123456789ABCDEF";
|
||||
static const char hexCharsUpper[] = "0123456789ABCDEF";
|
||||
static const char hexCharsUpperLower[] = "0123456789ABCDEFabcdef";
|
||||
|
||||
static const int netCharType[256] =
|
||||
/* Bit 0 xalpha -- the alphas
|
||||
|
|
@ -51,8 +52,8 @@ AppendPercentHex(char* aBuffer, unsigned char aChar)
|
|||
{
|
||||
uint32_t i = 0;
|
||||
aBuffer[i++] = '%';
|
||||
aBuffer[i++] = hexChars[aChar >> 4]; // high nibble
|
||||
aBuffer[i++] = hexChars[aChar & 0xF]; // low nibble
|
||||
aBuffer[i++] = hexCharsUpper[aChar >> 4]; // high nibble
|
||||
aBuffer[i++] = hexCharsUpper[aChar & 0xF]; // low nibble
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -63,11 +64,11 @@ AppendPercentHex(char16_t* aBuffer, char16_t aChar)
|
|||
aBuffer[i++] = '%';
|
||||
if (aChar & 0xff00) {
|
||||
aBuffer[i++] = 'u';
|
||||
aBuffer[i++] = hexChars[aChar >> 12]; // high-byte high nibble
|
||||
aBuffer[i++] = hexChars[(aChar >> 8) & 0xF]; // high-byte low nibble
|
||||
aBuffer[i++] = hexCharsUpper[aChar >> 12]; // high-byte high nibble
|
||||
aBuffer[i++] = hexCharsUpper[(aChar >> 8) & 0xF]; // high-byte low nibble
|
||||
}
|
||||
aBuffer[i++] = hexChars[(aChar >> 4) & 0xF]; // low-byte high nibble
|
||||
aBuffer[i++] = hexChars[aChar & 0xF]; // low-byte low nibble
|
||||
aBuffer[i++] = hexCharsUpper[(aChar >> 4) & 0xF]; // low-byte high nibble
|
||||
aBuffer[i++] = hexCharsUpper[aChar & 0xF]; // low-byte low nibble
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -124,8 +125,8 @@ nsEscapeCount(const char* aStr, nsEscapeMask aFlags, size_t* aOutLen)
|
|||
*dst++ = '+'; /* convert spaces to pluses */
|
||||
} else {
|
||||
*dst++ = HEX_ESCAPE;
|
||||
*dst++ = hexChars[c >> 4]; /* high nibble */
|
||||
*dst++ = hexChars[c & 0x0f]; /* low nibble */
|
||||
*dst++ = hexCharsUpper[c >> 4]; /* high nibble */
|
||||
*dst++ = hexCharsUpper[c & 0x0f]; /* low nibble */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -135,8 +136,8 @@ nsEscapeCount(const char* aStr, nsEscapeMask aFlags, size_t* aOutLen)
|
|||
*dst++ = c;
|
||||
} else {
|
||||
*dst++ = HEX_ESCAPE;
|
||||
*dst++ = hexChars[c >> 4]; /* high nibble */
|
||||
*dst++ = hexChars[c & 0x0f]; /* low nibble */
|
||||
*dst++ = hexCharsUpper[c >> 4]; /* high nibble */
|
||||
*dst++ = hexCharsUpper[c & 0x0f]; /* low nibble */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -175,7 +176,6 @@ nsUnescapeCount(char* aStr)
|
|||
{
|
||||
char* src = aStr;
|
||||
char* dst = aStr;
|
||||
static const char hexChars[] = "0123456789ABCDEFabcdef";
|
||||
|
||||
char c1[] = " ";
|
||||
char c2[] = " ";
|
||||
|
|
@ -197,8 +197,8 @@ nsUnescapeCount(char* aStr)
|
|||
c2[0] = *(src + 2);
|
||||
}
|
||||
|
||||
if (*src != HEX_ESCAPE || PL_strpbrk(pc1, hexChars) == 0 ||
|
||||
PL_strpbrk(pc2, hexChars) == 0) {
|
||||
if (*src != HEX_ESCAPE || PL_strpbrk(pc1, hexCharsUpperLower) == 0 ||
|
||||
PL_strpbrk(pc2, hexCharsUpperLower) == 0) {
|
||||
*dst++ = *src++;
|
||||
} else {
|
||||
src++; /* walk over escape */
|
||||
|
|
@ -498,7 +498,7 @@ NS_EscapeURL(const nsAFlatString& aStr, const nsTArray<char16_t>& aForbidden,
|
|||
nsSubstring& aResult)
|
||||
{
|
||||
bool didEscape = false;
|
||||
for (size_t i = 0, len = aStr.Length(); i < len; ) {
|
||||
for (size_t i = 0, strLen = aStr.Length(); i < strLen; ) {
|
||||
size_t j;
|
||||
if (MOZ_UNLIKELY(FindFirstMatchFrom(aStr, i, aForbidden, &j))) {
|
||||
if (i == 0) {
|
||||
|
|
@ -511,14 +511,14 @@ NS_EscapeURL(const nsAFlatString& aStr, const nsTArray<char16_t>& aForbidden,
|
|||
aResult.Append(nsDependentSubstring(aStr, i, j - i));
|
||||
}
|
||||
char16_t buffer[ENCODE_MAX_LEN];
|
||||
uint32_t len = ::AppendPercentHex(buffer, aStr[j]);
|
||||
MOZ_ASSERT(len <= ENCODE_MAX_LEN, "buffer overflow");
|
||||
aResult.Append(buffer, len);
|
||||
uint32_t bufferLen = ::AppendPercentHex(buffer, aStr[j]);
|
||||
MOZ_ASSERT(bufferLen <= ENCODE_MAX_LEN, "buffer overflow");
|
||||
aResult.Append(buffer, bufferLen);
|
||||
i = j + 1;
|
||||
} else {
|
||||
if (MOZ_UNLIKELY(didEscape)) {
|
||||
// The tail of the string that needs no escaping.
|
||||
aResult.Append(nsDependentSubstring(aStr, i, len - i));
|
||||
aResult.Append(nsDependentSubstring(aStr, i, strLen - i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -529,7 +529,7 @@ NS_EscapeURL(const nsAFlatString& aStr, const nsTArray<char16_t>& aForbidden,
|
|||
return aStr;
|
||||
}
|
||||
|
||||
#define ISHEX(c) memchr(hexChars, c, sizeof(hexChars)-1)
|
||||
#define ISHEX(c) memchr(hexCharsUpperLower, c, sizeof(hexCharsUpperLower)-1)
|
||||
|
||||
bool
|
||||
NS_UnescapeURL(const char* aStr, int32_t aLen, uint32_t aFlags,
|
||||
|
|
@ -549,8 +549,6 @@ NS_UnescapeURL(const char* aStr, int32_t aLen, uint32_t aFlags,
|
|||
bool writing = !!(aFlags & esc_AlwaysCopy);
|
||||
bool skipControl = !!(aFlags & esc_SkipControl);
|
||||
|
||||
static const char hexChars[] = "0123456789ABCDEFabcdef";
|
||||
|
||||
const char* last = aStr;
|
||||
const char* p = aStr;
|
||||
|
||||
|
|
|
|||
|
|
@ -138,9 +138,9 @@ nsLocalFile::CreateUnique(uint32_t aType, uint32_t aAttributes)
|
|||
rootName.SetLength(maxRootLength);
|
||||
SetNativeLeafName(rootName + suffix);
|
||||
#endif
|
||||
nsresult rv = Create(aType, aAttributes);
|
||||
if (rv != NS_ERROR_FILE_ALREADY_EXISTS) {
|
||||
return rv;
|
||||
nsresult rvCreate = Create(aType, aAttributes);
|
||||
if (rvCreate != NS_ERROR_FILE_ALREADY_EXISTS) {
|
||||
return rvCreate;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ AvailableMaybeSeek(nsIInputStream* aStream, uint64_t* aResult)
|
|||
// Seek() could reopen the file if REOPEN_ON_REWIND flag is set.
|
||||
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(aStream);
|
||||
if (seekable) {
|
||||
nsresult rv = seekable->Seek(nsISeekableStream::NS_SEEK_CUR, 0);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsresult rvSeek = seekable->Seek(nsISeekableStream::NS_SEEK_CUR, 0);
|
||||
if (NS_SUCCEEDED(rvSeek)) {
|
||||
rv = aStream->Available(aResult);
|
||||
}
|
||||
}
|
||||
|
|
@ -117,8 +117,8 @@ TellMaybeSeek(nsISeekableStream* aSeekable, int64_t* aResult)
|
|||
// NS_BASE_STREAM_CLOSED.
|
||||
// If nsIFileInputStream is closed in Read() due to CLOSE_ON_EOF flag,
|
||||
// Seek() could reopen the file if REOPEN_ON_REWIND flag is set.
|
||||
nsresult rv = aSeekable->Seek(nsISeekableStream::NS_SEEK_CUR, 0);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsresult rvSeek = aSeekable->Seek(nsISeekableStream::NS_SEEK_CUR, 0);
|
||||
if (NS_SUCCEEDED(rvSeek)) {
|
||||
rv = aSeekable->Tell(aResult);
|
||||
}
|
||||
}
|
||||
|
|
@ -828,4 +828,3 @@ nsMultiplexInputStream::Clone(nsIInputStream** aClone)
|
|||
clone.forget(aClone);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,3 +138,6 @@ DEFINES['MOZILLA_EXTERNAL_LINKAGE'] = True
|
|||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
SPHINX_TREES['libxpcomrt'] = 'docs'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -325,3 +325,6 @@ LOCAL_INCLUDES += [
|
|||
]
|
||||
|
||||
NO_PGO = True
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -604,10 +604,10 @@ xptiInterfaceEntry::GetInterfaceIsArgNumberForParam(uint16_t methodIndex,
|
|||
}
|
||||
|
||||
nsresult
|
||||
xptiInterfaceEntry::IsIID(const nsIID * IID, bool *_retval)
|
||||
xptiInterfaceEntry::IsIID(const nsIID * iid, bool *_retval)
|
||||
{
|
||||
// It is not necessary to Resolve because this info is read from manifest.
|
||||
*_retval = mIID.Equals(*IID);
|
||||
*_retval = mIID.Equals(*iid);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,3 +57,6 @@ if CONFIG['INTEL_ARCHITECTURE']:
|
|||
SOURCES['nsUTF8UtilsSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -640,9 +640,9 @@ main(void) {
|
|||
exit (30);
|
||||
}
|
||||
|
||||
nsAutoCString str;
|
||||
myEnt->GetString(str);
|
||||
printf("Found %s\n", str.get());
|
||||
nsAutoCString myEntStr;
|
||||
myEnt->GetString(myEntStr);
|
||||
printf("Found %s\n", myEntStr.get());
|
||||
}
|
||||
|
||||
printf("Testing nonexistent entries...");
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ int main(int argc, char** argv)
|
|||
ScopedXPCOM xpcom("RacingServiceManager");
|
||||
NS_ENSURE_FALSE(xpcom.failed(), 1);
|
||||
|
||||
AutoCreateAndDestroyReentrantMonitor mon(&gReentrantMonitor);
|
||||
AutoCreateAndDestroyReentrantMonitor mon1(&gReentrantMonitor);
|
||||
|
||||
nsRefPtr<Runnable> runnable = new Runnable();
|
||||
NS_ENSURE_TRUE(runnable, 1);
|
||||
|
|
@ -270,13 +270,13 @@ int main(int argc, char** argv)
|
|||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(*gReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter mon2(*gReentrantMonitor);
|
||||
|
||||
gMainThreadWaiting = true;
|
||||
mon.Notify();
|
||||
mon2.Notify();
|
||||
|
||||
while (!gCreateInstanceCalled) {
|
||||
mon.Wait();
|
||||
mon2.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -292,13 +292,13 @@ int main(int argc, char** argv)
|
|||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(*gReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter mon3(*gReentrantMonitor);
|
||||
|
||||
gMainThreadWaiting = true;
|
||||
mon.Notify();
|
||||
mon3.Notify();
|
||||
|
||||
while (!gCreateInstanceCalled) {
|
||||
mon.Wait();
|
||||
mon3.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,3 +21,6 @@ DEFINES['LIBRARY_FILENAME'] = '%s%s%s' % (
|
|||
# Need to link with CoreFoundation on Mac
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
OS_LIBS += CONFIG['TK_LIBS']
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -28,3 +28,6 @@ UNIFIED_SOURCES += [
|
|||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul-gtest'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -108,3 +108,6 @@ LOCAL_INCLUDES += [
|
|||
RESOURCE_FILES += [
|
||||
'test.properties',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
bool LoopInDir(nsIFile* file)
|
||||
static bool LoopInDir(nsIFile* aFile)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISimpleEnumerator> entries;
|
||||
rv = file->GetDirectoryEntries(getter_AddRefs(entries));
|
||||
rv = aFile->GetDirectoryEntries(getter_AddRefs(entries));
|
||||
if(NS_FAILED(rv) || !entries)
|
||||
return false;
|
||||
|
||||
|
|
@ -25,17 +25,17 @@ bool LoopInDir(nsIFile* file)
|
|||
if(!sup)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIFile> file = do_QueryInterface(sup);
|
||||
if(!file)
|
||||
nsCOMPtr<nsIFile> nextFile = do_QueryInterface(sup);
|
||||
if (!nextFile)
|
||||
return false;
|
||||
|
||||
nsAutoCString name;
|
||||
if(NS_FAILED(file->GetNativeLeafName(name)))
|
||||
if(NS_FAILED(nextFile->GetNativeLeafName(name)))
|
||||
return false;
|
||||
|
||||
bool isDir;
|
||||
printf("%s\n", name.get());
|
||||
rv = file->IsDirectory(&isDir);
|
||||
rv = nextFile->IsDirectory(&isDir);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
printf("IsDirectory Failed!!!\n");
|
||||
|
|
@ -44,7 +44,7 @@ bool LoopInDir(nsIFile* file)
|
|||
|
||||
if (isDir)
|
||||
{
|
||||
LoopInDir(file);
|
||||
LoopInDir(nextFile);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -36,3 +36,6 @@ if CONFIG['_MSC_VER']:
|
|||
DEFINES['MOZ_NO_MOZALLOC'] = True
|
||||
|
||||
DIST_INSTALL = True
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
|
|
|||
Loading…
Reference in a new issue