[libbluray-devel] Use lower case letters for language codes
hpi1
git at videolan.org
Sat May 7 09:44:47 CEST 2011
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri May 6 15:13:08 2011 +0300| [ed7ec2db940e2999b2b7e355e599bed3383d3f8a] | committer: hpi1
Use lower case letters for language codes
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=ed7ec2db940e2999b2b7e355e599bed3383d3f8a
---
src/libbluray/bdnav/meta_parse.c | 5 +++--
src/util/strutl.c | 9 +++++++++
src/util/strutl.h | 1 +
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/libbluray/bdnav/meta_parse.c b/src/libbluray/bdnav/meta_parse.c
index 6bc31b9..7c9b280 100644
--- a/src/libbluray/bdnav/meta_parse.c
+++ b/src/libbluray/bdnav/meta_parse.c
@@ -117,6 +117,7 @@ static void _findMetaXMLfiles(META_ROOT *meta, const char *device_path)
meta->dl_entries[i].filename = str_printf("%s", ent.d_name);
strncpy(meta->dl_entries[i].language_code, ent.d_name+5,3);
meta->dl_entries[i].language_code[3] = '\0';
+ str_tolower(meta->dl_entries[i].language_code);
}
}
dir_close(dir);
@@ -190,7 +191,7 @@ META_DL *meta_get(META_ROOT *meta_root, const char *language_code)
if (language_code) {
for (i = 0; i < meta_root->dl_count; i++) {
- if (strcasecmp(language_code, meta_root->dl_entries[i].language_code) == 0) {
+ if (strcmp(language_code, meta_root->dl_entries[i].language_code) == 0) {
return &meta_root->dl_entries[i];
}
}
@@ -198,7 +199,7 @@ META_DL *meta_get(META_ROOT *meta_root, const char *language_code)
}
for (i = 0; i < meta_root->dl_count; i++) {
- if (strcasecmp(DEFAULT_LANGUAGE, meta_root->dl_entries[i].language_code) == 0) {
+ if (strcmp(DEFAULT_LANGUAGE, meta_root->dl_entries[i].language_code) == 0) {
BD_DEBUG(DBG_DIR, "using default disclib language '"DEFAULT_LANGUAGE"'\n");
return &meta_root->dl_entries[i];
}
diff --git a/src/util/strutl.c b/src/util/strutl.c
index acc4b06..8330280 100644
--- a/src/util/strutl.c
+++ b/src/util/strutl.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
+#include <ctype.h>
char * str_printf(const char *fmt, ...)
{
@@ -78,3 +79,11 @@ uint32_t str_to_uint32(const char *s, int n)
return val;
}
+
+void str_tolower(char *s)
+{
+ while (*s) {
+ *s = tolower(*s);
+ s++;
+ }
+}
diff --git a/src/util/strutl.h b/src/util/strutl.h
index aa00095..4e87b4f 100644
--- a/src/util/strutl.h
+++ b/src/util/strutl.h
@@ -27,5 +27,6 @@
BD_PRIVATE char * str_printf(const char *fmt, ...) BD_ATTR_FORMAT_PRINTF(1,2) BD_ATTR_MALLOC;
BD_PRIVATE uint32_t str_to_uint32(const char *s, int n);
+BD_PRIVATE void str_tolower(char *s);
#endif // STRUTL_H_
More information about the libbluray-devel
mailing list