Article View: comp.windows.x
Article #24928XParseGeometry bug: let's try this again
From: bilbo.geoff
Date: Wed, 11 Feb 1987 23:00
Date: Wed, 11 Feb 1987 23:00
61 lines
2340 bytes
2340 bytes
You would think that people who know better wouldn't put out untested
bug fixes. Nevertheless, I did, and of course it was wrong.
Disregard my previous bug fix (which added a ++ to an atoi call) for
XParseGeometry. A corrected (and tested!) fix follows, which also
fixes other problems.
Description: XParseGeometry does not correctly handle specifications that
include a negative number in the position specification. Also,
there are some indentation problems in the routine.
Repeat-By: Run 'xclock -bw 8 =100x100+-4+-4'. The clock should come up
in the upper-left corner with the top and left borders half-size.
Instead, the clock will come up slightly offset from the lower-left
corner.
Fix: Apply the following patch with Larry Wall's "patch" program.
Index: XParseGeometry.c
18,19c18,20
< for (i = 0; i < len; i++)
< if (c == what [i]) return (--search);
---
> for (i = 0; i < len; i++)
> if (c == what [i])
> return (--search);
40c41
< char *strind;
---
> register char *strind;
45c46
< string++; /* ignore possible '=' at beginning of geometry spec */
---
> string++; /* ignore possible '=' at beg of geometry spec */
60,61c61,66
< if (*strind == '-') mask |= XNegative;
< *x = atoi (strind++);
---
> if (*strind++ == '-') {
> mask |= XNegative;
> *x = -atoi (strind);
> }
> else
> *x = atoi (strind);
63,65c68,74
< if (strind = strscan (strind, "+-")) {
< if (*strind == '-') mask |= YNegative;
< *y = atoi (strind);
---
> if (strind = strscan (++strind, "+-")) {
> if (*strind++ == '-') {
> mask |= YNegative;
> *y = -atoi (strind);
> }
> else
> *y = atoi (strind);
Geoff Kuenning
Interrupt Technology Corporation
geoff@ITCorp.com
Technical Details
Message-ID:
<8702130244.AA21601@ATHENA>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-unix!sri-spam!ames!ucbcad!ucbvax!LOCUS.UCLA.EDU!bilbo.geoffShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!sri-unix!sri-spam!ames!ucbcad!ucbvax!LOCUS.UCLA.EDU!bilbo.geoff From: bilbo.geoff@LOCUS.UCLA.EDU.UUCP Newsgroups: comp.windows.x Subject: XParseGeometry bug: let's try this again Message-ID: <8702130244.AA21601@ATHENA> Date: Wed, 11-Feb-87 18:00:45 EST Article-I.D.: ATHENA.8702130244.AA21601 Posted: Wed Feb 11 18:00:45 1987 Date-Received: Fri, 13-Feb-87 23:10:35 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 61