mirror of
https://github.com/simon987/sist2.git
synced 2025-12-13 23:39:04 +00:00
Initial commit (squashed)
This commit is contained in:
20
src/parsing/mime.c
Normal file
20
src/parsing/mime.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "mime.h"
|
||||
|
||||
unsigned int mime_get_mime_by_ext(GHashTable *ext_table, const char * ext) {
|
||||
char lower[64];
|
||||
char *p = lower;
|
||||
while ((*ext)) {
|
||||
*p++ = (char)tolower(*ext++);
|
||||
}
|
||||
*p = '\0';
|
||||
return (size_t) g_hash_table_lookup(ext_table, lower);
|
||||
}
|
||||
|
||||
unsigned int mime_get_mime_by_string(GHashTable *mime_table, const char * str) {
|
||||
|
||||
const char * ptr = str;
|
||||
while (*ptr == ' ' || *ptr == '[') {
|
||||
ptr++;
|
||||
}
|
||||
return (size_t) g_hash_table_lookup(mime_table, ptr);
|
||||
}
|
||||
Reference in New Issue
Block a user