summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndreas Bießmann <andreas@biessmann.de>2012-10-18 11:08:49 +0200
committerMichal Marek <mmarek@suse.cz>2012-11-20 11:58:03 +0100
commitfc96b211bc6fa917bfb07a8db4cd898663e5f2c6 (patch)
treee2b4d7aec43efd1d261b702858b67fff1f8fa144 /scripts
parent16f890988114a1b2d7abb30dafb708d4513801da (diff)
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pnmtologo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/pnmtologo.c b/scripts/pnmtologo.c
index 5c113123ed9f..68bb4efc5af4 100644
--- a/scripts/pnmtologo.c
+++ b/scripts/pnmtologo.c
@@ -74,6 +74,7 @@ static unsigned int logo_height;
static struct color **logo_data;
static struct color logo_clut[MAX_LINUX_LOGO_COLORS];
static unsigned int logo_clutsize;
+static int is_plain_pbm = 0;
static void die(const char *fmt, ...)
__attribute__ ((noreturn)) __attribute ((format (printf, 1, 2)));
@@ -103,6 +104,11 @@ static unsigned int get_number(FILE *fp)
val = 0;
while (isdigit(c)) {
val = 10*val+c-'0';
+ /* some PBM are 'broken'; GiMP for example exports a PBM without space
+ * between the digits. This is Ok cause we know a PBM can only have a '1'
+ * or a '0' for the digit. */
+ if (is_plain_pbm)
+ break;
c = fgetc(fp);
if (c == EOF)
die("%s: end of file\n", filename);
@@ -167,6 +173,7 @@ static void read_image(void)
switch (magic) {
case '1':
/* Plain PBM */
+ is_plain_pbm = 1;
for (i = 0; i < logo_height; i++)
for (j = 0; j < logo_width; j++)
logo_data[i][j].red = logo_data[i][j].green =