summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-23 15:12:43 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-23 15:12:43 +0000
commitc051eda02824b48000b87e0507b36ed1fda9ff76 (patch)
tree25ba53b7ef2b28c81801a2b51bb11cc842fc4cc5 /apps
parenta17df38de7370cf73041a45a2847657719f3f4a4 (diff)
downloadrockbox-c051eda02824b48000b87e0507b36ed1fda9ff76.tar.gz
rockbox-c051eda02824b48000b87e0507b36ed1fda9ff76.zip
Added strcasecmp() to the plugin API
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4925 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h3
-rw-r--r--apps/plugins/search.c14
3 files changed, 5 insertions, 13 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 93302f31e4..7e5f4866cf 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -256,6 +256,7 @@ static const struct plugin_api rockbox_api = {
256 button_status, 256 button_status,
257 button_clear_queue, 257 button_clear_queue,
258 strncpy, 258 strncpy,
259 strcasecmp,
259}; 260};
260 261
261int plugin_load(char* plugin, void* parameter) 262int plugin_load(char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 06a31ade37..1ed2a9baef 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -60,7 +60,7 @@
60#endif 60#endif
61 61
62/* increase this every time the api struct changes */ 62/* increase this every time the api struct changes */
63#define PLUGIN_API_VERSION 22 63#define PLUGIN_API_VERSION 23
64 64
65/* update this to latest version if a change to the api struct breaks 65/* update this to latest version if a change to the api struct breaks
66 backwards compatibility (and please take the opportunity to sort in any 66 backwards compatibility (and please take the opportunity to sort in any
@@ -292,6 +292,7 @@ struct plugin_api {
292 int (*button_status)(void); 292 int (*button_status)(void);
293 void (*button_clear_queue)(void); 293 void (*button_clear_queue)(void);
294 char *(*strncpy)(char *dst, const char *src, size_t length); 294 char *(*strncpy)(char *dst, const char *src, size_t length);
295 int (*strcasecmp)(const char *, const char *);
295}; 296};
296 297
297/* defined by the plugin loader (plugin.c) */ 298/* defined by the plugin loader (plugin.c) */
diff --git a/apps/plugins/search.c b/apps/plugins/search.c
index 55f65f2b2a..8eb13c5842 100644
--- a/apps/plugins/search.c
+++ b/apps/plugins/search.c
@@ -40,16 +40,6 @@ static int line_end; /* Index of the end of line */
40char resultfile[MAX_PATH]; 40char resultfile[MAX_PATH];
41char path[MAX_PATH]; 41char path[MAX_PATH];
42 42
43static int strpcasecmp(const char *s1, const char *s2)
44{
45 while (*s1 != '\0' && tolower(*s1) == tolower(*s2)) {
46 s1++;
47 s2++;
48 }
49
50 return (*s1 == '\0') ;
51}
52
53static void fill_buffer(int pos) 43static void fill_buffer(int pos)
54{ 44{
55 int numread; 45 int numread;
@@ -94,7 +84,7 @@ static void fill_buffer(int pos)
94 default: 84 default:
95 if (!found && tolower(buffer[i]) == tolower(search_string[0])) 85 if (!found && tolower(buffer[i]) == tolower(search_string[0]))
96 { 86 {
97 found = strpcasecmp(&search_string[0],&buffer[i]) ; 87 found = rb->strcasecmp(&search_string[0],&buffer[i]) ;
98 } 88 }
99 break; 89 break;
100 } 90 }
@@ -152,7 +142,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
152 rb = api; 142 rb = api;
153 143
154 /* Check the extension. We only allow .m3u files. */ 144 /* Check the extension. We only allow .m3u files. */
155 if(!strpcasecmp(&filename[rb->strlen(filename)-4], ".m3u")) { 145 if(!rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u")) {
156 rb->splash(HZ, true, "Not a .m3u file"); 146 rb->splash(HZ, true, "Not a .m3u file");
157 return PLUGIN_ERROR; 147 return PLUGIN_ERROR;
158 } 148 }