summaryrefslogtreecommitdiff
path: root/apps/filetypes.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/filetypes.c')
-rw-r--r--apps/filetypes.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 30ab2c34e5..721d5326ea 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -209,18 +209,20 @@ bool filetype_supported(int attr)
209} 209}
210 210
211/* get the "dynamic" attribute for an extension */ 211/* get the "dynamic" attribute for an extension */
212int filetype_get_attr(char* name) 212int filetype_get_attr(const char* name)
213{ 213{
214 int i; 214 int i;
215 char *cp; 215 const char *cp = strrchr(name,'.');
216
217 if (!cp) /* no extension? -> can't be a supported type */
218 return 0;
219 cp++;
216 220
217 for (i=0; i < cnt_exttypes; i++) 221 for (i=0; i < cnt_exttypes; i++)
218 { 222 {
219 if (exttypes[i].extension) 223 if (exttypes[i].extension)
220 { 224 {
221 cp=strrchr(name,'.'); 225 if (!strcasecmp(cp,exttypes[i].extension))
222 if (cp) cp++;
223 if ((!strcasecmp(cp,exttypes[i].extension)) && (cp))
224 { 226 {
225 return ((((unsigned long)exttypes[i].type - 227 return ((((unsigned long)exttypes[i].type -
226 (unsigned long)&filetypes[0]) / 228 (unsigned long)&filetypes[0]) /