Package: libxpm-dev
Version: 4.3.0.dfsg.1-14sarge1
I have been using Xpm routines to read pixmap data from a file. The example given here focuses on the XpmReadFiletoPixmap, but every function that involved reading a pixmap file triggered the bug.
This code works:
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#include <sys/time.h>
#include <string.h>
main()
{
Display *display;
int depth, screen;
int width, height, w, h;
Window window, rootwindow;
Pixmap *pixmap, *shape;
char xpmfile[BUFSIZ];
struct timespec t;
struct timeval td1, td2, td3;
and some other declarations
display = XOpenDisplay (NULL);
screen = DefaultScreen (display);
width = DisplayWidth (display, screen);
height = DisplayHeight (display, screen);
rootwindow = RootWindow (display, screen);
window = XCreateSimpleWindow (display, rootwindow, 0, 0, width, height, 0, 0, 0);
strcpy (xpmfile, "filename.xpm");
XpmReadFileToPixmap (display, window, xpmfile, pixmap, shape /* or NULL */, NULL);
}
compiled with:
gcc -L/usr/X11R6/lib -Xlib -Xpm
If, however, you declare the timespec and timeval variables before "display", this produces a segmentation fault.
Of note, the pixfile in question is large - it is the size of the screen (1600x1200) and I suspect that there are hidden limits
to pixmap sizes in Xpm that are triggering this bug.
Pixmaps are generated from a jpeg file using mogrify:
mogrify -resize 1600x1200 -scale 1600x1200 -depth 24 -format xpm <file.jpg>
Thanks!
Cathy