LP64 fix, tested by jakemsr@
This commit is contained in:
parent
34209deb75
commit
dd7806fdfa
@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.15 2007/06/01 01:00:23 aanriot Exp $
|
||||
# $OpenBSD: Makefile,v 1.16 2007/08/05 13:43:39 naddy Exp $
|
||||
|
||||
COMMENT= "X keygrabber for blackbox"
|
||||
|
||||
DISTNAME= bbkeys-0.9.0
|
||||
PKGNAME= ${DISTNAME}p0
|
||||
PKGNAME= ${DISTNAME}p1
|
||||
CATEGORIES= x11
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=bbkeys/}
|
||||
|
||||
|
46
x11/bbkeys/patches/patch-src_Netclient_cpp
Normal file
46
x11/bbkeys/patches/patch-src_Netclient_cpp
Normal file
@ -0,0 +1,46 @@
|
||||
$OpenBSD: patch-src_Netclient_cpp,v 1.1 2007/08/05 13:43:39 naddy Exp $
|
||||
--- src/Netclient.cpp.orig Fri Aug 3 21:43:44 2007
|
||||
+++ src/Netclient.cpp Fri Aug 3 21:45:07 2007
|
||||
@@ -140,6 +140,7 @@ bool Netclient::getValue(Window win, Atom atom, Atom t
|
||||
int result;
|
||||
unsigned long maxread = nelements;
|
||||
bool ret = False;
|
||||
+ size_t bsize;
|
||||
|
||||
// try get the first element
|
||||
result = XGetWindowProperty(_display.XDisplay(), win, atom, 0l, 1l, False,
|
||||
@@ -148,18 +149,19 @@ bool Netclient::getValue(Window win, Atom atom, Atom t
|
||||
ret = (result == Success && ret_type == type && ret_size == size &&
|
||||
nelements > 0);
|
||||
if (ret) {
|
||||
+ bsize = (size == 32) ? sizeof(long) : size/8;
|
||||
if (ret_bytes == 0 || maxread <= nelements) {
|
||||
// we got the whole property's value
|
||||
- *value = new unsigned char[nelements * size/8 + 1];
|
||||
- memcpy(*value, c_val, nelements * size/8 + 1);
|
||||
+ *value = new unsigned char[nelements * bsize + 1];
|
||||
+ memcpy(*value, c_val, nelements * bsize + 1);
|
||||
} else {
|
||||
// get the entire property since it is larger than one long
|
||||
XFree(c_val);
|
||||
// the number of longs that need to be retreived to get the property's
|
||||
// entire value. The last + 1 is the first long that we retrieved above.
|
||||
int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1;
|
||||
- if (remain > size/8 * (signed)maxread) // dont get more than the max
|
||||
- remain = size/8 * (signed)maxread;
|
||||
+ if (remain > bsize * (signed)maxread) // dont get more than the max
|
||||
+ remain = bsize * (signed)maxread;
|
||||
result = XGetWindowProperty(_display.XDisplay(), win, atom, 0l, remain, False, type,
|
||||
&ret_type, &ret_size, &nelements, &ret_bytes,
|
||||
&c_val);
|
||||
@@ -173,8 +175,8 @@ bool Netclient::getValue(Window win, Atom atom, Atom t
|
||||
if (! ret)
|
||||
return getValue(win, atom, type, maxread, value, size);
|
||||
|
||||
- *value = new unsigned char[nelements * size/8 + 1];
|
||||
- memcpy(*value, c_val, nelements * size/8 + 1);
|
||||
+ *value = new unsigned char[nelements * bsize + 1];
|
||||
+ memcpy(*value, c_val, nelements * bsize + 1);
|
||||
}
|
||||
}
|
||||
if (c_val) XFree(c_val);
|
Loading…
x
Reference in New Issue
Block a user