summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplettix <plettix@gmail.com>2015-07-22 08:37:54 +0200
committerplettix <plettix@gmail.com>2015-07-22 08:37:54 +0200
commitfe7df89fb1777b4fd303d5a601541f6062caf8ea (patch)
treee593a302baec00ceb36631a25425888930979e62
parent455ba61e4fdc9f2696832137f52c0ae51aeb9004 (diff)
downloadlibtdevnc-fe7df89fb1777b4fd303d5a601541f6062caf8ea.tar.gz
libtdevnc-fe7df89fb1777b4fd303d5a601541f6062caf8ea.zip
shift fixes - if an integer is a negative number then the return value of "Swap32IfLE" was -1
-rw-r--r--rfb/rfb.h4
-rw-r--r--rfb/rfbclient.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/rfb/rfb.h b/rfb/rfb.h
index 0c34d74..c8c247a 100644
--- a/rfb/rfb.h
+++ b/rfb/rfb.h
@@ -720,10 +720,10 @@ typedef struct _rfbClientRec {
#define Swap24(l) ((((l) & 0xff) << 16) | (((l) >> 16) & 0xff) | \
(((l) & 0x00ff00)))
-#define Swap32(l) (((l) >> 24) | \
+#define Swap32(l) ((((l) >> 24) & 0x000000ff)| \
(((l) & 0x00ff0000) >> 8) | \
(((l) & 0x0000ff00) << 8) | \
- ((l) << 24))
+ (((l) & 0x000000ff) << 24))
extern char rfbEndianTest;
diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h
index aedb4f4..e210a41 100644
--- a/rfb/rfbclient.h
+++ b/rfb/rfbclient.h
@@ -47,13 +47,13 @@
(*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
#define rfbClientSwap32IfLE(l) \
- (*(char *)&client->endianTest ? ((((l) & 0xff000000) >> 24) | \
+ (*(char *)&client->endianTest ? ((((l) >> 24) & 0x000000ff) | \
(((l) & 0x00ff0000) >> 8) | \
(((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24)) : (l))
#define rfbClientSwap64IfLE(l) \
- (*(char *)&client->endianTest ? ((((l) & 0xff00000000000000ULL) >> 56) | \
+ (*(char *)&client->endianTest ? ((((l) >> 56 ) & 0xff00000000000000ULL) | \
(((l) & 0x00ff000000000000ULL) >> 40) | \
(((l) & 0x0000ff0000000000ULL) >> 24) | \
(((l) & 0x000000ff00000000ULL) >> 8) | \