summaryrefslogtreecommitdiff
path: root/extmod
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-07-28 13:29:47 -0400
committerDan Halbert <halbert@halwitz.org>2018-07-28 13:29:47 -0400
commitf48b70050e3e4122eaae3eee47d35fc30bda2a4c (patch)
tree7d2dacc3c137276e9d0838b571c84c09e78acc42 /extmod
parentbc760dd34100099c352a0f185ec54ceae23d036d (diff)
merge finished
Diffstat (limited to 'extmod')
-rw-r--r--extmod/moduhashlib.c16
-rw-r--r--extmod/vfs_fat.h9
-rw-r--r--extmod/vfs_fat_diskio.c6
3 files changed, 12 insertions, 19 deletions
diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c
index 6389455c0..5e14fc8d4 100644
--- a/extmod/moduhashlib.c
+++ b/extmod/moduhashlib.c
@@ -29,14 +29,6 @@
#include "py/runtime.h"
-static void check_not_unicode(const mp_obj_t arg) {
-#if MICROPY_CPYTHON_COMPAT
- if (MP_OBJ_IS_STR(arg)) {
- mp_raise_TypeError("a bytes-like object is required");
- }
-#endif
-}
-
#if MICROPY_PY_UHASHLIB
#if MICROPY_PY_UHASHLIB_SHA256
@@ -102,6 +94,14 @@ STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
#else
+static void check_not_unicode(const mp_obj_t arg) {
+#if MICROPY_CPYTHON_COMPAT
+ if (MP_OBJ_IS_STR(arg)) {
+ mp_raise_TypeError("a bytes-like object is required");
+ }
+#endif
+}
+
STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(CRYAL_SHA256_CTX));
diff --git a/extmod/vfs_fat.h b/extmod/vfs_fat.h
index ded8bc885..dd5e5ffcb 100644
--- a/extmod/vfs_fat.h
+++ b/extmod/vfs_fat.h
@@ -60,15 +60,6 @@ typedef struct _pyb_file_obj_t {
FIL fp;
} pyb_file_obj_t;
-
-// These should be general types (mpy TOOD says so). In micropython, these are defined in
-// mpconfigport.h.
-////////////#define mp_type_fileio mp_type_vfs_fat_fileio
-////////////#define mp_type_textio mp_type_vfs_fat_textio
-
-////////////extern const mp_obj_type_t mp_type_fileio;
-////////////extern const mp_obj_type_t mp_type_textio;
-
extern const byte fresult_to_errno_table[20];
extern const mp_obj_type_t mp_fat_vfs_type;
extern const mp_obj_type_t mp_type_vfs_fat_fileio;
diff --git a/extmod/vfs_fat_diskio.c b/extmod/vfs_fat_diskio.c
index 3b5c7d888..0e442d8fa 100644
--- a/extmod/vfs_fat_diskio.c
+++ b/extmod/vfs_fat_diskio.c
@@ -75,8 +75,9 @@ DRESULT disk_read (
return RES_ERROR;
}
} else {
+ mp_obj_array_t ar = {{&mp_type_bytearray}, BYTEARRAY_TYPECODE, 0, count * SECSIZE(&vfs->fatfs), buff};
vfs->readblocks[2] = MP_OBJ_NEW_SMALL_INT(sector);
- vfs->readblocks[3] = mp_obj_new_bytearray_by_ref(count * SECSIZE(&vfs->fatfs), buff);
+ vfs->readblocks[3] = MP_OBJ_FROM_PTR(&ar);
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
mp_obj_t ret = mp_call_method_n_kw(2, 0, vfs->readblocks);
@@ -120,8 +121,9 @@ DRESULT disk_write (
return RES_ERROR;
}
} else {
+ mp_obj_array_t ar = {{&mp_type_bytearray}, BYTEARRAY_TYPECODE, 0, count * SECSIZE(&vfs->fatfs), (void*)buff};
vfs->writeblocks[2] = MP_OBJ_NEW_SMALL_INT(sector);
- vfs->writeblocks[3] = mp_obj_new_bytearray_by_ref(count * SECSIZE(&vfs->fatfs), (void*)buff);
+ vfs->writeblocks[3] = MP_OBJ_FROM_PTR(&ar);
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
mp_obj_t ret = mp_call_method_n_kw(2, 0, vfs->writeblocks);