summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Halbert <halbert@adafruit.com>2019-08-27 22:25:24 -0400
committerGitHub <noreply@github.com>2019-08-27 22:25:24 -0400
commit7cbae3d20c0f79511a932bbcb2d66d2620b6bb3a (patch)
treeeec94d5b3efb1be6a81563f5b24d753b625e76fb /lib
parent42956a62a3f6fb60ca37f669dce5cf865a1bed5f (diff)
parent0876d5c4adf9d7289123a51728aa8a372c4e2e7b (diff)
Merge pull request #2012 from tannewt/remove_i2c_stop_kwarg
Add writeto_then_readfrom to I2C API. Deprecate stop kwarg.
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/buffer_helper.c4
-rw-r--r--lib/utils/buffer_helper.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/utils/buffer_helper.c b/lib/utils/buffer_helper.c
index f6eb8bf1e..694952e3d 100644
--- a/lib/utils/buffer_helper.c
+++ b/lib/utils/buffer_helper.c
@@ -26,10 +26,10 @@
#include "lib/utils/buffer_helper.h"
-void normalize_buffer_bounds(int32_t* start, int32_t end, uint32_t* length) {
+void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length) {
if (end < 0) {
end += *length;
- } else if (((uint32_t) end) > *length) {
+ } else if (((size_t) end) > *length) {
end = *length;
}
if (*start < 0) {
diff --git a/lib/utils/buffer_helper.h b/lib/utils/buffer_helper.h
index 47042e7ef..7487b9df5 100644
--- a/lib/utils/buffer_helper.h
+++ b/lib/utils/buffer_helper.h
@@ -28,7 +28,8 @@
#define MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H
#include <stdint.h>
+#include <string.h>
-void normalize_buffer_bounds(int32_t* start, int32_t end, uint32_t* length);
+void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length);
#endif // MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H