summaryrefslogtreecommitdiffstatshomepage
path: root/py/modstruct.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2020-03-02 22:35:22 +1100
committerDamien George <damien.p.george@gmail.com>2020-04-05 15:02:06 +1000
commitdef76fe4d9bbc2c342594dc05861b24d7165d274 (patch)
treed04ad778e2421de0a85835227ba5bcb08562ec24 /py/modstruct.c
parent85858e72dfdc3e941c2e620e94de05ad663138b1 (diff)
downloadmicropython-def76fe4d9bbc2c342594dc05861b24d7165d274.tar.gz
micropython-def76fe4d9bbc2c342594dc05861b24d7165d274.zip
all: Use MP_ERROR_TEXT for all error messages.
Diffstat (limited to 'py/modstruct.c')
-rw-r--r--py/modstruct.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/modstruct.c b/py/modstruct.c
index caf0ad9a38..4cbcad6d49 100644
--- a/py/modstruct.c
+++ b/py/modstruct.c
@@ -141,7 +141,7 @@ STATIC mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *args) {
// negative offsets are relative to the end of the buffer
offset = bufinfo.len + offset;
if (offset < 0) {
- mp_raise_ValueError("buffer too small");
+ mp_raise_ValueError(MP_ERROR_TEXT("buffer too small"));
}
}
p += offset;
@@ -150,7 +150,7 @@ STATIC mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *args) {
// Check that the input buffer is big enough to unpack all the values
if (p + total_sz > end_p) {
- mp_raise_ValueError("buffer too small");
+ mp_raise_ValueError(MP_ERROR_TEXT("buffer too small"));
}
for (size_t i = 0; i < num_items;) {
@@ -232,7 +232,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) {
// negative offsets are relative to the end of the buffer
offset = (mp_int_t)bufinfo.len + offset;
if (offset < 0) {
- mp_raise_ValueError("buffer too small");
+ mp_raise_ValueError(MP_ERROR_TEXT("buffer too small"));
}
}
byte *p = (byte *)bufinfo.buf;
@@ -242,7 +242,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) {
// Check that the output buffer is big enough to hold all the values
mp_int_t sz = MP_OBJ_SMALL_INT_VALUE(struct_calcsize(args[0]));
if (p + sz > end_p) {
- mp_raise_ValueError("buffer too small");
+ mp_raise_ValueError(MP_ERROR_TEXT("buffer too small"));
}
struct_pack_into_internal(args[0], p, n_args - 3, &args[3]);