OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.1 KiB

  1. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # T2 SDE: package/.../grub/grub-0.95-xpmjunk.patch
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- T2-COPYRIGHT-NOTE-END ---
  16. --- grub-0.95/stage2/graphics.c.xpmjunk 2005-01-04 17:01:35.492804523 -0500
  17. +++ grub-0.95/stage2/graphics.c 2005-01-04 17:02:52.722495885 -0500
  18. @@ -262,6 +262,35 @@
  19. return;
  20. }
  21. +/* Open the file, and search for a valid XPM header. Return 1 if one is found,
  22. + * leaving the current position as the start of the next line. Else,
  23. + * return 0.
  24. + */
  25. +int xpm_open(const char *s) {
  26. + char buf, prev, target[]="/* XPM */\n";
  27. + int pos=0;
  28. +
  29. + if (!grub_open(s))
  30. + return 0;
  31. +
  32. + prev='\n';
  33. + buf=0;
  34. + do {
  35. + if (grub_read(&buf, 1) != 1) {
  36. + grub_close();
  37. + return 0;
  38. + }
  39. + if ((pos == 0 && prev == '\n') || pos > 0) {
  40. + if (buf == target[pos])
  41. + pos++;
  42. + else
  43. + pos=0;
  44. + }
  45. + prev=buf;
  46. + } while (target[pos]);
  47. + return 1;
  48. +}
  49. +
  50. /* Read in the splashscreen image and set the palette up appropriately.
  51. * Format of splashscreen is an xpm (can be gzipped) with 16 colors and
  52. * 640x480. */
  53. @@ -271,15 +300,9 @@
  54. unsigned char c, base, mask, *s1, *s2, *s4, *s8;
  55. unsigned i, len, idx, colors, x, y, width, height;
  56. - if (!grub_open(s))
  57. + if (!xpm_open(s))
  58. return 0;
  59. - /* read header */
  60. - if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) {
  61. - grub_close();
  62. - return 0;
  63. - }
  64. -
  65. /* parse info */
  66. while (grub_read(&c, 1)) {
  67. if (c == '"')