aboutsummaryrefslogtreecommitdiff
path: root/py/binary.c
diff options
context:
space:
mode:
authorKaspar Schleiser <kaspar@schleiser.de>2015-05-10 13:04:38 +0200
committerDamien George <damien.p.george@gmail.com>2015-05-17 18:12:19 +0100
commitf5dd6f7f3707b67acbd1dbfe71cad2b958d5d7be (patch)
tree9829518592a339c44d0efbe40b394c1bcd4d3172 /py/binary.c
parentb5cef5c7ea2d4bf3564938a679756a8be8c00d39 (diff)
py/binary: Make return type of mp_binary_get_size size_t instead of int.
Fixes sign-compare warning.
Diffstat (limited to 'py/binary.c')
-rw-r--r--py/binary.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/binary.c b/py/binary.c
index ee00c4e34..9205018b5 100644
--- a/py/binary.c
+++ b/py/binary.c
@@ -40,8 +40,8 @@
#define alignof(type) offsetof(struct { char c; type t; }, t)
#endif
-int mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign) {
- int size = 0;
+size_t mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign) {
+ size_t size = 0;
int align = 1;
switch (struct_type) {
case '<': case '>':
@@ -179,7 +179,7 @@ mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte **ptr) {
byte *p = *ptr;
mp_uint_t align;
- int size = mp_binary_get_size(struct_type, val_type, &align);
+ size_t size = mp_binary_get_size(struct_type, val_type, &align);
if (struct_type == '@') {
// Make pointer aligned
p = (byte*)(((mp_uint_t)p + align - 1) & ~((mp_uint_t)align - 1));
@@ -244,7 +244,7 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **
byte *p = *ptr;
mp_uint_t align;
- int size = mp_binary_get_size(struct_type, val_type, &align);
+ size_t size = mp_binary_get_size(struct_type, val_type, &align);
if (struct_type == '@') {
// Make pointer aligned
p = (byte*)(((mp_uint_t)p + align - 1) & ~((mp_uint_t)align - 1));