get rid off pointer-arith warnings

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=388
This commit is contained in:
Michael Schröder 2017-03-22 12:16:00 +00:00 committed by Git OBS Bridge
parent 0e3494a2aa
commit 8a9e054bba

View File

@ -1,5 +1,5 @@
--- ./build/files.c.orig 2017-02-16 09:52:49.292092380 +0000
+++ ./build/files.c 2017-03-22 12:11:05.013909767 +0000
+++ ./build/files.c 2017-03-22 12:15:29.060287267 +0000
@@ -21,6 +21,10 @@
#include <rpm/rpmlog.h>
#include <rpm/rpmbase64.h>
@ -77,24 +77,24 @@
+ data = elf_rawdata (s, NULL);
+ src.d_buf = data->d_buf;
+ assert (sizeof (Elf32_Nhdr) == sizeof (Elf64_Nhdr));
+ while (data->d_buf + data->d_size - src.d_buf > (int) sizeof nh
+ while ((unsigned char *)data->d_buf + data->d_size - (unsigned char *)src.d_buf > (int) sizeof nh
+ && elf32_xlatetom (&dst, &src, ehdr.e_ident[EI_DATA]))
+ {
+ Elf32_Word len = sizeof nh + nh.n_namesz;
+ len = (len + 3) & ~3;
+
+ if (nh.n_namesz == sizeof "GNU" && nh.n_type == 3
+ && !memcmp (src.d_buf + sizeof nh, "GNU", sizeof "GNU"))
+ && !memcmp ((unsigned char *)src.d_buf + sizeof nh, "GNU", sizeof "GNU"))
+ {
+ build_id = data;
+ build_id_offset = src.d_buf + len - data->d_buf;
+ build_id_offset = (unsigned char *)src.d_buf + len - (unsigned char *)data->d_buf;
+ build_id_size = nh.n_descsz;
+ break;
+ }
+
+ len += nh.n_descsz;
+ len = (len + 3) & ~3;
+ src.d_buf += len;
+ src.d_buf = (unsigned char *)src.d_buf + len;
+ }
+
+ if (build_id != NULL)
@ -106,7 +106,7 @@
+
+ *id = malloc (build_id_size);
+ *id_size = build_id_size;
+ memcpy (*id, build_id->d_buf + build_id_offset, build_id_size);
+ memcpy (*id, (unsigned char *)build_id->d_buf + build_id_offset, build_id_size);
+
+ elf_end (elf);
+ close (fd);