Skip to content

Commit 886285c

Browse files
committed
fix vfs_fat build errors
1 parent 23ad19f commit 886285c

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

extmod/vfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ mp_obj_t mp_vfs_getcwd(void) {
361361
if (!(cwd[0] == '/' && cwd[1] == 0)) {
362362
vstr_add_str(&vstr, cwd);
363363
}
364-
return mp_obj_new_str_from_vstr(&mp_type_str, &vstr);
364+
return mp_obj_new_str_from_vstr(&vstr);
365365
}
366366
MP_DEFINE_CONST_FUN_OBJ_0(mp_vfs_getcwd_obj, mp_vfs_getcwd);
367367

extmod/vfs_fat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(fat_vfs_mkfs_obj, MP_ROM_PTR(&fat_vfs_mk
136136
typedef struct _mp_vfs_fat_ilistdir_it_t {
137137
mp_obj_base_t base;
138138
mp_fun_1_t iternext;
139+
mp_fun_1_t finaliser;
139140
bool is_str;
140141
FF_DIR dir;
141142
} mp_vfs_fat_ilistdir_it_t;

extmod/vfs_fat_file.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_i
205205

206206
const mp_obj_type_t *type = &mp_type_vfs_fat_textio;
207207
int mode = 0;
208-
const char *mode_s = mp_obj_str_get_str(args[1].u_obj);
208+
const char *mode_s = mp_obj_str_get_str(mode_in);
209209
uint32_t rwxa_count = 0;
210210
uint32_t bt_count = 0;
211211
uint32_t plus_count = 0;
@@ -252,20 +252,20 @@ STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_i
252252
mp_arg_error_invalid(MP_QSTR_mode);
253253
}
254254

255-
assert(vfs != NULL);
256-
if ((mode & FA_WRITE) != 0 && !filesystem_is_writable_by_python(vfs)) {
255+
assert(self != NULL);
256+
if ((mode & FA_WRITE) != 0 && !filesystem_is_writable_by_python(self)) {
257257
mp_raise_OSError(MP_EROFS);
258258
}
259259

260260

261261
pyb_file_obj_t *o = m_new_obj_with_finaliser(pyb_file_obj_t);
262262
o->base.type = type;
263263

264-
const char *fname = mp_obj_str_get_str(args[0].u_obj);
265-
FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode);
264+
const char *fname = mp_obj_str_get_str(path_in);
265+
FRESULT res = f_open(&self->fatfs, &o->fp, fname, mode);
266266
if (res != FR_OK) {
267267
m_del_obj(pyb_file_obj_t, o);
268-
mp_raise_OSError_errno_str(fresult_to_errno_table[res], args[0].u_obj);
268+
mp_raise_OSError_errno_str(fresult_to_errno_table[res], path_in);
269269
}
270270
// CIRCUITPY does fast seek.
271271
// If we're reading, turn on fast seek.

0 commit comments

Comments
 (0)