Count hits... string searches appear to be broken for now, unsure why,

maybe something goes wrong when allocating ram for the strings..


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6373 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michiel Van Der Kolk 2005-04-28 16:39:41 +00:00
parent 29909a341a
commit c099300c8d
3 changed files with 20 additions and 6 deletions

View file

@ -149,10 +149,18 @@ unsigned char *parseCompareString() {
return 0;
}
contains=currentToken->kind==TOKEN_CONTAINS;
if(currentToken->kind==TOKEN_CONTAINS ||
currentToken->kind==TOKEN_EQUALS)
currentToken->kind==TOKEN_EQUALS) {
if(currentToken->kind==TOKEN_CONTAINS) {
contains=1;
PUTS("Contains");
}
else {
contains=0;
PUTS("Equals");
}
parser_acceptIt();
}
else {
syntaxerror=1;
rb->snprintf(errormsg,250,"'%d' found where CONTAINS/EQUALS expected\n",currentToken->kind);

View file

@ -54,7 +54,7 @@ void setmallocpos(void *pointer)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
unsigned char *result,buf[500];
int parsefd;
int parsefd,hits;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
@ -78,14 +78,20 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->snprintf(buf,250,"Retval: 0x%x",result);
PUTS(buf);
rb->close(parsefd);
hits=0;
if(result!=0) {
int fd=rb->open("/search.m3u", O_WRONLY|O_CREAT|O_TRUNC);
int i;
for(i=0;i<rb->tagdbheader->filecount;i++)
if(result[i])
if(result[i]) {
hits++;
rb->fdprintf(fd,"%s\n",getfilename(i));
}
/* rb->write(fd,result,rb->tagdbheader->filecount);*/
rb->close(fd);
}
rb->snprintf(buf,250,"Hits: %d",hits);
PUTS(buf);
rb->sleep(HZ*3);
return PLUGIN_OK;
}

View file

@ -51,7 +51,7 @@
struct token {
unsigned char kind;
char spelling[256];
int intvalue;
long intvalue;
};
char *getstring(struct token *token);