shithub: riscv

Download patch

ref: d07fb3261f596766b47f868fc6c088ec8f286cd5
parent: 34c7af22c16781bbe9e415a7c25ec54a32acff8a
author: cinap_lenrek <[email protected]>
date: Mon Jul 23 15:29:15 EDT 2018

devmouse: produce signed msec timestamp in /dev/mouse, accept unsigned on write

--- a/sys/src/9/port/devmouse.c
+++ b/sys/src/9/port/devmouse.c
@@ -291,7 +291,7 @@
 				b = 16;
 			else if (b == 16)
 				b = 8;
-		sprint(buf, "m%11d %11d %11d %11lud ",
+		sprint(buf, "m%11d %11d %11d %11ld ",
 			m.xy.x, m.xy.y, b, m.msec);
 
 		mouse.lastcounter = m.counter;
@@ -448,7 +448,7 @@
 		if(*p == 0)
 			error(Eshort);
 		b = strtol(p, &p, 0);
-		msec = strtol(p, 0, 0);
+		msec = (ulong)strtoll(p, 0, 0);
 		if(msec == 0)
 			msec = TK2MS(MACHP(0)->ticks);
 
--- a/sys/src/cmd/vnc/devmouse.c
+++ b/sys/src/cmd/vnc/devmouse.c
@@ -191,7 +191,7 @@
 			m = mouse.Mousestate;
 		unlock(&mouse);
 
-		sprint(buf, "m%11d %11d %11d %11lud ",
+		sprint(buf, "m%11d %11d %11d %11ld ",
 			m.xy.x, m.xy.y, m.buttons, m.msec);
 
 		mouse.lastcounter = m.counter;