From: cristy Date: Wed, 12 Oct 2011 19:23:41 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6827 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1224a9941fcdddc1c36cbc74e34c81b7fb67ce28;p=imagemagick --- diff --git a/MagickCore/utility.c b/MagickCore/utility.c index 0a3b2df42..7183bd703 100644 --- a/MagickCore/utility.c +++ b/MagickCore/utility.c @@ -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--)