diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/font.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/font.c b/firmware/font.c index baaec13d3c..ffa5855d10 100644 --- a/firmware/font.c +++ b/firmware/font.c | |||
@@ -724,7 +724,6 @@ load_cache_entry(struct font_cache_entry* p, void* callback_data) | |||
724 | struct font* pf = callback_data; | 724 | struct font* pf = callback_data; |
725 | 725 | ||
726 | unsigned short char_code = p->_char_code; | 726 | unsigned short char_code = p->_char_code; |
727 | unsigned char tmp[2]; | ||
728 | int fd; | 727 | int fd; |
729 | 728 | ||
730 | lock_font_handle(pf->handle, true); | 729 | lock_font_handle(pf->handle, true); |
@@ -755,11 +754,14 @@ load_cache_entry(struct font_cache_entry* p, void* callback_data) | |||
755 | else | 754 | else |
756 | fd = pf->fd; | 755 | fd = pf->fd; |
757 | lseek(fd, offset, SEEK_SET); | 756 | lseek(fd, offset, SEEK_SET); |
758 | read (fd, tmp, 2); | 757 | unsigned char tmp[2]; |
759 | bitmap_offset = tmp[0] | (tmp[1] << 8); | 758 | if (read (fd, tmp, 2) == 2) |
760 | if (pf->long_offset) { | 759 | { |
761 | read (fd, tmp, 2); | 760 | bitmap_offset = tmp[0] | (tmp[1] << 8); |
762 | bitmap_offset |= (tmp[0] << 16) | (tmp[1] << 24); | 761 | if (pf->long_offset) { |
762 | if (read (fd, tmp, 2) == 2) | ||
763 | bitmap_offset |= (tmp[0] << 16) | (tmp[1] << 24); | ||
764 | } | ||
763 | } | 765 | } |
764 | } | 766 | } |
765 | else | 767 | else |