Mercurial > audlegacy-plugins
comparison src/demac/apev2.c @ 2188:2984f6c7221a
demac: tag reading routine now case-insensitive
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Sun, 25 Nov 2007 22:36:59 +0300 |
parents | cc5e9ec110a4 |
children | 80d7ab8f2ec5 |
comparison
equal
deleted
inserted
replaced
2187:9a7822a4762e | 2188:2984f6c7221a |
---|---|
49 #define TMP_BUFSIZE 256 | 49 #define TMP_BUFSIZE 256 |
50 #ifndef MIN | 50 #ifndef MIN |
51 #define MIN(a,b) ((a) < (b) ? (a) : (b)) | 51 #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
52 #endif | 52 #endif |
53 | 53 |
54 static gboolean strcase_equal (gconstpointer v1, gconstpointer v2) { | |
55 return (g_ascii_strcasecmp((gchar *)v1, (gchar *)v2) == 0); | |
56 } | |
57 | |
58 static guint strcase_hash (gconstpointer v) { | |
59 gchar *tmp; | |
60 gchar buf[TMP_BUFSIZE+1]; | |
61 gchar *p = buf; | |
62 | |
63 for(tmp=(gchar*)v; (*tmp && (p < buf+TMP_BUFSIZE)); tmp++) | |
64 *(p++) = g_ascii_toupper(*tmp); | |
65 *p = '\0'; | |
66 return g_str_hash((gconstpointer)buf); | |
67 } | |
68 | |
54 GHashTable* parse_apev2_tag(VFSFile *vfd) { | 69 GHashTable* parse_apev2_tag(VFSFile *vfd) { |
55 unsigned char tmp[TMP_BUFSIZE+1]; | 70 unsigned char tmp[TMP_BUFSIZE+1]; |
56 unsigned char tmp2[TMP_BUFSIZE+1]; | 71 unsigned char tmp2[TMP_BUFSIZE+1]; |
57 guint32 tag_version; | 72 guint32 tag_version; |
58 guint32 tag_size, item_size, item_flags; | 73 guint32 tag_size, item_size, item_flags; |
82 fprintf(stderr, "** demac: apev2.c: found empty tag\n"); | 97 fprintf(stderr, "** demac: apev2.c: found empty tag\n"); |
83 #endif | 98 #endif |
84 return NULL; | 99 return NULL; |
85 } | 100 } |
86 | 101 |
87 hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); /* string-keyed table with dynamically allocated keys and items */ | 102 hash = g_hash_table_new_full(strcase_hash, strcase_equal, g_free, g_free); /* string-keyed table with dynamically allocated keys and items */ |
88 | 103 |
89 aud_vfs_fseek(vfd, -tag_size, SEEK_END); | 104 aud_vfs_fseek(vfd, -tag_size, SEEK_END); |
90 int i; | 105 int i; |
91 unsigned char *p; | 106 unsigned char *p; |
92 for(i=0; i<tag_items; i++) { | 107 for(i=0; i<tag_items; i++) { |