mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Added strcasecmp() to the plugin API
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4925 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a17df38de7
commit
c051eda028
3 changed files with 5 additions and 13 deletions
|
@ -256,6 +256,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
button_status,
|
button_status,
|
||||||
button_clear_queue,
|
button_clear_queue,
|
||||||
strncpy,
|
strncpy,
|
||||||
|
strcasecmp,
|
||||||
};
|
};
|
||||||
|
|
||||||
int plugin_load(char* plugin, void* parameter)
|
int plugin_load(char* plugin, void* parameter)
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 22
|
#define PLUGIN_API_VERSION 23
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
|
@ -292,6 +292,7 @@ struct plugin_api {
|
||||||
int (*button_status)(void);
|
int (*button_status)(void);
|
||||||
void (*button_clear_queue)(void);
|
void (*button_clear_queue)(void);
|
||||||
char *(*strncpy)(char *dst, const char *src, size_t length);
|
char *(*strncpy)(char *dst, const char *src, size_t length);
|
||||||
|
int (*strcasecmp)(const char *, const char *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* defined by the plugin loader (plugin.c) */
|
/* defined by the plugin loader (plugin.c) */
|
||||||
|
|
|
@ -40,16 +40,6 @@ static int line_end; /* Index of the end of line */
|
||||||
char resultfile[MAX_PATH];
|
char resultfile[MAX_PATH];
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
static int strpcasecmp(const char *s1, const char *s2)
|
|
||||||
{
|
|
||||||
while (*s1 != '\0' && tolower(*s1) == tolower(*s2)) {
|
|
||||||
s1++;
|
|
||||||
s2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (*s1 == '\0') ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void fill_buffer(int pos)
|
static void fill_buffer(int pos)
|
||||||
{
|
{
|
||||||
int numread;
|
int numread;
|
||||||
|
@ -94,7 +84,7 @@ static void fill_buffer(int pos)
|
||||||
default:
|
default:
|
||||||
if (!found && tolower(buffer[i]) == tolower(search_string[0]))
|
if (!found && tolower(buffer[i]) == tolower(search_string[0]))
|
||||||
{
|
{
|
||||||
found = strpcasecmp(&search_string[0],&buffer[i]) ;
|
found = rb->strcasecmp(&search_string[0],&buffer[i]) ;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +142,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
rb = api;
|
rb = api;
|
||||||
|
|
||||||
/* Check the extension. We only allow .m3u files. */
|
/* Check the extension. We only allow .m3u files. */
|
||||||
if(!strpcasecmp(&filename[rb->strlen(filename)-4], ".m3u")) {
|
if(!rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u")) {
|
||||||
rb->splash(HZ, true, "Not a .m3u file");
|
rb->splash(HZ, true, "Not a .m3u file");
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue