Fix warnings regarding NumUtil array manip.

Make appropriate casts or other adjustments to avoid warnings with
regards to NumUtil 1-bit, 2-bit and 4-bit integer array manipulation
routines.


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

Branch: refs/heads/master
Commit: dd6e79c9e36f9ff13c64609dd9aad9feec748b09
Parents: a311c31
Author: Marvin Humphrey <mar...@rectangular.com>
Authored: Thu Apr 21 18:11:59 2016 -0700
Committer: Marvin Humphrey <mar...@rectangular.com>
Committed: Thu Apr 21 18:11:59 2016 -0700

----------------------------------------------------------------------
 core/Lucy/Index/SortCache.c           | 6 +++---
 core/Lucy/Index/SortFieldWriter.c     | 8 ++++----
 core/Lucy/Test/Util/TestNumberUtils.c | 9 ++++-----
 3 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/dd6e79c9/core/Lucy/Index/SortCache.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortCache.c b/core/Lucy/Index/SortCache.c
index fe25049..cbfe8ea 100644
--- a/core/Lucy/Index/SortCache.c
+++ b/core/Lucy/Index/SortCache.c
@@ -71,9 +71,9 @@ SortCache_Ordinal_IMP(SortCache *self, int32_t doc_id) {
         THROW(ERR, "Out of range: %i32 > %i32", doc_id, ivars->doc_max);
     }
     switch (ivars->ord_width) {
-        case 1: return NumUtil_u1get(ivars->ords, doc_id);
-        case 2: return NumUtil_u2get(ivars->ords, doc_id);
-        case 4: return NumUtil_u4get(ivars->ords, doc_id);
+        case 1: return NumUtil_u1get(ivars->ords, (uint32_t)doc_id);
+        case 2: return NumUtil_u2get(ivars->ords, (uint32_t)doc_id);
+        case 4: return NumUtil_u4get(ivars->ords, (uint32_t)doc_id);
         case 8: {
                 uint8_t *ints = (uint8_t*)ivars->ords;
                 return ints[doc_id];

http://git-wip-us.apache.org/repos/asf/lucy/blob/dd6e79c9/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c 
b/core/Lucy/Index/SortFieldWriter.c
index 4118ece..72cc599 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -223,14 +223,14 @@ static void
 S_write_ord(void *ords, int32_t width, int32_t doc_id, int32_t ord) {
     switch (width) {
         case 1:
-            if (ord) { NumUtil_u1set(ords, doc_id); }
-            else     { NumUtil_u1clear(ords, doc_id); }
+            if (ord) { NumUtil_u1set(ords, (uint32_t)doc_id); }
+            else     { NumUtil_u1clear(ords, (uint32_t)doc_id); }
             break;
         case 2:
-            NumUtil_u2set(ords, doc_id, ord);
+            NumUtil_u2set(ords, (uint32_t)doc_id, (uint8_t)ord);
             break;
         case 4:
-            NumUtil_u4set(ords, doc_id, ord);
+            NumUtil_u4set(ords, (uint32_t)doc_id, (uint8_t)ord);
             break;
         case 8: {
                 uint8_t *ints = (uint8_t*)ords;

http://git-wip-us.apache.org/repos/asf/lucy/blob/dd6e79c9/core/Lucy/Test/Util/TestNumberUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestNumberUtils.c 
b/core/Lucy/Test/Util/TestNumberUtils.c
index 125f325..58b60e2 100644
--- a/core/Lucy/Test/Util/TestNumberUtils.c
+++ b/core/Lucy/Test/Util/TestNumberUtils.c
@@ -44,15 +44,14 @@ test_u1(TestBatchRunner *runner) {
         if (ints[i]) { NumUtil_u1set(bits, i); }
     }
     for (size_t i = 0; i < count; i++) {
-        TEST_INT_EQ(runner, NumUtil_u1get(bits, i), (long)ints[i],
-                    "u1 set/get");
+        TEST_UINT_EQ(runner, NumUtil_u1get(bits, i), ints[i], "u1 set/get");
     }
 
     for (size_t i = 0; i < count; i++) {
         NumUtil_u1flip(bits, i);
     }
     for (size_t i = 0; i < count; i++) {
-        TEST_INT_EQ(runner, NumUtil_u1get(bits, i), !ints[i], "u1 flip");
+        TEST_UINT_EQ(runner, NumUtil_u1get(bits, i), !ints[i], "u1 flip");
     }
 
     FREEMEM(bits);
@@ -69,7 +68,7 @@ test_u2(TestBatchRunner *runner) {
         NumUtil_u2set(bits, i, (uint8_t)ints[i]);
     }
     for (size_t i = 0; i < count; i++) {
-        TEST_INT_EQ(runner, NumUtil_u2get(bits, i), (long)ints[i], "u2");
+        TEST_UINT_EQ(runner, NumUtil_u2get(bits, i), ints[i], "u2");
     }
 
     FREEMEM(bits);
@@ -86,7 +85,7 @@ test_u4(TestBatchRunner *runner) {
         NumUtil_u4set(bits, i, (uint8_t)ints[i]);
     }
     for (size_t i = 0; i < count; i++) {
-        TEST_INT_EQ(runner, NumUtil_u4get(bits, i), (long)ints[i], "u4");
+        TEST_UINT_EQ(runner, NumUtil_u4get(bits, i), ints[i], "u4");
     }
 
     FREEMEM(bits);

Reply via email to