]> granicus.if.org Git - imagemagick/commitdiff
Tidy SeekBlob() method.
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 24 Dec 2014 20:54:20 +0000 (20:54 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 24 Dec 2014 20:54:20 +0000 (20:54 +0000)
MagickCore/blob.c

index 4319424ed90a22b654eb451ff68f29a51208a475..6119b34120183ccdb3bfbc1b1a2715b681ef108f 100644 (file)
@@ -3703,27 +3703,27 @@ MagickExport MagickOffsetType SeekBlob(Image *image,
           break;
         }
       }
-      if (image->blob->offset <= (MagickOffsetType)
+      if (image->blob->offset < (MagickOffsetType)
           ((off_t) image->blob->length))
-        image->blob->eof=MagickFalse;
-      else
-        if (image->blob->mapped != MagickFalse)
+        {
+          image->blob->eof=MagickFalse;
+          break;
+        }
+      if (image->blob->offset < (MagickOffsetType)
+          ((off_t) image->blob->extent))
+        break;
+      if (image->blob->mapped != MagickFalse)
+        return(-1);
+      image->blob->extent=(size_t) (image->blob->offset+image->blob->quantum);
+      image->blob->quantum<<=1;
+      image->blob->data=(unsigned char *) ResizeQuantumMemory(image->blob->data,
+        image->blob->extent+1,sizeof(*image->blob->data));
+      (void) SyncBlob(image);
+      if (image->blob->data == (unsigned char *) NULL)
+        {
+          (void) DetachBlob(image->blob);
           return(-1);
-        else
-          {
-            image->blob->extent=(size_t) (image->blob->offset+
-              image->blob->quantum);
-            image->blob->quantum<<=1;
-            image->blob->data=(unsigned char *) ResizeQuantumMemory(
-              image->blob->data,image->blob->extent+1,
-              sizeof(*image->blob->data));
-            (void) SyncBlob(image);
-            if (image->blob->data == (unsigned char *) NULL)
-              {
-                (void) DetachBlob(image->blob);
-                return(-1);
-              }
-          }
+        }
       break;
     }
   }