Commit fc96b211bc6fa917bfb07a8db4cd898663e5f2c6
Committed by
Michal Marek
1 parent
16f8909881
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
scripts/pnmtologo: fix for plain PBM
PBM generated with current tools do not have a whitespace between the digits. Therefore the pnmtologo tool fails to gernerate the required C-Array for these images. This patch fixes that behaviour and can handle both 'old style' and 'new style' PBM files. Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
Showing 1 changed file with 7 additions and 0 deletions Side-by-side Diff
scripts/pnmtologo.c
... | ... | @@ -74,6 +74,7 @@ |
74 | 74 | static struct color **logo_data; |
75 | 75 | static struct color logo_clut[MAX_LINUX_LOGO_COLORS]; |
76 | 76 | static unsigned int logo_clutsize; |
77 | +static int is_plain_pbm = 0; | |
77 | 78 | |
78 | 79 | static void die(const char *fmt, ...) |
79 | 80 | __attribute__ ((noreturn)) __attribute ((format (printf, 1, 2))); |
... | ... | @@ -103,6 +104,11 @@ |
103 | 104 | val = 0; |
104 | 105 | while (isdigit(c)) { |
105 | 106 | val = 10*val+c-'0'; |
107 | + /* some PBM are 'broken'; GiMP for example exports a PBM without space | |
108 | + * between the digits. This is Ok cause we know a PBM can only have a '1' | |
109 | + * or a '0' for the digit. */ | |
110 | + if (is_plain_pbm) | |
111 | + break; | |
106 | 112 | c = fgetc(fp); |
107 | 113 | if (c == EOF) |
108 | 114 | die("%s: end of file\n", filename); |
... | ... | @@ -167,6 +173,7 @@ |
167 | 173 | switch (magic) { |
168 | 174 | case '1': |
169 | 175 | /* Plain PBM */ |
176 | + is_plain_pbm = 1; | |
170 | 177 | for (i = 0; i < logo_height; i++) |
171 | 178 | for (j = 0; j < logo_width; j++) |
172 | 179 | logo_data[i][j].red = logo_data[i][j].green = |