From 88281627bc765041f85b68f585e75c255cf2e89b Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 12 Mar 2003 00:51:03 +0000 Subject: [PATCH] Style fixes. --- ext/gd/libgd/gd.c | 128 --------------------------------------------- ext/gd/libgd/xbm.c | 31 ++++++----- 2 files changed, 17 insertions(+), 142 deletions(-) diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index cf79d95f97..74d9bd43c1 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -2857,134 +2857,6 @@ gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack) } /* End Rotate function */ -#if MBO_0 -gdImagePtr -gdImageCreateFromXbm (FILE * fd) -{ - gdImagePtr im; - int bit; - int w, h; - int bytes; - int ch; - int i, x, y; - char *sp; - char s[161]; - if (!fgets (s, 160, fd)) - { - return 0; - } - sp = &s[0]; - /* Skip #define */ - sp = strchr (sp, ' '); - if (!sp) - { - return 0; - } - /* Skip width label */ - sp++; - sp = strchr (sp, ' '); - if (!sp) - { - return 0; - } - /* Get width */ - w = atoi (sp + 1); - if (!w) - { - return 0; - } - if (!fgets (s, 160, fd)) - { - return 0; - } - sp = s; - /* Skip #define */ - sp = strchr (sp, ' '); - if (!sp) - { - return 0; - } - /* Skip height label */ - sp++; - sp = strchr (sp, ' '); - if (!sp) - { - return 0; - } - /* Get height */ - h = atoi (sp + 1); - if (!h) - { - return 0; - } - /* Skip declaration line */ - if (!fgets (s, 160, fd)) - { - return 0; - } - bytes = (w * h / 8) + 1; - im = gdImageCreate (w, h); - gdImageColorAllocate (im, 255, 255, 255); - gdImageColorAllocate (im, 0, 0, 0); - x = 0; - y = 0; - for (i = 0; (i < bytes); i++) - { - char h[3]; - unsigned int b; - /* Skip spaces, commas, CRs, 0x */ - while (1) - { - ch = getc (fd); - if (ch == EOF) - { - goto fail; - } - if (ch == 'x') - { - break; - } - } - /* Get hex value */ - ch = getc (fd); - if (ch == EOF) - { - goto fail; - } - h[0] = ch; - ch = getc (fd); - if (ch == EOF) - { - goto fail; - } - h[1] = ch; - h[2] = '\0'; - sscanf (h, "%x", &b); - for (bit = 1; (bit <= 128); (bit = bit << 1)) - { - gdImageSetPixel (im, x++, y, (b & bit) ? 1 : 0); - if (x == im->sx) - { - x = 0; - y++; - if (y == im->sy) - { - return im; - } - /* Fix 8/8/95 */ - break; - } - } - } - /* Shouldn't happen */ - php_gd_error("Error: bug in gdImageCreateFromXbm\n"); - return 0; -fail: - gdImageDestroy (im); - return 0; -} -#endif /* MBO_0 */ - void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) { diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/xbm.c index b873c51c1e..c730c3666d 100644 --- a/ext/gd/libgd/xbm.c +++ b/ext/gd/libgd/xbm.c @@ -103,14 +103,11 @@ gdImageCreateFromXbm (FILE * fd) h[4] = '\0'; for (i = 0; i < bytes; i++) { while (1) { - ch = getc(fd); - if (ch == EOF) - { + if ((ch=getc(fd)) == EOF) { fail = 1; break; } - if (ch == 'x') - { + if (ch == 'x') { break; } } @@ -118,25 +115,31 @@ gdImageCreateFromXbm (FILE * fd) break; } /* Get hex value */ - if ((ch=getc(fd)) == EOF) break; + if ((ch=getc(fd)) == EOF) { + break; + } h[0] = ch; - if ((ch=getc(fd)) == EOF) break; + if ((ch=getc(fd)) == EOF) { + break; + } h[1] = ch; if (max_bit == 32768) { - if ((ch=getc(fd)) == EOF) break; + if ((ch=getc(fd)) == EOF) { + break; + } h[2] = ch; - if ((ch=getc(fd)) == EOF) break; + if ((ch=getc(fd)) == EOF) { + break; + } h[3] = ch; } sscanf(h, "%x", &b); for (bit = 1; bit <= max_bit; bit = bit << 1) { - gdImageSetPixel (im, x++, y, (b & bit) ? 1 : 0); - if (x == im->sx) - { + gdImageSetPixel(im, x++, y, (b & bit) ? 1 : 0); + if (x == im->sx) { x = 0; y++; - if (y == im->sy) - { + if (y == im->sy) { return im; } break; -- 2.50.1