mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1766377 - Fix remaining sign-compare warnings in Windows builds. r=rkraesig,gsvelto,media-playback-reviewers,gfx-reviewers,bryce,sotaro
browser/components/shell/WindowsUserChoice.cpp(233,23): error: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long long') [-Werror,-Wsign-compare] for (int j = 0; j < DWORDS_PER_BLOCK; ++j) { ~ ^ ~~~~~~~~~~~~~~~~ browser/components/shell/WindowsUserChoice.cpp(388,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < ArrayLength(exts); ++i) { ~ ^ ~~~~~~~~~~~~~~~~~ browser/components/shell/nsWindowsShellService.cpp(1225,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < ArrayLength(shortcutCSIDLs); ++i) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ browser/components/shell/nsWindowsShellService.cpp(1492,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < ArrayLength(folders); ++i) { ~ ^ ~~~~~~~~~~~~~~~~~~~~ dom/media/platforms/wmf/MFTDecoder.cpp(85,23): error: comparison of integers of different signs: 'int' and 'UINT32' (aka 'unsigned int') [-Werror,-Wsign-compare] for (int i = 1; i < actsNum; i++) { ~ ^ ~~~~~~~ gfx/2d/Factory.cpp(1276,21): error: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Werror,-Wsign-compare] for (int y = 0; y < height; y++) { ~ ^ ~~~~~~ gfx/layers/d3d11/CompositorD3D11.cpp(1096,36): error: comparison of integers of different signs: 'UINT' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare] swapDesc.BufferDesc.Height == mSize.height) || ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ gfx/layers/d3d11/CompositorD3D11.cpp(1095,35): error: comparison of integers of different signs: 'UINT' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare] if (((swapDesc.BufferDesc.Width == mSize.width && ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~ gfx/layers/d3d11/TextureD3D11.cpp(1278,30): error: comparison of integers of different signs: 'UINT' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare] currentDesc.Height != mSize.height || ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ gfx/layers/d3d11/TextureD3D11.cpp(1277,29): error: comparison of integers of different signs: 'UINT' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare] if (currentDesc.Width != mSize.width || ~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~ gfx/layers/ipc/ContentCompositorBridgeParent.cpp(248,19): error: comparison of integers of different signs: 'const uint32_t' (aka 'const unsigned int') and 'int32_t' (aka 'int') [-Werror,-Wsign-compare] if (sequenceNum == status.sequenceNumber() && !dm->HasDeviceReset()) { ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~ gfx/thebes/D3D11Checks.cpp(129,21): error: comparison of integers of different signs: 'int' and 'unsigned int' [-Werror,-Wsign-compare] if (resultColor != 0xffffff00) { ~~~~~~~~~~~ ^ ~~~~~~~~~~ gfx/thebes/D3D11Checks.cpp(154,23): error: comparison of integers of different signs: 'int' and 'unsigned long long' [-Werror,-Wsign-compare] for (int i = 0; i < PR_ARRAY_SIZE(checkModules); i += 1) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ gfx/thebes/D3D11Checks.cpp(409,14): error: comparison of integers of different signs: 'int32_t' (aka 'int') and 'UINT' (aka 'unsigned int') [-Werror,-Wsign-compare] if (vendor != desc.VendorId) { ~~~~~~ ^ ~~~~~~~~~~~~~ gfx/thebes/gfxDWriteFontList.cpp(1248,39): error: comparison of integers of different signs: 'unsigned int' and 'int' [-Werror,-Wsign-compare] addFamily(names[index], index != sysLocIndex); ~~~~~ ^ ~~~~~~~~~~~ intl/lwbrk/nsUniscribeBreaker.cpp(121,21): error: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Werror,-Wsign-compare] for (int i = 0; i < aLength; ++i) { ~ ^ ~~~~~~~ intl/lwbrk/nsUniscribeBreaker.cpp(132,23): error: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Werror,-Wsign-compare] for (int i = 0; i < aLength; ++i) { ~ ^ ~~~~~~~ intl/lwbrk/nsUniscribeBreaker.cpp(138,23): error: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Werror,-Wsign-compare] for (int i = 0; i < aLength; ++i) { ~ ^ ~~~~~~~ mozglue/misc/PreXULSkeletonUI.cpp(319,26): error: comparison of integers of different signs: 'std::basic_string<char>::size_type' (aka 'unsigned long long') and 'int' [-Werror,-Wsign-compare] while (line.length() > whitespace && ~~~~~~~~~~~~~ ^ ~~~~~~~~~~ mozglue/misc/PreXULSkeletonUI.cpp(1003,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 1; i < noPlaceholderSpans.length(); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ mozglue/misc/PreXULSkeletonUI.cpp(1708,21): error: comparison of integers of different signs: 'int' and 'unsigned long long' [-Werror,-Wsign-compare] for (int i = 0; i < dataLen / (2 * sizeof(double)); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ security/sandbox/chromium-shim/sandbox/win/permissionsService.cpp(40,16): error: comparison of integers of different signs: 'int' and 'const std::basic_string<wchar_t>::size_type' (aka 'const unsigned long long') [-Werror,-Wsign-compare] if (slashIdx != std::wstring::npos) { ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~ toolkit/components/aboutthirdparty/tests/gtest/TestAboutThirdParty.cpp(107,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < ArrayLength(kDirectoriesUnsorted); ++i) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ toolkit/crashreporter/breakpad-client/windows/crash_generation/crash_generation_server.cc(957,23): error: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < kExceptionAppMemoryRegions; i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ toolkit/crashreporter/client/crashreporter_win.cpp(373,21): error: comparison of integers of different signs: 'int' and 'unsigned long long' [-Werror,-Wsign-compare] for (int i = 0; i < sizeof(kDefaultAttachedBottom) / sizeof(UINT); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ toolkit/crashreporter/client/crashreporter_win.cpp(671,21): error: comparison of integers of different signs: 'int' and 'unsigned long long' [-Werror,-Wsign-compare] for (int i = 0; i < sizeof(controls) / sizeof(controls[0]); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ toolkit/crashreporter/client/crashreporter_win.cpp(1048,21): error: comparison of integers of different signs: 'int' and 'unsigned long long' [-Werror,-Wsign-compare] for (int i = 0; i < sizeof(kDefaultAttachedBottom) / sizeof(UINT); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp(248,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < mozilla::ArrayLength(associations); ++i) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ toolkit/system/windowsproxy/ProxyUtils.cpp(27,36): error: comparison of integers of different signs: 'const int' and 'nsTArray_base::size_type' (aka 'unsigned long long') [-Werror,-Wsign-compare] if (i < addr.Length()) { ~ ^ ~~~~~~~~~~~~~ toolkit/xre/dllservices/mozglue/interceptor/Arm64.h(178,28): error: comparison of integers of different signs: 'int32_t' (aka 'int') and 'unsigned int' [-Werror,-Wsign-compare] if (signbits && signbits != 0xFE000000) { ~~~~~~~~ ^ ~~~~~~~~~~ obj-build/dist/include/gtest/gtest.h(1842,54): note: expanded from macro 'EXPECT_EQ' EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2) ^ obj-build/dist/include/gtest/gtest.h(1354,11): error: comparison of integers of different signs: 'const unsigned int' and 'const int' [-Werror,-Wsign-compare] if (lhs == rhs) { ~~~ ^ ~~~ obj-build/dist/include/gtest/gtest.h(1373,12): note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<unsigned int, int>' requested here return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); ^ toolkit/xre/dllservices/tests/gtest/TestUntrustedModules.cpp(35,5): note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<unsigned int, int, nullptr>' requested here EXPECT_EQ(mCounters.Count(), N); ^ obj-build/dist/include/gtest/gtest.h(1842,54): note: expanded from macro 'EXPECT_EQ' EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2) ^ toolkit/xre/dllservices/tests/gtest/TestUntrustedModules.cpp(210,28): note: in instantiation of function template specialization 'ModuleLoadCounter::Remains<1>' requested here EXPECT_TRUE(waitForOne.Remains({kTestModules[0]}, {0})); ^ toolkit/xre/test/gtest/TestAssembleCommandLineWin.cpp(139,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < ArrayLength(kExpectedArgsW); ++i) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ toolkit/xre/test/gtest/TestAssembleCommandLineWin.cpp(151,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < ArrayLength(kExpectedArgsW); ++i) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ toolkit/xre/test/gtest/TestAssembleCommandLineWin.cpp(164,21): error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long long') [-Werror,-Wsign-compare] for (int i = 0; i < ArrayLength(kExpectedArgsW); ++i) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ obj-build/dist/include/gtest/gtest.h(1354,11): error: comparison of integers of different signs: 'const int' and 'const unsigned long long' [-Werror,-Wsign-compare] if (lhs == rhs) { ~~~ ^ ~~~ obj-build/dist/include/gtest/gtest.h(1373,12): note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned long long>' requested here return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); ^ toolkit/xre/test/gtest/TestAssembleCommandLineWin.cpp(138,3): note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<int, unsigned long long, nullptr>' requested here EXPECT_EQ(len, ArrayLength(kExpectedArgsW)); ^ widget/windows/TSFTextStore.cpp(3455,28): error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'long' [-Werror,-Wsign-compare] range.mEndOffset == end - mComposition->StartOffset() && ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ widget/windows/TSFTextStore.cpp(3454,30): error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'long' [-Werror,-Wsign-compare] if (range.mStartOffset == start - mComposition->StartOffset() && ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xpfe/appshell/AppWindow.cpp(1900,21): error: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Werror,-Wsign-compare] for (int i = 0; i < toolbarSprings->Length(); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~ Differential Revision: https://phabricator.services.mozilla.com/D144695
This commit is contained in:
parent
98d32b03bf
commit
9cd056be1e
@ -230,7 +230,7 @@ static UniquePtr<wchar_t[]> HashString(const wchar_t* inputString) {
|
||||
DWORD h1Acc = 0;
|
||||
|
||||
for (int i = 0; i < blockCount; ++i) {
|
||||
for (int j = 0; j < DWORDS_PER_BLOCK; ++j) {
|
||||
for (size_t j = 0; j < DWORDS_PER_BLOCK; ++j) {
|
||||
const DWORD* C0 = C0s[j];
|
||||
const DWORD* C1 = C1s[j];
|
||||
|
||||
@ -385,7 +385,7 @@ bool CheckBrowserUserChoiceHashes() {
|
||||
|
||||
const wchar_t* exts[] = {L"https", L"http", L".html", L".htm"};
|
||||
|
||||
for (int i = 0; i < ArrayLength(exts); ++i) {
|
||||
for (size_t i = 0; i < ArrayLength(exts); ++i) {
|
||||
switch (CheckUserChoiceHash(exts[i], userSid.get())) {
|
||||
case CheckUserChoiceHashResult::OK_V1:
|
||||
break;
|
||||
|
@ -1272,7 +1272,7 @@ static nsresult PinCurrentAppToTaskbarImpl(bool aCheckOnly,
|
||||
int shortcutCSIDLs[] = {CSIDL_COMMON_PROGRAMS, CSIDL_PROGRAMS,
|
||||
CSIDL_COMMON_DESKTOPDIRECTORY,
|
||||
CSIDL_DESKTOPDIRECTORY};
|
||||
for (int i = 0; i < ArrayLength(shortcutCSIDLs); ++i) {
|
||||
for (size_t i = 0; i < ArrayLength(shortcutCSIDLs); ++i) {
|
||||
// GetMatchingShortcut may fail when the exe path doesn't match, even
|
||||
// if it refers to the same file. This should be rare, and the worst
|
||||
// outcome would be failure to pin, so the risk is acceptable.
|
||||
@ -1539,7 +1539,7 @@ nsWindowsShellService::ClassifyShortcut(const nsAString& aPath,
|
||||
{FOLDERID_UserPinned, u"\\TaskBar\\", u"Taskbar"},
|
||||
{FOLDERID_UserPinned, u"\\StartMenu\\", u"StartMenu"}};
|
||||
|
||||
for (int i = 0; i < ArrayLength(folders); ++i) {
|
||||
for (size_t i = 0; i < ArrayLength(folders); ++i) {
|
||||
nsAutoString knownPath;
|
||||
|
||||
// These flags are chosen to avoid I/O, see bug 1363398.
|
||||
|
@ -55,7 +55,7 @@ add_warning("-Wpointer-arith")
|
||||
check_and_add_warning("-Wshadow-field-in-constructor-modified")
|
||||
|
||||
# catches comparing signed/unsigned ints
|
||||
add_warning("-Wsign-compare", when=not_clang_cl)
|
||||
add_warning("-Wsign-compare")
|
||||
|
||||
# catches overflow bugs, few false positives
|
||||
add_warning("-Wtype-limits")
|
||||
|
@ -83,7 +83,7 @@ MFTDecoder::Create(const GUID& aCategory, const GUID& aInSubtype,
|
||||
}
|
||||
auto guard = MakeScopeExit([&] {
|
||||
// Start from index 1, acts[0] will be stored as a RefPtr to release later.
|
||||
for (int i = 1; i < actsNum; i++) {
|
||||
for (UINT32 i = 1; i < actsNum; i++) {
|
||||
acts[i]->Release();
|
||||
}
|
||||
CoTaskMemFree(acts);
|
||||
|
@ -1273,7 +1273,7 @@ bool Factory::ReadbackTexture(uint8_t* aDestData, int32_t aDestStride,
|
||||
uint32_t width = srcDesc.Width;
|
||||
uint32_t height = srcDesc.Height;
|
||||
int bpp = BytesPerPixel(gfx::ToPixelFormat(srcDesc.Format));
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (uint32_t y = 0; y < height; y++) {
|
||||
memcpy(aDestData + aDestStride * y,
|
||||
(unsigned char*)(srcMap.pData) + srcMap.RowPitch * y, width * bpp);
|
||||
}
|
||||
|
@ -1092,8 +1092,8 @@ bool CompositorD3D11::VerifyBufferSize() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (((swapDesc.BufferDesc.Width == mSize.width &&
|
||||
swapDesc.BufferDesc.Height == mSize.height) ||
|
||||
if (((static_cast<int32_t>(swapDesc.BufferDesc.Width) == mSize.width &&
|
||||
static_cast<int32_t>(swapDesc.BufferDesc.Height) == mSize.height) ||
|
||||
mSize.width <= 0 || mSize.height <= 0) &&
|
||||
!mVerifyBuffersFailed) {
|
||||
return true;
|
||||
|
@ -1274,8 +1274,8 @@ bool DataTextureSourceD3D11::Update(DataSourceSurface* aSurface,
|
||||
mTexture->GetDesc(¤tDesc);
|
||||
|
||||
// Make sure there's no size mismatch, if there is, recreate.
|
||||
if (currentDesc.Width != mSize.width ||
|
||||
currentDesc.Height != mSize.height ||
|
||||
if (static_cast<int32_t>(currentDesc.Width) != mSize.width ||
|
||||
static_cast<int32_t>(currentDesc.Height) != mSize.height ||
|
||||
currentDesc.Format != dxgiFormat) {
|
||||
mTexture = nullptr;
|
||||
// Make sure we upload the whole surface.
|
||||
|
@ -245,7 +245,7 @@ mozilla::ipc::IPCResult ContentCompositorBridgeParent::RecvCheckContentOnlyTDR(
|
||||
gfx::D3D11DeviceStatus status;
|
||||
dm->ExportDeviceInfo(&status);
|
||||
|
||||
if (sequenceNum == status.sequenceNumber() && !dm->HasDeviceReset()) {
|
||||
if (sequenceNum == static_cast<uint32_t>(status.sequenceNumber()) && !dm->HasDeviceReset()) {
|
||||
*isContentOnlyTDR = true;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ bool D3D11Checks::DoesRenderTargetViewNeedRecreating(ID3D11Device* aDevice) {
|
||||
gfxCriticalNote << "DoesRecreatingMapFailed " << hexa(hr);
|
||||
return false;
|
||||
}
|
||||
int resultColor = *(int*)mapped.pData;
|
||||
uint32_t resultColor = *(uint32_t*)mapped.pData;
|
||||
deviceContext->Unmap(cpuTexture, 0);
|
||||
cpuTexture = nullptr;
|
||||
|
||||
@ -151,7 +151,7 @@ bool D3D11Checks::DoesDeviceWork() {
|
||||
if (GetModuleHandleW(L"igd10umd32.dll")) {
|
||||
const wchar_t* checkModules[] = {L"dlumd32.dll", L"dlumd11.dll",
|
||||
L"dlumd10.dll"};
|
||||
for (int i = 0; i < PR_ARRAY_SIZE(checkModules); i += 1) {
|
||||
for (size_t i = 0; i < PR_ARRAY_SIZE(checkModules); i += 1) {
|
||||
if (GetModuleHandleW(checkModules[i])) {
|
||||
nsString displayLinkModuleVersionString;
|
||||
gfxWindowsPlatform::GetDLLVersion(checkModules[i],
|
||||
@ -406,7 +406,7 @@ void D3D11Checks::WarnOnAdapterMismatch(ID3D11Device* device) {
|
||||
gfxInfo->GetAdapterVendorID(vendorID);
|
||||
nsresult ec;
|
||||
int32_t vendor = vendorID.ToInteger(&ec, 16);
|
||||
if (vendor != desc.VendorId) {
|
||||
if (vendor != static_cast<int32_t>(desc.VendorId)) {
|
||||
gfxCriticalNote << "VendorIDMismatch V " << hexa(vendor) << " "
|
||||
<< hexa(desc.VendorId);
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ void gfxDWriteFontList::AppendFamiliesFromCollection(
|
||||
sysLocIndex = 1;
|
||||
}
|
||||
for (unsigned index = 0; index < names.Length(); ++index) {
|
||||
addFamily(names[index], index != sysLocIndex);
|
||||
addFamily(names[index], index != static_cast<unsigned>(sysLocIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ void NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength,
|
||||
}
|
||||
|
||||
bool mismatch = false;
|
||||
for (int i = 0; i < aLength; ++i) {
|
||||
for (uint32_t i = 0; i < aLength; ++i) {
|
||||
if (aBreakBefore[i] != brokeredBreaks[i]) {
|
||||
mismatch = true;
|
||||
break;
|
||||
@ -129,13 +129,13 @@ void NS_GetComplexLineBreaks(const char16_t* aText, uint32_t aLength,
|
||||
// The logging here doesn't handle surrogates, but we only have tests using
|
||||
// Thai currently, which is BMP-only.
|
||||
printf_stderr("uniscribe: ");
|
||||
for (int i = 0; i < aLength; ++i) {
|
||||
for (uint32_t i = 0; i < aLength; ++i) {
|
||||
if (aBreakBefore[i]) printf_stderr("#");
|
||||
printf_stderr("%s", NS_ConvertUTF16toUTF8(aText + i, 1).get());
|
||||
}
|
||||
printf_stderr("\n");
|
||||
printf_stderr("brokered : ");
|
||||
for (int i = 0; i < aLength; ++i) {
|
||||
for (uint32_t i = 0; i < aLength; ++i) {
|
||||
if (brokeredBreaks[i]) printf_stderr("#");
|
||||
printf_stderr("%s", NS_ConvertUTF16toUTF8(aText + i, 1).get());
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ static bool ProfileDbHasStartWithLastProfile(IFStream& iniContents) {
|
||||
bool inGeneral = false;
|
||||
std::string line;
|
||||
while (std::getline(iniContents, line)) {
|
||||
int whitespace = 0;
|
||||
size_t whitespace = 0;
|
||||
while (line.length() > whitespace &&
|
||||
(line[whitespace] == ' ' || line[whitespace] == '\t')) {
|
||||
whitespace++;
|
||||
@ -1000,7 +1000,7 @@ Result<Ok, PreXULSkeletonUIError> DrawSkeletonUI(
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < noPlaceholderSpans.length(); i++) {
|
||||
for (size_t i = 1; i < noPlaceholderSpans.length(); i++) {
|
||||
int start = noPlaceholderSpans[i - 1].end + placeholderMargin;
|
||||
int end = noPlaceholderSpans[i].start - placeholderMargin;
|
||||
if (start + 2 * placeholderBorderRadius >= end) {
|
||||
@ -1705,7 +1705,7 @@ static Result<Vector<CSSPixelSpan>, PreXULSkeletonUIError> ReadRegCSSPixelSpans(
|
||||
|
||||
Vector<CSSPixelSpan> resultVector;
|
||||
double* asDoubles = reinterpret_cast<double*>(buffer.get());
|
||||
for (int i = 0; i < dataLen / (2 * sizeof(double)); i++) {
|
||||
for (size_t i = 0; i < dataLen / (2 * sizeof(double)); i++) {
|
||||
CSSPixelSpan span = {};
|
||||
span.start = *(asDoubles++);
|
||||
span.end = *(asDoubles++);
|
||||
|
@ -36,7 +36,7 @@ IsFlashTempFile(std::wstring aFilename, std::wstring* aFolder=nullptr)
|
||||
{
|
||||
// Assume its a flash file if the base name begins with "FlashTmp",
|
||||
// ends with ".tmp" and has an int in-between them.
|
||||
int slashIdx = aFilename.find_last_of(L'\\');
|
||||
size_t slashIdx = aFilename.find_last_of(L'\\');
|
||||
if (slashIdx != std::wstring::npos) {
|
||||
if (aFolder) {
|
||||
*aFolder = aFilename.substr(0, slashIdx + 1);
|
||||
|
@ -576,7 +576,7 @@ int xFullPathname(sqlite3_vfs* vfs, const char* zName, int nOut, char* zOut) {
|
||||
(zName[0] == '\\' && zName[1] == '\\' && zName[2] == '?' &&
|
||||
zName[3] == '\\'))) {
|
||||
MOZ_ASSERT(nOut >= vfs->mxPathname);
|
||||
MOZ_ASSERT(nOut > strlen(zName));
|
||||
MOZ_ASSERT(static_cast<size_t>(nOut) > strlen(zName));
|
||||
|
||||
size_t index = 0;
|
||||
while (zName[index] != '\0') {
|
||||
|
@ -104,7 +104,7 @@ TEST(AboutThirdParty, InstallLocations)
|
||||
};
|
||||
|
||||
nsTArray<InstallLocationT> locations(ArrayLength(kDirectoriesUnsorted));
|
||||
for (int i = 0; i < ArrayLength(kDirectoriesUnsorted); ++i) {
|
||||
for (size_t i = 0; i < ArrayLength(kDirectoriesUnsorted); ++i) {
|
||||
locations.EmplaceBack(kDirectoriesUnsorted[i], new InstalledApplication());
|
||||
}
|
||||
|
||||
|
@ -954,7 +954,7 @@ bool CrashGenerationServer::GenerateDump(const ClientInfo& client,
|
||||
}
|
||||
|
||||
// Allocate AppMemory instances for exception context.
|
||||
for (int i = 0; i < kExceptionAppMemoryRegions; i++) {
|
||||
for (size_t i = 0; i < kExceptionAppMemoryRegions; i++) {
|
||||
AppMemory app_memory;
|
||||
app_memory.ptr = reinterpret_cast<ULONG64>(nullptr);
|
||||
app_memory.length = 0;
|
||||
|
11
toolkit/crashreporter/breakpad-patches/30-sign-compare.patch
Normal file
11
toolkit/crashreporter/breakpad-patches/30-sign-compare.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/src/client/windows/crash_generation/crash_generation_server.cc
|
||||
+++ b/src/client/windows/crash_generation/crash_generation_server.cc
|
||||
@@ -954,7 +954,7 @@ bool CrashGenerationServer::GenerateDump(const ClientInfo& client,
|
||||
}
|
||||
|
||||
// Allocate AppMemory instances for exception context.
|
||||
- for (int i = 0; i < kExceptionAppMemoryRegions; i++) {
|
||||
+ for (size_t i = 0; i < kExceptionAppMemoryRegions; i++) {
|
||||
AppMemory app_memory;
|
||||
app_memory.ptr = reinterpret_cast<ULONG64>(nullptr);
|
||||
app_memory.length = 0;
|
@ -370,7 +370,7 @@ static void MaybeResizeProgressText(HWND hwndDlg) {
|
||||
|
||||
StretchDialog(hwndDlg, diff);
|
||||
|
||||
for (int i = 0; i < sizeof(kDefaultAttachedBottom) / sizeof(UINT); i++) {
|
||||
for (size_t i = 0; i < sizeof(kDefaultAttachedBottom) / sizeof(UINT); i++) {
|
||||
gAttachedBottom.insert(kDefaultAttachedBottom[i]);
|
||||
}
|
||||
}
|
||||
@ -668,7 +668,7 @@ static void StretchControlsToFit(HWND hwndDlg) {
|
||||
RECT dlgRect;
|
||||
GetClientRect(hwndDlg, &dlgRect);
|
||||
|
||||
for (int i = 0; i < sizeof(controls) / sizeof(controls[0]); i++) {
|
||||
for (size_t i = 0; i < sizeof(controls) / sizeof(controls[0]); i++) {
|
||||
RECT r;
|
||||
HWND hwndControl = GetDlgItem(hwndDlg, controls[i]);
|
||||
GetRelativeRect(hwndControl, hwndDlg, &r);
|
||||
@ -1045,7 +1045,7 @@ string WideToUTF8(const wstring& wide, bool* success) {
|
||||
/* === Crashreporter UI Functions === */
|
||||
|
||||
bool UIInit() {
|
||||
for (int i = 0; i < sizeof(kDefaultAttachedBottom) / sizeof(UINT); i++) {
|
||||
for (size_t i = 0; i < sizeof(kDefaultAttachedBottom) / sizeof(UINT); i++) {
|
||||
gAttachedBottom.insert(kDefaultAttachedBottom[i]);
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ HRESULT SetDefaultBrowserUserChoice(
|
||||
{L"http", urlProgID.get()},
|
||||
{L".html", htmlProgID.get()},
|
||||
{L".htm", htmlProgID.get()}};
|
||||
for (int i = 0; i < mozilla::ArrayLength(associations); ++i) {
|
||||
for (size_t i = 0; i < mozilla::ArrayLength(associations); ++i) {
|
||||
if (!SetUserChoice(associations[i].ext, sid.get(),
|
||||
associations[i].progID)) {
|
||||
ok = false;
|
||||
|
@ -23,7 +23,7 @@ static void NormalizeAddr(const nsACString& aAddr, nsCString& aNormalized) {
|
||||
nsTArray<nsCString> addr;
|
||||
ParseString(aAddr, '.', addr);
|
||||
aNormalized = StringJoin("."_ns, IntegerRange(4),
|
||||
[&addr](nsACString& dst, const int i) {
|
||||
[&addr](nsACString& dst, size_t i) {
|
||||
if (i < addr.Length()) {
|
||||
dst.Append(addr[i]);
|
||||
} else {
|
||||
|
@ -171,7 +171,7 @@ inline static Maybe<uint32_t> BuildUnconditionalBranchImm(
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
int32_t signbits = offset.value() & 0xFE000000;
|
||||
uint32_t signbits = static_cast<uint32_t>(offset.value()) & 0xFE000000;
|
||||
// Ensure that offset is small enough to fit into the 26 bit region.
|
||||
// We check that the sign bits are either all ones or all zeros.
|
||||
MOZ_ASSERT(signbits == 0xFE000000 || !signbits);
|
||||
@ -179,7 +179,7 @@ inline static Maybe<uint32_t> BuildUnconditionalBranchImm(
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
int32_t masked = offset.value() & 0x03FFFFFF;
|
||||
uint32_t masked = static_cast<uint32_t>(offset.value()) & 0x03FFFFFF;
|
||||
|
||||
// B imm26
|
||||
return Some(0x14000000U | masked);
|
||||
|
@ -22,15 +22,15 @@ class ModuleLoadCounter final {
|
||||
nsTHashMap<nsStringCaseInsensitiveHashKey, int> mCounters;
|
||||
|
||||
public:
|
||||
template <int N>
|
||||
template <size_t N>
|
||||
ModuleLoadCounter(const nsString (&aNames)[N], const int (&aCounts)[N])
|
||||
: mCounters(N) {
|
||||
for (int i = 0; i < N; ++i) {
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
mCounters.InsertOrUpdate(aNames[i], aCounts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template <int N>
|
||||
template <size_t N>
|
||||
bool Remains(const nsString (&aNames)[N], const int (&aCounts)[N]) {
|
||||
EXPECT_EQ(mCounters.Count(), N);
|
||||
if (mCounters.Count() != N) {
|
||||
@ -38,7 +38,7 @@ class ModuleLoadCounter final {
|
||||
}
|
||||
|
||||
bool result = true;
|
||||
for (int i = 0; i < N; ++i) {
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
auto entry = mCounters.Lookup(aNames[i]);
|
||||
if (!entry) {
|
||||
wprintf(L"%s is not registered.\n", aNames[i].get());
|
||||
|
@ -135,8 +135,8 @@ TEST(WinRemoteMessage, SendReceive)
|
||||
|
||||
receiver.Parse(v0.CopyData());
|
||||
EXPECT_TRUE(NS_SUCCEEDED(receiver.CommandLineRunner()->GetLength(&len)));
|
||||
EXPECT_EQ(len, ArrayLength(kExpectedArgsW));
|
||||
for (int i = 0; i < ArrayLength(kExpectedArgsW); ++i) {
|
||||
EXPECT_EQ(static_cast<size_t>(len), ArrayLength(kExpectedArgsW));
|
||||
for (size_t i = 0; i < ArrayLength(kExpectedArgsW); ++i) {
|
||||
EXPECT_TRUE(
|
||||
NS_SUCCEEDED(receiver.CommandLineRunner()->GetArgument(i, arg)));
|
||||
EXPECT_STREQ(arg.get(), kExpectedArgsW[i]);
|
||||
@ -147,8 +147,8 @@ TEST(WinRemoteMessage, SendReceive)
|
||||
|
||||
receiver.Parse(v1.CopyData());
|
||||
EXPECT_TRUE(NS_SUCCEEDED(receiver.CommandLineRunner()->GetLength(&len)));
|
||||
EXPECT_EQ(len, ArrayLength(kExpectedArgsW));
|
||||
for (int i = 0; i < ArrayLength(kExpectedArgsW); ++i) {
|
||||
EXPECT_EQ(static_cast<size_t>(len), ArrayLength(kExpectedArgsW));
|
||||
for (size_t i = 0; i < ArrayLength(kExpectedArgsW); ++i) {
|
||||
EXPECT_TRUE(
|
||||
NS_SUCCEEDED(receiver.CommandLineRunner()->GetArgument(i, arg)));
|
||||
EXPECT_STREQ(arg.get(), kExpectedArgsW[i]);
|
||||
@ -160,8 +160,8 @@ TEST(WinRemoteMessage, SendReceive)
|
||||
|
||||
receiver.Parse(v2.CopyData());
|
||||
EXPECT_TRUE(NS_SUCCEEDED(receiver.CommandLineRunner()->GetLength(&len)));
|
||||
EXPECT_EQ(len, ArrayLength(kExpectedArgsW));
|
||||
for (int i = 0; i < ArrayLength(kExpectedArgsW); ++i) {
|
||||
EXPECT_EQ(static_cast<size_t>(len), ArrayLength(kExpectedArgsW));
|
||||
for (size_t i = 0; i < ArrayLength(kExpectedArgsW); ++i) {
|
||||
EXPECT_TRUE(
|
||||
NS_SUCCEEDED(receiver.CommandLineRunner()->GetArgument(i, arg)));
|
||||
EXPECT_STREQ(arg.get(), kExpectedArgsW[i]);
|
||||
|
@ -3451,8 +3451,10 @@ TSFTextStore::RecordCompositionUpdateAction() {
|
||||
TextRange& range = action->mRanges->ElementAt(0);
|
||||
LONG start = selectionForTSF->MinOffset();
|
||||
LONG end = selectionForTSF->MaxOffset();
|
||||
if (range.mStartOffset == start - mComposition->StartOffset() &&
|
||||
range.mEndOffset == end - mComposition->StartOffset() &&
|
||||
if (static_cast<LONG>(range.mStartOffset) ==
|
||||
start - mComposition->StartOffset() &&
|
||||
static_cast<LONG>(range.mEndOffset) ==
|
||||
end - mComposition->StartOffset() &&
|
||||
range.mRangeStyle.IsNoChangeStyle()) {
|
||||
range.mRangeStyle.Clear();
|
||||
// The looks of selected type is better than others.
|
||||
|
@ -1897,7 +1897,7 @@ nsresult AppWindow::MaybeSaveEarlyWindowPersistentValues(
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mozilla::Vector<CSSPixelSpan> springs;
|
||||
for (int i = 0; i < toolbarSprings->Length(); i++) {
|
||||
for (size_t i = 0; i < toolbarSprings->Length(); i++) {
|
||||
RefPtr<Element> springEl = toolbarSprings->Item(i);
|
||||
RefPtr<dom::DOMRect> springRect;
|
||||
rv = utils->GetBoundsWithoutFlushing(springEl, getter_AddRefs(springRect));
|
||||
|
Loading…
Reference in New Issue
Block a user