summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/common/unicode.c3
-rw-r--r--firmware/font.c9
2 files changed, 5 insertions, 7 deletions
diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c
index 75165e49c7..83780393d5 100644
--- a/firmware/common/unicode.c
+++ b/firmware/common/unicode.c
@@ -62,8 +62,7 @@ int load_cp_table(int cp)
return 0;
}
- tablesize = lseek(file, 0, SEEK_END) / 2;
- lseek(file, 0, SEEK_SET);
+ tablesize = filesize(file) / 2;
if (tablesize > MAX_CP_TABLE_SIZE) {
DEBUGF("Invalid codepage file: %s.cp\n", filename[table-1]);
diff --git a/firmware/font.c b/firmware/font.c
index 5f244bcb37..5eb6f7450f 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -283,7 +283,7 @@ struct font* font_load_cached(struct font* pf)
/* read and load font into incore font structure*/
struct font* font_load(const char *path)
{
- int filesize;
+ int size;
struct font* pf = &font_ui;
/* save loaded glyphs */
@@ -302,8 +302,7 @@ struct font* font_load(const char *path)
}
/* Check file size */
- filesize = lseek(fnt_file, 0, SEEK_END);
- lseek(fnt_file, 0, SEEK_SET);
+ size = filesize(fnt_file);
font_reset();
@@ -312,7 +311,7 @@ struct font* font_load(const char *path)
fileptr = freeptr;
- if (filesize > MAX_FONT_SIZE)
+ if (size > MAX_FONT_SIZE)
{
read(fnt_file, fileptr, FONT_HEADER_SIZE);
eofptr = fileptr + FONT_HEADER_SIZE;
@@ -334,7 +333,7 @@ struct font* font_load(const char *path)
else
{
read(fnt_file, fileptr, MAX_FONT_SIZE);
- eofptr = fileptr + filesize;
+ eofptr = fileptr + size;
close(fnt_file);
fnt_file = -1;