}
case RootPath:
{
- for (p=component+(strlen(component)-1); p > component; p--)
- {
- if (IsBasenameSeparator(*p) != MagickFalse)
- break;
- if (*p == '.')
+ if (*component != '\0')
+ {
+ for (p=component+(strlen(component)-1); p > component; p--)
+ {
+ if (IsBasenameSeparator(*p) != MagickFalse)
+ break;
+ if (*p == '.')
+ break;
+ }
+ if (*p == '.')
+ *p='\0';
break;
- }
- if (*p == '.')
- *p='\0';
- break;
+ }
}
case HeadPath:
{
case TailPath:
{
if (IsBasenameSeparator(*p) != MagickFalse)
- (void) CopyMagickMemory((unsigned char *) component,
- (const unsigned char *) (p+1),strlen(p+1)+1);
+ (void) CopyMagickString(component,p+1,MagickPathExtent);
break;
}
case BasePath:
{
if (IsBasenameSeparator(*p) != MagickFalse)
(void) CopyMagickString(component,p+1,MagickPathExtent);
- for (p=component+(strlen(component)-1); p > component; p--)
- if (*p == '.')
- {
- *p='\0';
- break;
- }
+ if (*component != '\0')
+ for (p=component+(strlen(component)-1); p > component; p--)
+ if (*p == '.')
+ {
+ *p='\0';
+ break;
+ }
break;
}
case ExtensionPath:
{
if (IsBasenameSeparator(*p) != MagickFalse)
(void) CopyMagickString(component,p+1,MagickPathExtent);
- p=component;
- if (*p != '\0')
+ if (*component != '\0')
for (p=component+strlen(component)-1; p > component; p--)
if (*p == '.')
break;