shithub: drawterm

Download patch

ref: 86573f1aaf078c1c2fcd51beda36eaeaa06cfbf6
parent: 76af4ec0e6d869e8ccc2757904375daf6470bd92
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Feb 28 05:48:52 EST 2016

libc: fix sign extension bug for GBIT64()

this bug caused all file i/o's arround 2GB to fail with "negative i/o offset"
because the low 32 bits of the offset got sign extended to 64 bit.

--- a/include/fcall.h	Sun Feb 28 04:51:35 2016
+++ b/include/fcall.h	Sun Feb 28 05:48:52 2016
@@ -37,7 +37,7 @@
 #define	GBIT8(p)	((p)[0])
 #define	GBIT16(p)	((p)[0]|((p)[1]<<8))
 #define	GBIT32(p)	((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24))
-#define	GBIT64(p)	((vlong)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\
+#define	GBIT64(p)	((u32int)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\
 				((vlong)((p)[4]|((p)[5]<<8)|((p)[6]<<16)|((p)[7]<<24)) << 32))
 
 #define	PBIT8(p,v)	(p)[0]=(v)