lang_load() returns an int to signal success
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2396 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
85305da20d
commit
2d8aef9ab7
2 changed files with 7 additions and 3 deletions
|
@ -25,12 +25,13 @@
|
|||
|
||||
static unsigned char language_buffer[MAX_LANGUAGE_SIZE];
|
||||
|
||||
void lang_load(char *filename)
|
||||
int lang_load(char *filename)
|
||||
{
|
||||
int filesize;
|
||||
int fd = open(filename, O_RDONLY);
|
||||
int retcode=0;
|
||||
if(fd == -1)
|
||||
return;
|
||||
return 1;
|
||||
filesize = read(fd, language_buffer, MAX_LANGUAGE_SIZE);
|
||||
if(filesize != MAX_LANGUAGE_SIZE) {
|
||||
if((language_buffer[0] == LANGUAGE_COOKIE) &&
|
||||
|
@ -53,12 +54,15 @@ void lang_load(char *filename)
|
|||
}
|
||||
else {
|
||||
DEBUGF("Illegal language file\n");
|
||||
retcode = 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
DEBUGF("Language %s too large: %d\n", filename, filesize);
|
||||
retcode = 3;
|
||||
}
|
||||
close(fd);
|
||||
return retcode;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define LANGUAGE_VERSION 0x01
|
||||
|
||||
/* load a given language file */
|
||||
void lang_load(char *filename);
|
||||
int lang_load(char *filename);
|
||||
|
||||
/* -----------------------------------------------------------------
|
||||
* local variables:
|
||||
|
|
Loading…
Reference in a new issue