diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-04 22:25:52 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-04 22:25:52 +0000 |
commit | 2a91a9a19eabbd38894bd08ac18250c97cb1f2cf (patch) | |
tree | 937261883bf713e42bb8a6ebe71dadf44c77e29e /apps | |
parent | 32d261e3f9b986f29356f63c1b4857eb6890a1b9 (diff) | |
download | rockbox-2a91a9a19eabbd38894bd08ac18250c97cb1f2cf.tar.gz rockbox-2a91a9a19eabbd38894bd08ac18250c97cb1f2cf.zip |
Use similiar constants in genlang and language.c.
- In the future, they should be united.
- Fix bug in max size calculation
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22930 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/language.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/language.c b/apps/language.c index 73ed0fe39b..bba1359616 100644 --- a/apps/language.c +++ b/apps/language.c @@ -31,10 +31,12 @@ language! */ #include "max_language_size.h" -/* both these must match the two initial bytes in the binary lang file */ -#define LANGUAGE_COOKIE 0x1a -#define LANGUAGE_VERSION 0x04 +/* These defines must match the initial bytes in the binary lang file */ +/* See tools/genlang (TODO: Use common include for both) */ +#define LANGUAGE_COOKIE 0x1a +#define LANGUAGE_VERSION 0x04 +#define HEADER_SIZE 3 static unsigned char language_buffer[MAX_LANGUAGE_SIZE]; @@ -54,12 +56,12 @@ int lang_load(const char *filename) int fsize; int fd = open(filename, O_RDONLY); int retcode=0; - unsigned char lang_header[3]; + unsigned char lang_header[HEADER_SIZE]; if(fd < 0) return 1; - fsize = filesize(fd) - 2; + fsize = filesize(fd) - HEADER_SIZE; if(fsize <= MAX_LANGUAGE_SIZE) { - read(fd, lang_header, 3); + read(fd, lang_header, HEADER_SIZE); if((lang_header[0] == LANGUAGE_COOKIE) && (lang_header[1] == LANGUAGE_VERSION) && (lang_header[2] == TARGET_ID)) { |