From a7355c5c8ab9c013f4f0a75175a718ee3f4e970a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 4 Oct 2019 21:01:59 +0200 Subject: Xau: mark NX changes libXau is integrated into libNX_X11, but the differences to libXau original code where not explicitly marked. This path adds some ifdefs and also restores the original code. Attributes to ArcticaProject/nx-libs#850 --- nx-X11/lib/src/AuRead.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'nx-X11/lib/src/AuRead.c') diff --git a/nx-X11/lib/src/AuRead.c b/nx-X11/lib/src/AuRead.c index 61814792d..5c04c3258 100644 --- a/nx-X11/lib/src/AuRead.c +++ b/nx-X11/lib/src/AuRead.c @@ -30,13 +30,16 @@ in this Software without prior written authorization from The Open Group. #endif #include #include +#ifdef NX_TRANS_SOCKET #include +#endif static int read_short (unsigned short *shortp, FILE *file) { unsigned char file_short[2]; +#ifdef NX_TRANS_SOCKET /* * Added a check on EINTR to prevent the fread() call to be * interrupted by any signal not blocked by OsBlockSignals(). @@ -53,6 +56,10 @@ read_short (unsigned short *shortp, FILE *file) } break; } +#else + if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) + return 0; +#endif *shortp = file_short[0] * 256 + file_short[1]; return 1; } @@ -71,6 +78,7 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file) data = malloc ((unsigned) len); if (!data) return 0; +#ifdef NX_TRANS_SOCKET for (;;) { if (fread (data, (int) sizeof (char), (int) len, file) != len) @@ -87,6 +95,13 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file) } break; } +#else + if (fread (data, (int) sizeof (char), (int) len, file) != len) { + bzero (data, len); + free (data); + return 0; + } +#endif } *stringp = data; *countp = len; -- cgit v1.2.3