]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: replace 'unsigned long' by 'uintptr_t'
authorAdrien Schildknecht <adriens@google.com>
Wed, 10 Aug 2016 21:07:00 +0000 (17:07 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 10 Aug 2016 21:07:00 +0000 (17:07 -0400)
This is needed for win64:
    sizeof(unsigned long) != sizeof(void*)

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/bitops.c
lib/ext2fs/blkmap64_ba.c
lib/ext2fs/crc32c.c
lib/ext2fs/ext2_types.h.in
lib/ext2fs/inline.c
lib/ext2fs/rbtree.h
lib/ext2fs/unix_io.c
util/android_types.h

index 8e4c05c47a50ba3d7c03a336d141c021769ab7f8..833d1e97665e34d0b8f55c4e111fba7a325237dd 100644 (file)
@@ -138,7 +138,7 @@ unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes)
        const __u32 *p;
        unsigned int res = 0;
 
-       while (((((unsigned long) cp) & 3) != 0) && (nbytes > 0)) {
+       while (((((uintptr_t) cp) & 3) != 0) && (nbytes > 0)) {
                res += popcount8(*cp++);
                nbytes--;
        }
index 4671c50d00a8fa8bfaf5818c585b1d2793d5011c..3707a61eb2924d35ffbd0889db966619b7e532d5 100644 (file)
@@ -349,7 +349,7 @@ static errcode_t ba_find_first_zero(ext2fs_generic_bitmap bitmap,
 
        pos = ((unsigned char *)bp->bitarray) + (bitpos >> 3);
        /* scan bytes until 8-byte (64-bit) aligned */
-       while (count >= 8 && (((unsigned long)pos) & 0x07)) {
+       while (count >= 8 && (((uintptr_t)pos) & 0x07)) {
                if (*pos != 0xff) {
                        byte_found = 1;
                        break;
@@ -423,7 +423,7 @@ static errcode_t ba_find_first_set(ext2fs_generic_bitmap bitmap,
 
        pos = ((unsigned char *)bp->bitarray) + (bitpos >> 3);
        /* scan bytes until 8-byte (64-bit) aligned */
-       while (count >= 8 && (((unsigned long)pos) & 0x07)) {
+       while (count >= 8 && (((uintptr_t)pos) & 0x07)) {
                if (*pos != 0) {
                        byte_found = 1;
                        break;
index 624ad77623bc913a82ed9d89fec9c6abf98b78b5..8ad0050f6d0044d60733069f210751cfc92d5ec1 100644 (file)
@@ -97,10 +97,10 @@ crc32_body(uint32_t crc, unsigned char const *buf, size_t len,
        uint32_t q;
 
        /* Align it */
-       if (unlikely((long)buf & 3 && len)) {
+       if (unlikely((uintptr_t)buf & 3 && len)) {
                do {
                        DO_CRC(*buf++);
-               } while ((--len) && ((long)buf)&3);
+               } while ((--len) && ((uintptr_t)buf)&3);
        }
 
 # if CRC_LE_BITS == 32
index fd572314af38f01329b0883aea8eeba5fb37be06..07adc64a188c4e097011b1fdda4cef39132df716 100644 (file)
@@ -166,6 +166,8 @@ typedef long                __s64;
 
 #endif /* _*_TYPES_H */
 
+#include <stdint.h>
+
 /* endian checking stuff */
 #ifndef EXT2_ENDIAN_H_
 #define EXT2_ENDIAN_H_
index 8f403942c66bf58e749ab0b5264a4b6a7d67761e..ae2ae6e4008260aed99e214c872414c045469fd3 100644 (file)
@@ -70,7 +70,7 @@ errcode_t ext2fs_get_memalign(unsigned long size,
        else
 #endif
                *p = malloc(size);
-       if ((unsigned long) *p & (align - 1)) {
+       if ((uintptr_t) *p & (align - 1)) {
                free(*p);
                *p = 0;
        }
index 6aaa941f2eff6890574348191a84ae2c7d9e8ca2..b767a90b09f2d4294416aaf34d415d06e56bd41a 100644 (file)
@@ -95,6 +95,7 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
 #define        _LINUX_RBTREE_H
 
 #include <stdlib.h>
+#include <stdint.h>
 
 #undef offsetof
 #ifdef __compiler_offsetof
@@ -109,7 +110,7 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
 
 struct rb_node
 {
-       unsigned long  rb_parent_color;
+       uintptr_t  rb_parent_color;
 #define        RB_RED          0
 #define        RB_BLACK        1
        struct rb_node *rb_right;
@@ -132,7 +133,7 @@ struct rb_root
 
 static inline void ext2fs_rb_set_parent(struct rb_node *rb, struct rb_node *p)
 {
-       rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
+       rb->rb_parent_color = (rb->rb_parent_color & 3) | (uintptr_t)p;
 }
 static inline void ext2fs_rb_set_color(struct rb_node *rb, int color)
 {
@@ -182,7 +183,7 @@ static inline void ext2fs_rb_link_node(struct rb_node * node,
                                     struct rb_node * parent,
                                     struct rb_node ** rb_link)
 {
-       node->rb_parent_color = (unsigned long )parent;
+       node->rb_parent_color = (uintptr_t)parent;
        node->rb_left = node->rb_right = NULL;
 
        *rb_link = node;
index 6c6e6d5dc7a3985347ce1f82f7292077429a0677..0c9e6bf2d831df99f753ceaedbce61b23781b9ce 100644 (file)
@@ -103,8 +103,8 @@ struct unix_private_data {
        struct struct_io_stats io_stats;
 };
 
-#define IS_ALIGNED(n, align) ((((unsigned long) n) & \
-                              ((unsigned long) ((align)-1))) == 0)
+#define IS_ALIGNED(n, align) ((((uintptr_t) n) & \
+                              ((uintptr_t) ((align)-1))) == 0)
 
 static errcode_t unix_get_stats(io_channel channel, io_stats *stats)
 {
index 2b3e78f66c427bd16bfec490a959e50a1ceee595..9c3f7149eb7e245db0858a6f7397c8e07ecdf531 100644 (file)
@@ -17,6 +17,8 @@ typedef unsigned long long __u64;
 typedef __signed__ long long __s64;
 #endif
 
+#include <stdint.h> //uintptr_t
+
 /* endian checking stuff */
 #ifndef EXT2_ENDIAN_H_
 #define EXT2_ENDIAN_H_