]> granicus.if.org Git - php/commitdiff
Style fixes.
authorIlia Alshanetsky <iliaa@php.net>
Wed, 12 Mar 2003 00:51:03 +0000 (00:51 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 12 Mar 2003 00:51:03 +0000 (00:51 +0000)
ext/gd/libgd/gd.c
ext/gd/libgd/xbm.c

index cf79d95f97fd08b3d4562823853308b69a3d028b..74d9bd43c1ca4232e18b506287f677bab2c75d8b 100644 (file)
@@ -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)
 {
index b873c51c1e8e3f052bed34d4e4899d6f4bf8789d..c730c3666db1e297040a70f0b26dd1047f0f2b49 100644 (file)
@@ -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;