[gtk-vnc-devel] More big endian fixes
- From: Anthony Liguori <anthony codemonkey ws>
- To: gtk-vnc-devel List <gtk-vnc-devel lists sourceforge net>
- Subject: [gtk-vnc-devel] More big endian fixes
- Date: Mon, 14 Jan 2008 21:30:10 -0600
I've got a PPC test machine now and discovered some endian bugs I've
introduced. Attached is the fix I've committed.
Regards,
Anthony Liguori
# HG changeset patch
# User Anthony Liguori <anthony codemonkey ws>
# Date 1200367734 21600
# Node ID bfcbe9409fa547aa3b631b56d7896c06761d144d
# Parent 492cc3ad13a79ab5470fbc57e01d674d05567b13
Fix case where client byte order != server byte order
diff -r 492cc3ad13a7 -r bfcbe9409fa5 src/gvnc.c
--- a/src/gvnc.c Fri Jan 11 17:38:00 2008 -0600
+++ b/src/gvnc.c Mon Jan 14 21:28:54 2008 -0600
@@ -1153,9 +1153,8 @@ static void gvnc_read_cpixel(struct gvnc
if (bpp == 4 && gvnc->fmt.true_color_flag && gvnc->fmt.depth == 24) {
bpp = 3;
-#if __BYTE_ORDER == __BIG_ENDIAN
- pixel += 1;
-#endif
+ if (gvnc->fmt.byte_order == __BIG_ENDIAN)
+ pixel += 1;
}
gvnc_read(gvnc, pixel, bpp);
@@ -1399,6 +1398,13 @@ static void gvnc_read_tpixel(struct gvnc
val = (pixel[0] << gvnc->fmt.red_shift)
| (pixel[1] << gvnc->fmt.green_shift)
| (pixel[2] << gvnc->fmt.blue_shift);
+
+ if (gvnc->fmt.byte_order != __BYTE_ORDER)
+ val = (((val >> 0) & 0xFF) << 24) |
+ (((val >> 8) & 0xFF) << 16) |
+ (((val >> 16) & 0xFF) << 8) |
+ (((val >> 24) & 0xFF) << 0);
+
memcpy(pixel, &val, 4);
} else
gvnc_read_pixel(gvnc, pixel);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]