forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0026-Fixes-for-sign-compare-warnings-due-to-signedness-of.patch
68 lines (60 loc) · 3.15 KB
/
0026-Fixes-for-sign-compare-warnings-due-to-signedness-of.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 9e32014535bd3dfb8f536dd80e6d86a17406308c Mon Sep 17 00:00:00 2001
From: Jon TURNEY <[email protected]>
Date: Mon, 12 Jan 2015 21:45:14 +0000
Subject: [PATCH 26/27] Fixes for sign-compare warnings due to signedness of
size_t
Reported by AmR|EiSa
src/common/pecoff/pecoffutils.cc:315:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
for (int idx = 0; idx < kMDGUIDSize; ++idx) {
^
src/common/pecoff/pecoffutils.cc:358:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
for (int i = 0; i < debug_directory_size/sizeof(PeDebugDirectory); i++) {
^
src/common/pecoff/pecoffutils.cc:457:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if (data_directory_size < entry)
---
src/common/pecoff/pecoffutils.cc | 6 +++---
src/common/pecoff/pecoffutils.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/common/pecoff/pecoffutils.cc b/src/common/pecoff/pecoffutils.cc
index 158270d..a9ff0a2 100644
--- a/src/common/pecoff/pecoffutils.cc
+++ b/src/common/pecoff/pecoffutils.cc
@@ -312,7 +312,7 @@ PeCoffObjectFileReader<PeCoffClassTraits>::FileIdentifierFromMappedFile(
// dashes removed.
char identifier_str[40];
int buffer_idx = 0;
- for (int idx = 0; idx < kMDGUIDSize; ++idx) {
+ for (unsigned int idx = 0; idx < kMDGUIDSize; ++idx) {
int hi = (identifier_swapped[idx] >> 4) & 0x0F;
int lo = (identifier_swapped[idx]) & 0x0F;
@@ -355,7 +355,7 @@ bool PeCoffObjectFileReader<PeCoffClassTraits>::GetBuildID(
}
// search the debug directory for a codeview entry
- for (int i = 0; i < debug_directory_size/sizeof(PeDebugDirectory); i++) {
+ for (unsigned int i = 0; i < debug_directory_size/sizeof(PeDebugDirectory); i++) {
if (debug_directory[i].mType == IMAGE_DEBUG_TYPE_CODEVIEW) {
// interpret the codeview record to get build-id
const CvInfoPbd70* codeview_record = reinterpret_cast<const CvInfoPbd70*>
@@ -446,7 +446,7 @@ const char* PeCoffObjectFileReader<PeCoffClassTraits>::GetStringTable(
template<class PeCoffClassTraits>
const PeDataDirectory*
PeCoffObjectFileReader<PeCoffClassTraits>::GetDataDirectoryEntry(
- ObjectFileBase obj_base, int entry) {
+ ObjectFileBase obj_base, unsigned int entry) {
const PeOptionalHeader* peOptionalHeader = GetOptionalHeader(obj_base);
// the data directory immediately follows the optional header
diff --git a/src/common/pecoff/pecoffutils.h b/src/common/pecoff/pecoffutils.h
index 5553d9f..3e2d7b3 100644
--- a/src/common/pecoff/pecoffutils.h
+++ b/src/common/pecoff/pecoffutils.h
@@ -155,7 +155,7 @@ class PeCoffObjectFileReader {
static const PeSectionHeader* GetSectionTable(ObjectFileBase obj_base);
static const char* GetStringTable(ObjectFileBase obj_base);
static const PeDataDirectory* GetDataDirectoryEntry(ObjectFileBase obj_base,
- int entry);
+ unsigned int entry);
static const uint8_t* ConvertRVAToPointer(ObjectFileBase obj_base, Offset rva);
};
--
2.1.1