Kaynağa Gözat

libdpkg: Use uintptr_t instead of char * in STRUCTFIELD cast

This fixes warnings with clang due to a change of alignment
requirements.
Guillem Jover 13 yıl önce
ebeveyn
işleme
3b9e6070df
2 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  1. 1 0
      debian/changelog
  2. 3 1
      lib/dpkg/parsedump.h

+ 1 - 0
debian/changelog

@@ -15,6 +15,7 @@ dpkg (1.17.0) UNRELEASED; urgency=low
   * Fix update-alternatives to use the current alternative link as the first
   * Fix update-alternatives to use the current alternative link as the first
     best value, to avoid flip-flops of alternatives with equal priority.
     best value, to avoid flip-flops of alternatives with equal priority.
     Closes: #699807
     Closes: #699807
+  * Fix clang warnings due to change of alignment requirements.
 
 
  -- Guillem Jover <guillem@debian.org>  Fri, 03 Aug 2012 13:21:00 +0200
  -- Guillem Jover <guillem@debian.org>  Fri, 03 Aug 2012 13:21:00 +0200
 
 

+ 3 - 1
lib/dpkg/parsedump.h

@@ -23,6 +23,8 @@
 #ifndef LIBDPKG_PARSEDUMP_H
 #ifndef LIBDPKG_PARSEDUMP_H
 #define LIBDPKG_PARSEDUMP_H
 #define LIBDPKG_PARSEDUMP_H
 
 
+#include <stdint.h>
+
 /**
 /**
  * @defgroup parsedump In-core package database parsing and reading
  * @defgroup parsedump In-core package database parsing and reading
  * @ingroup dpkg-public
  * @ingroup dpkg-public
@@ -76,7 +78,7 @@ typedef void parse_field_func(struct parsedb_state *ps, struct field_state *fs,
 bool parse_stanza(struct parsedb_state *ps, struct field_state *fs,
 bool parse_stanza(struct parsedb_state *ps, struct field_state *fs,
                   parse_field_func *parse_field, void *parse_obj);
                   parse_field_func *parse_field, void *parse_obj);
 
 
-#define STRUCTFIELD(klass, off, type) (*(type *)((char *)(klass) + (off)))
+#define STRUCTFIELD(klass, off, type) (*(type *)((uintptr_t)(klass) + (off)))
 
 
 #define PKGIFPOFF(f) (offsetof(struct pkgbin, f))
 #define PKGIFPOFF(f) (offsetof(struct pkgbin, f))
 #define FILEFOFF(f) (offsetof(struct filedetails, f))
 #define FILEFOFF(f) (offsetof(struct filedetails, f))