On Mon, 19 Dec 2016, Daniel Knezevic wrote:
Forwarded: https://github.com/cgsecurity/testdisk/pull/15
The problem was in bitwise with signed values in le32 macro.
With attached patch I was able to build testdisk successfully on mips.
I have extended the patch to the other macros. Can you test it ?
Thanks
Christophe
--
,-~~-.___. ._.
/ | ' \ | |--------. Christophe GRENIER
( ) 0 | | | gren...@cgsecurity.org
\_/-, ,----' | | |
==== !_!-v---v--.
/ \-'~; .--------. TestDisk & PhotoRec
/ __/~| ._-""|| | Data Recovery
=( _____|_|____||________| https://www.cgsecurity.org
diff -ru testdisk/src/common.h ../testdisk-7.1-WIP/src/common.h
--- testdisk/src/common.h 2016-12-11 16:19:08.775022745 +0100
+++ ../testdisk-7.1-WIP/src/common.h 2016-12-19 18:06:00.436972452 +0100
@@ -447,19 +447,19 @@
(((x)&0x00ff)<<8))
#define le24(x) (x)
#define le32(x) (x)
-#define be32(x) ((((x)&0xff000000L)>>24) | \
- (((x)&0x00ff0000L)>>8) | \
- (((x)&0x0000ff00L)<<8) | \
- (((x)&0x000000ffL)<<24))
+#define be32(x) ((((x)&0xff000000UL)>>24) | \
+ (((x)&0x00ff0000UL)>>8) | \
+ (((x)&0x0000ff00UL)<<8) | \
+ (((x)&0x000000ffUL)<<24))
#define le64(x) (x)
-#define be64(x) ((((x)&0xff00000000000000LL)>>56) | \
- (((x)&0x00ff000000000000LL)>>40) | \
- (((x)&0x0000ff0000000000LL)>>24) | \
- (((x)&0x000000ff00000000LL)>>8) | \
- (((x)&0x00000000ff000000LL)<<8) | \
- (((x)&0x0000000000ff0000LL)<<24) | \
- (((x)&0x000000000000ff00LL)<<40) | \
- (((x)&0x00000000000000ffLL)<<56))
+#define be64(x) ((((x)&0xff00000000000000ULL)>>56) | \
+ (((x)&0x00ff000000000000ULL)>>40) | \
+ (((x)&0x0000ff0000000000ULL)>>24) | \
+ (((x)&0x000000ff00000000ULL)>>8) | \
+ (((x)&0x00000000ff000000ULL)<<8) | \
+ (((x)&0x0000000000ff0000ULL)<<24) | \
+ (((x)&0x000000000000ff00ULL)<<40) | \
+ (((x)&0x00000000000000ffULL)<<56))
#else /* bigendian */
#define le16(x) ((((x)&0xff00)>>8) | \
(((x)&0x00ff)<<8))
@@ -468,19 +468,19 @@
#define le24(x) ((((x) & 0x000000ffUL) << 16) | \
((x) & 0x0000ff00UL) | \
(((x) & 0x00ff0000UL) >> 16))
-#define le32(x) ((((x)&0xff000000L)>>24) | \
- (((x)&0x00ff0000L)>>8) | \
- (((x)&0x0000ff00L)<<8) | \
- (((x)&0x000000ffL)<<24))
+#define le32(x) ((((x)&0xff000000UL)>>24) | \
+ (((x)&0x00ff0000UL)>>8) | \
+ (((x)&0x0000ff00UL)<<8) | \
+ (((x)&0x000000ffUL)<<24))
#define be32(x) (x)
-#define le64(x) ((((x)&0xff00000000000000LL)>>56) | \
- (((x)&0x00ff000000000000LL)>>40) | \
- (((x)&0x0000ff0000000000LL)>>24) | \
- (((x)&0x000000ff00000000LL)>>8) | \
- (((x)&0x00000000ff000000LL)<<8) | \
- (((x)&0x0000000000ff0000LL)<<24) | \
- (((x)&0x000000000000ff00LL)<<40) | \
- (((x)&0x00000000000000ffLL)<<56))
+#define le64(x) ((((x)&0xff00000000000000ULL)>>56) | \
+ (((x)&0x00ff000000000000ULL)>>40) | \
+ (((x)&0x0000ff0000000000ULL)>>24) | \
+ (((x)&0x000000ff00000000ULL)>>8) | \
+ (((x)&0x00000000ff000000ULL)<<8) | \
+ (((x)&0x0000000000ff0000ULL)<<24) | \
+ (((x)&0x000000000000ff00ULL)<<40) | \
+ (((x)&0x00000000000000ffULL)<<56))
#define be64(x) (x)
#endif
#ifndef HAVE_SNPRINTF