Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andreas Bießmann and committed by
Michal Marek
fc96b211 16f89098

+7
+7
scripts/pnmtologo.c
··· 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))); ··· 104 103 val = 0; 105 104 while (isdigit(c)) { 106 105 val = 10*val+c-'0'; 106 + /* some PBM are 'broken'; GiMP for example exports a PBM without space 107 + * between the digits. This is Ok cause we know a PBM can only have a '1' 108 + * or a '0' for the digit. */ 109 + if (is_plain_pbm) 110 + break; 107 111 c = fgetc(fp); 108 112 if (c == EOF) 109 113 die("%s: end of file\n", filename); ··· 173 167 switch (magic) { 174 168 case '1': 175 169 /* Plain PBM */ 170 + is_plain_pbm = 1; 176 171 for (i = 0; i < logo_height; i++) 177 172 for (j = 0; j < logo_width; j++) 178 173 logo_data[i][j].red = logo_data[i][j].green =