Make ethumb match case-insensitive.

Ethumb wasn't matching files to plugins if the extension were not
composed of all lowercase chars. This patch makes the ethumb match
case-insensitive.

Patch by: João Paulo Rechi Vita



SVN revision: 43502
This commit is contained in:
Rafael Antognolli 2009-11-06 22:17:55 +00:00
parent 6310f0ef55
commit 755a5f7da6
1 changed files with 14 additions and 6 deletions

View File

@ -51,6 +51,7 @@ void *alloca (size_t);
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <ctype.h>
#ifndef PATH_MAX #ifndef PATH_MAX
# define PATH_MAX 4096 # define PATH_MAX 4096
@ -1060,20 +1061,26 @@ ethumb_calculate_fill(Ethumb *e, int iw, int ih, int *fx, int *fy, int *fw, int
static Eina_Bool static Eina_Bool
_ethumb_plugin_generate(Ethumb *e) _ethumb_plugin_generate(Ethumb *e)
{ {
const char *ext; const char *extp;
char ext[PATH_MAX];
Ethumb_Plugin *plugin; Ethumb_Plugin *plugin;
int i;
ext = strrchr(e->src_path, '.'); extp = strrchr(e->src_path, '.');
if (!ext) if (!extp)
{ {
ERR("could not get extension for file \"%s\"", e->src_path); ERR("could not get extension for file \"%s\"", e->src_path);
return EINA_FALSE; return EINA_FALSE;
} }
plugin = eina_hash_find(_plugins_ext, ext + 1); for (i = 0; extp[i] != '\0'; i++)
ext[i] = tolower(extp[i + 1]);
plugin = eina_hash_find(_plugins_ext, ext);
if (!plugin) if (!plugin)
{ {
DBG("no plugin for extension: \"%s\"", ext + 1); DBG("no plugin for extension: \"%s\"", ext);
free(ext);
return EINA_FALSE; return EINA_FALSE;
} }
@ -1151,7 +1158,8 @@ ethumb_image_save(Ethumb *e)
if (!r) if (!r)
{ {
ERR("could not save image."); ERR("could not save image: path=%s, key=%s", e->thumb_path,
e->thumb_key);
return EINA_FALSE; return EINA_FALSE;
} }