summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/lexerfatfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/lexerfatfs.c')
-rw-r--r--stmhal/lexerfatfs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/stmhal/lexerfatfs.c b/stmhal/lexerfatfs.c
index c578b13af6..21e3a2007e 100644
--- a/stmhal/lexerfatfs.c
+++ b/stmhal/lexerfatfs.c
@@ -36,20 +36,20 @@
typedef struct _mp_lexer_file_buf_t {
FIL fp;
- char buf[20];
+ byte buf[20];
uint16_t len;
uint16_t pos;
} mp_lexer_file_buf_t;
-static unichar file_buf_next_char(mp_lexer_file_buf_t *fb) {
+STATIC mp_uint_t file_buf_next_byte(mp_lexer_file_buf_t *fb) {
if (fb->pos >= fb->len) {
if (fb->len < sizeof(fb->buf)) {
- return MP_LEXER_CHAR_EOF;
+ return MP_LEXER_EOF;
} else {
UINT n;
f_read(&fb->fp, fb->buf, sizeof(fb->buf), &n);
if (n == 0) {
- return MP_LEXER_CHAR_EOF;
+ return MP_LEXER_EOF;
}
fb->len = n;
fb->pos = 0;
@@ -58,7 +58,7 @@ static unichar file_buf_next_char(mp_lexer_file_buf_t *fb) {
return fb->buf[fb->pos++];
}
-static void file_buf_close(mp_lexer_file_buf_t *fb) {
+STATIC void file_buf_close(mp_lexer_file_buf_t *fb) {
f_close(&fb->fp);
m_del_obj(mp_lexer_file_buf_t, fb);
}
@@ -74,5 +74,5 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
f_read(&fb->fp, fb->buf, sizeof(fb->buf), &n);
fb->len = n;
fb->pos = 0;
- return mp_lexer_new(qstr_from_str(filename), fb, (mp_lexer_stream_next_char_t)file_buf_next_char, (mp_lexer_stream_close_t)file_buf_close);
+ return mp_lexer_new(qstr_from_str(filename), fb, (mp_lexer_stream_next_byte_t)file_buf_next_byte, (mp_lexer_stream_close_t)file_buf_close);
}