diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-09 01:28:31 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-03-09 01:28:31 +0900 |
| commit | ee57789c724cb8bb86ebeda2dfd2ef585e996f68 (patch) | |
| tree | 88ac5cdfa6e37967467ee13fc7b39794e4b7e6c5 /include | |
| parent | 452bf73c2317cc4c9cf69b4dbf3ff82c3bde89c3 (diff) | |
| parent | 270d25bf2db157c9d1cdcc57bccefabbb1341524 (diff) | |
| download | mruby-ee57789c724cb8bb86ebeda2dfd2ef585e996f68.tar.gz mruby-ee57789c724cb8bb86ebeda2dfd2ef585e996f68.zip | |
Merge pull request #1831 from monaka/pr-make-type-casts-safer
Make type casts safer
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby/dump.h | 6 | ||||
| -rw-r--r-- | include/mruby/string.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/mruby/dump.h b/include/mruby/dump.h index 69fd776b3..35546f9de 100644 --- a/include/mruby/dump.h +++ b/include/mruby/dump.h @@ -92,14 +92,14 @@ struct rite_binary_footer { RITE_SECTION_HEADER; }; -static inline int +static inline size_t uint8_to_bin(uint8_t s, uint8_t *bin) { *bin = s; return sizeof(uint8_t); } -static inline int +static inline size_t uint16_to_bin(uint16_t s, uint8_t *bin) { *bin++ = (s >> 8) & 0xff; @@ -107,7 +107,7 @@ uint16_to_bin(uint16_t s, uint8_t *bin) return sizeof(uint16_t); } -static inline int +static inline size_t uint32_to_bin(uint32_t l, uint8_t *bin) { *bin++ = (l >> 24) & 0xff; diff --git a/include/mruby/string.h b/include/mruby/string.h index 9ccbae56c..8a26192e6 100644 --- a/include/mruby/string.h +++ b/include/mruby/string.h @@ -15,7 +15,7 @@ extern "C" { extern const char mrb_digitmap[]; -#define RSTRING_EMBED_LEN_MAX (sizeof(void*) * 3 - 1) +#define RSTRING_EMBED_LEN_MAX ((mrb_int)(sizeof(void*) * 3 - 1)) struct RString { MRB_OBJECT_HEADER; |
