[comp.windows.x] Wounded by a sharp XPoint

brown@hpdmd48.boi.hp.com (Kevin Brown) (12/05/90)

I've been working on someone else's code to speed it up. One of the things
I did was to use XDrawLines instead of lots of XDrawLine calls. But I
imediatley got bugs. I've found them now. The trouble is that XDrawLine
uses int for the data type that specifiec the coordicates of the endpoints, but
XDrawLines uses the XPoint data type which is a structure of SHORTS! I
was overflowing the shorts. Problem fixed.

Question is: Why does one use int and the other short? I can see that 
there would be cases for using shorts or using ints but is there a reason
to two different data types in what are closely related functions (they share
the same man page so that makes them cohibitaing partners) ?


Kevin Brown
brown@hpbsm15.boi.hp.com
 

klee@wsl.dec.com (Ken Lee) (12/06/90)

In article <15510009@hpdmd48.boi.hp.com>, brown@hpdmd48.boi.hp.com (Kevin Brown) writes:
|> XDrawLines uses the XPoint data type which is a structure of SHORTS! I
|> was overflowing the shorts.

The X protocol requires that the points given to XDrawLines by 16 bits or
less.  You will have major problems if you go beyond that, no matter
what the Xlib data type.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee