Use ptrdiff_t to avoid conversion warnings.

Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/42694aa7
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/42694aa7
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/42694aa7

Branch: refs/heads/master
Commit: 42694aa7ce4f94a88c7ffc6359bde4d740f26a33
Parents: fec8c52
Author: Marvin Humphrey <[email protected]>
Authored: Thu Apr 21 16:57:57 2016 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Thu Apr 21 16:57:57 2016 -0700

----------------------------------------------------------------------
 core/Lucy/Util/NumberUtils.cfh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/42694aa7/core/Lucy/Util/NumberUtils.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/NumberUtils.cfh b/core/Lucy/Util/NumberUtils.cfh
index 939708a..8dcab45 100644
--- a/core/Lucy/Util/NumberUtils.cfh
+++ b/core/Lucy/Util/NumberUtils.cfh
@@ -337,7 +337,7 @@ lucy_NumUtil_encode_cu32(uint32_t value, char **out_buf) {
     uint8_t   buf[LUCY_NUMUTIL_CU32_MAX_BYTES];
     uint8_t  *const limit = buf + sizeof(buf);
     uint8_t  *ptr         = limit - 1;
-    int       num_bytes;
+    ptrdiff_t num_bytes;
     /* Write last byte first, which has no continue bit. */
     *ptr = value & 0x7f;
     value >>= 7;
@@ -347,7 +347,7 @@ lucy_NumUtil_encode_cu32(uint32_t value, char **out_buf) {
         value >>= 7;
     }
     num_bytes = limit - ptr;
-    memcpy(*out_buf, ptr, num_bytes);
+    memcpy(*out_buf, ptr, (size_t)num_bytes);
     *out_buf += num_bytes;
 }
 
@@ -361,7 +361,7 @@ lucy_NumUtil_encode_cu64(uint64_t value, char **out_buf) {
     uint8_t   buf[LUCY_NUMUTIL_CU64_MAX_BYTES];
     uint8_t  *const limit = buf + sizeof(buf);
     uint8_t  *ptr         = limit - 1;
-    int       num_bytes;
+    ptrdiff_t num_bytes;
     /* Write last byte first, which has no continue bit. */
     *ptr = value & 0x7f;
     value >>= 7;
@@ -371,7 +371,7 @@ lucy_NumUtil_encode_cu64(uint64_t value, char **out_buf) {
         value >>= 7;
     }
     num_bytes = limit - ptr;
-    memcpy(*out_buf, ptr, num_bytes);
+    memcpy(*out_buf, ptr, (size_t)num_bytes);
     *out_buf += num_bytes;
 }
 

Reply via email to