Contents of /trunk/libX11/patches/libX11-1.1.1-xinitimage.patch
Parent Directory | Revision Log
Revision 206 -
(show annotations)
(download)
Mon May 21 22:24:41 2007 UTC (17 years, 4 months ago) by niro
File size: 2683 byte(s)
Mon May 21 22:24:41 2007 UTC (17 years, 4 months ago) by niro
File size: 2683 byte(s)
-added new patches
1 | diff --git a/src/ImUtil.c b/src/ImUtil.c |
2 | index 83fd030..9e667bb 100644 |
3 | --- a/src/ImUtil.c |
4 | +++ b/src/ImUtil.c |
5 | @@ -327,12 +327,13 @@ XImage *XCreateImage (dpy, visual, depth |
6 | { |
7 | register XImage *image; |
8 | int bits_per_pixel = 1; |
9 | + int min_bytes_per_line; |
10 | |
11 | if (depth == 0 || depth > 32 || |
12 | (format != XYBitmap && format != XYPixmap && format != ZPixmap) || |
13 | (format == XYBitmap && depth != 1) || |
14 | (xpad != 8 && xpad != 16 && xpad != 32) || |
15 | - offset < 0 || image_bytes_per_line < 0) |
16 | + offset < 0) |
17 | return (XImage *) NULL; |
18 | if ((image = (XImage *) Xcalloc(1, (unsigned) sizeof(XImage))) == NULL) |
19 | return (XImage *) NULL; |
20 | @@ -363,16 +364,21 @@ XImage *XCreateImage (dpy, visual, depth |
21 | /* |
22 | * compute per line accelerator. |
23 | */ |
24 | - if (image_bytes_per_line == 0) |
25 | { |
26 | if (format == ZPixmap) |
27 | - image->bytes_per_line = |
28 | + min_bytes_per_line = |
29 | ROUNDUP((bits_per_pixel * width), image->bitmap_pad); |
30 | else |
31 | - image->bytes_per_line = |
32 | + min_bytes_per_line = |
33 | ROUNDUP((width + offset), image->bitmap_pad); |
34 | } |
35 | - else image->bytes_per_line = image_bytes_per_line; |
36 | + if (image_bytes_per_line == 0) { |
37 | + image->bytes_per_line = min_bytes_per_line; |
38 | + } else if (image_bytes_per_line < min_bytes_per_line) { |
39 | + return 0; |
40 | + } else { |
41 | + image->bytes_per_line = image_bytes_per_line; |
42 | + } |
43 | |
44 | image->bits_per_pixel = bits_per_pixel; |
45 | image->obdata = NULL; |
46 | @@ -384,7 +390,11 @@ XImage *XCreateImage (dpy, visual, depth |
47 | Status XInitImage (image) |
48 | XImage *image; |
49 | { |
50 | + int min_bytes_per_line; |
51 | + |
52 | if (image->depth == 0 || image->depth > 32 || |
53 | + image->bits_per_pixel > 32 || image->bitmap_unit > 32 || |
54 | + image->bits_per_pixel < 0 || image->bitmap_unit < 0 || |
55 | (image->format != XYBitmap && |
56 | image->format != XYPixmap && |
57 | image->format != ZPixmap) || |
58 | @@ -392,21 +402,24 @@ Status XInitImage (image) |
59 | (image->bitmap_pad != 8 && |
60 | image->bitmap_pad != 16 && |
61 | image->bitmap_pad != 32) || |
62 | - image->xoffset < 0 || image->bytes_per_line < 0) |
63 | + image->xoffset < 0) |
64 | return 0; |
65 | |
66 | /* |
67 | * compute per line accelerator. |
68 | */ |
69 | - if (image->bytes_per_line == 0) |
70 | - { |
71 | if (image->format == ZPixmap) |
72 | - image->bytes_per_line = |
73 | + min_bytes_per_line = |
74 | ROUNDUP((image->bits_per_pixel * image->width), |
75 | image->bitmap_pad); |
76 | else |
77 | - image->bytes_per_line = |
78 | + min_bytes_per_line = |
79 | ROUNDUP((image->width + image->xoffset), image->bitmap_pad); |
80 | + |
81 | + if (image->bytes_per_line == 0) { |
82 | + image->bytes_per_line = min_bytes_per_line; |
83 | + } else if (image->bytes_per_line < min_bytes_per_line) { |
84 | + return 0; |
85 | } |
86 | |
87 | _XInitImageFuncPtrs (image); |