forked from old/legacy-imlib2
GZ, BZ2 loaders: Accept more file names
E.g. ".png.gz", "png.gz", ".../png.gz".
This commit is contained in:
parent
97865ad8ef
commit
ac41eae7fa
|
@ -57,17 +57,17 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
||||||
|
|
||||||
/* make sure this file ends in ".bz2" and that there's another ext
|
/* make sure this file ends in ".bz2" and that there's another ext
|
||||||
* (e.g. "foo.png.bz2") */
|
* (e.g. "foo.png.bz2") */
|
||||||
for (s = im->real_file, p = q = NULL; *s; s++)
|
for (p = s = im->real_file, q = NULL; *s; s++)
|
||||||
{
|
{
|
||||||
if (*s != '.')
|
if (*s != '.' && *s != '/')
|
||||||
continue;
|
continue;
|
||||||
q = p;
|
q = p;
|
||||||
p = s;
|
p = s + 1;
|
||||||
}
|
}
|
||||||
if (!q || q == im->real_file || strcasecmp(p + 1, "bz2"))
|
if (!q || strcasecmp(p, "bz2"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(real_ext = strndup(q + 1, p - q - 1)))
|
if (!(real_ext = strndup(q, p - q - 1)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
loader = __imlib_FindBestLoaderForFormat(real_ext, 0);
|
loader = __imlib_FindBestLoaderForFormat(real_ext, 0);
|
||||||
|
|
|
@ -50,17 +50,17 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
||||||
|
|
||||||
/* make sure this file ends in ".gz" and that there's another ext
|
/* make sure this file ends in ".gz" and that there's another ext
|
||||||
* (e.g. "foo.png.gz") */
|
* (e.g. "foo.png.gz") */
|
||||||
for (s = im->real_file, p = q = NULL; *s; s++)
|
for (p = s = im->real_file, q = NULL; *s; s++)
|
||||||
{
|
{
|
||||||
if (*s != '.')
|
if (*s != '.' && *s != '/')
|
||||||
continue;
|
continue;
|
||||||
q = p;
|
q = p;
|
||||||
p = s;
|
p = s + 1;
|
||||||
}
|
}
|
||||||
if (!q || q == im->real_file || strcasecmp(p + 1, "gz"))
|
if (!q || strcasecmp(p, "gz"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(real_ext = strndup(q + 1, p - q - 1)))
|
if (!(real_ext = strndup(q, p - q - 1)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
loader = __imlib_FindBestLoaderForFormat(real_ext, 0);
|
loader = __imlib_FindBestLoaderForFormat(real_ext, 0);
|
||||||
|
|
Loading…
Reference in New Issue