]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/grub-0.95-xpmjunk.patch
Updated igmpproxy to 0.1.
[people/pmueller/ipfire-2.x.git] / src / patches / grub-0.95-xpmjunk.patch
CommitLineData
4ff9093d
MT
1--- grub-0.95/stage2/graphics.c.xpmjunk 2005-01-04 17:01:35.492804523 -0500
2+++ grub-0.95/stage2/graphics.c 2005-01-04 17:02:52.722495885 -0500
3@@ -262,6 +262,35 @@
4 return;
5 }
6
7+/* Open the file, and search for a valid XPM header. Return 1 if one is found,
8+ * leaving the current position as the start of the next line. Else,
9+ * return 0.
10+ */
11+int xpm_open(const char *s) {
12+ char buf, prev, target[]="/* XPM */\n";
13+ int pos=0;
14+
15+ if (!grub_open(s))
16+ return 0;
17+
18+ prev='\n';
19+ buf=0;
20+ do {
21+ if (grub_read(&buf, 1) != 1) {
22+ grub_close();
23+ return 0;
24+ }
25+ if ((pos == 0 && prev == '\n') || pos > 0) {
26+ if (buf == target[pos])
27+ pos++;
28+ else
29+ pos=0;
30+ }
31+ prev=buf;
32+ } while (target[pos]);
33+ return 1;
34+}
35+
36 /* Read in the splashscreen image and set the palette up appropriately.
37 * Format of splashscreen is an xpm (can be gzipped) with 16 colors and
38 * 640x480. */
39@@ -271,15 +300,9 @@
40 unsigned char c, base, mask, *s1, *s2, *s4, *s8;
41 unsigned i, len, idx, colors, x, y, width, height;
42
43- if (!grub_open(s))
44+ if (!xpm_open(s))
45 return 0;
46
47- /* read header */
48- if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) {
49- grub_close();
50- return 0;
51- }
52-
53 /* parse info */
54 while (grub_read(&c, 1)) {
55 if (c == '"')