]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 12 Oct 2011 19:23:41 +0000 (19:23 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 12 Oct 2011 19:23:41 +0000 (19:23 +0000)
MagickCore/utility.c

index 0a3b2df4265e45be4e48745dd82de7521a561d5b..7183bd7030106862d99c233bfae37544bbb13436 100644 (file)
@@ -1171,30 +1171,8 @@ MagickExport void GetPathComponent(const char *path,PathType type,
     }
   (void) CopyMagickString(component,path,MaxTextExtent);
   *magick='\0';
-  *subimage='\0';
-  p=component;
-  if (*p != '\0')
-    p=component+strlen(component)-1;
-  if ((*p == ']') && (strchr(component,'[') != (char *) NULL) &&
-      (IsPathAccessible(path) == MagickFalse))
-    {
-      /*
-        Look for scene specification (e.g. img0001.pcd[4]).
-      */
-      for (q=p-1; q > component; q--)
-        if (*q == '[')
-          break;
-      if (*q == '[')
-        {
-          (void) CopyMagickString(subimage,q+1,MaxTextExtent);
-          subimage[p-q-1]='\0';
-          if ((IsSceneGeometry(subimage,MagickFalse) == MagickFalse) &&
-              (IsGeometry(subimage) == MagickFalse))
-            *subimage='\0';
-        }
-    }
 #if defined(__OS2__)
-  if (path[1] != ':')
+  if (path[1] != ":")
 #endif
   for (p=component; *p != '\0'; p++)
   {
@@ -1207,8 +1185,8 @@ MagickExport void GetPathComponent(const char *path,PathType type,
         if (*p == '\0')
           break;
       }
-    if ((*p == ':') && (IsPathDirectory(component) < 0) &&
-        (IsPathAccessible(component) == MagickFalse))
+    if ((*p == ':') && (IsPathDirectory(path) < 0) &&
+        (IsPathAccessible(path) == MagickFalse))
       {
         /*
           Look for image format specification (e.g. ps3:image).
@@ -1222,6 +1200,30 @@ MagickExport void GetPathComponent(const char *path,PathType type,
         break;
       }
   }
+  *subimage='\0';
+  p=component;
+  if (*p != '\0')
+    p=component+strlen(component)-1;
+  if ((*p == ']') && (strchr(component,'[') != (char *) NULL) &&
+      (IsPathAccessible(path) == MagickFalse))
+    {
+      /*
+        Look for scene specification (e.g. img0001.pcd[4]).
+      */
+      for (q=p-1; q > component; q--)
+        if (*q == '[')
+          break;
+      if (*q == '[')
+        {
+          (void) CopyMagickString(subimage,q+1,MaxTextExtent);
+          subimage[p-q-1]='\0';
+          if ((IsSceneGeometry(subimage,MagickFalse) == MagickFalse) &&
+              (IsGeometry(subimage) == MagickFalse))
+            *subimage='\0';
+          else
+            *q='\0';
+        }
+    }
   p=component;
   if (*p != '\0')
     for (p=component+strlen(component)-1; p > component; p--)