rpm/backport-Use-unsigned-integers-more-consistently-in-the-handl.patch

64 lines
1.9 KiB
Diff

From 8e6108a5964c7289f3db70f3d188293276416528 Mon Sep 17 00:00:00 2001
From: Daniel Alley <dalley@redhat.com>
Date: Thu, 8 Dec 2022 09:40:00 -0500
Subject: [PATCH] Use unsigned integers more consistently in the handling of
tag data
Not a functional change, it just makes the code more clear and
self-consistent.
---
lib/header.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/header.c b/lib/header.c
index 004102dd2..72fb3d4fe 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -568,7 +568,7 @@ static int regionSwab(indexEntry entry, int il, int dl,
}
} break;
case RPM_INT32_TYPE:
- { int32_t * it = ie.data;
+ { uint32_t * it = ie.data;
for (; ie.info.count > 0; ie.info.count--, it += 1) {
if (dataEnd && ((unsigned char *)it) >= dataEnd)
return -1;
@@ -576,7 +576,7 @@ static int regionSwab(indexEntry entry, int il, int dl,
}
} break;
case RPM_INT16_TYPE:
- { int16_t * it = ie.data;
+ { uint16_t * it = ie.data;
for (; ie.info.count > 0; ie.info.count--, it += 1) {
if (dataEnd && ((unsigned char *)it) >= dataEnd)
return -1;
@@ -772,9 +772,9 @@ static void * doExport(const struct indexEntry_s *hindex, int indexUsed,
count = entry->info.count;
src = entry->data;
while (count--) {
- *((int32_t *)te) = htonl(*((int32_t *)src));
- te += sizeof(int32_t);
- src += sizeof(int32_t);
+ *((uint32_t *)te) = htonl(*((uint32_t *)src));
+ te += sizeof(uint32_t);
+ src += sizeof(uint32_t);
}
break;
@@ -782,9 +782,9 @@ static void * doExport(const struct indexEntry_s *hindex, int indexUsed,
count = entry->info.count;
src = entry->data;
while (count--) {
- *((int16_t *)te) = htons(*((int16_t *)src));
- te += sizeof(int16_t);
- src += sizeof(int16_t);
+ *((uint16_t *)te) = htons(*((uint16_t *)src));
+ te += sizeof(uint16_t);
+ src += sizeof(uint16_t);
}
break;
--
2.33.0