Better error messenging. less crashes. good.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6389 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michiel Van Der Kolk 2005-04-29 23:57:50 +00:00
parent fe708f22d5
commit a9e4555b6f

View file

@ -21,6 +21,7 @@
#include "dbinterface.h" #include "dbinterface.h"
char *getstring(struct token *token) { char *getstring(struct token *token) {
char buf[200];
switch(token->kind) { switch(token->kind) {
case TOKEN_STRING: case TOKEN_STRING:
return token->spelling; return token->spelling;
@ -41,18 +42,21 @@ char *getstring(struct token *token) {
case INTVALUE_FILENAME: case INTVALUE_FILENAME:
return currententry->filename; return currententry->filename;
default: default:
rb->splash(HZ*2,true,"unknown stringid intvalue"); rb->snprintf(buf,199,"unknown stringid intvalue %d",token->intvalue);
return 0; rb->splash(HZ*2,true,buf);
return "";
} }
break; break;
default: default:
// report error // report error
rb->splash(HZ*2,true,"unknown token..."); rb->snprintf(buf,199,"unknown token %d in getstring..",token->kind);
return 0; rb->splash(HZ*2,true,buf);
return "";
} }
} }
int getvalue(struct token *token) { int getvalue(struct token *token) {
char buf[200];
switch(token->kind) { switch(token->kind) {
case TOKEN_NUM: case TOKEN_NUM:
return token->intvalue; return token->intvalue;
@ -68,12 +72,14 @@ int getvalue(struct token *token) {
loadrundbdata(); loadrundbdata();
return currententry->playcount; return currententry->playcount;
default: default:
rb->splash(HZ*2,true,"unknown numid intvalue"); rb->snprintf(buf,199,"unknown numid intvalue %d",token->intvalue);
rb->splash(HZ*2,true,buf);
// report error. // report error.
return 0; return 0;
} }
default: default:
rb->splash(HZ*2,true,"unknown token..."); rb->snprintf(buf,199,"unknown token %d in getvalue..",token->kind);
rb->splash(HZ*2,true,buf);
return 0; return 0;
} }
} }