Harmless sign casts for position/count vars.

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

Branch: refs/heads/master
Commit: a94f500f219160a944cb8523ae6be6902d75147e
Parents: b341575
Author: Marvin Humphrey <[email protected]>
Authored: Thu May 26 18:49:30 2016 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Thu May 26 18:49:30 2016 -0700

----------------------------------------------------------------------
 core/Lucy/Highlight/HeatMap.c          | 3 ++-
 core/Lucy/Index/Posting/RichPosting.c  | 6 +++---
 core/Lucy/Index/Posting/ScorePosting.c | 6 +++---
 core/Lucy/Search/PhraseQuery.c         | 2 +-
 core/LucyX/Search/ProximityQuery.c     | 2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/a94f500f/core/Lucy/Highlight/HeatMap.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/HeatMap.c b/core/Lucy/Highlight/HeatMap.c
index 0d71ef5..0965fde 100644
--- a/core/Lucy/Highlight/HeatMap.c
+++ b/core/Lucy/Highlight/HeatMap.c
@@ -170,7 +170,8 @@ HeatMap_Calc_Proximity_Boost_IMP(HeatMap *self, Span 
*span1, Span *span2) {
         return 0.0f;
     }
     else {
-        float factor = (ivars->window - distance) / (float)ivars->window;
+        float factor
+            = ((int32_t)ivars->window - distance) / (float)ivars->window;
         // Damp boost with greater distance.
         factor *= factor;
         return factor * (Span_Get_Weight(lower) + Span_Get_Weight(upper));

http://git-wip-us.apache.org/repos/asf/lucy/blob/a94f500f/core/Lucy/Index/Posting/RichPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/RichPosting.c 
b/core/Lucy/Index/Posting/RichPosting.c
index 693307e..242995e 100644
--- a/core/Lucy/Index/Posting/RichPosting.c
+++ b/core/Lucy/Index/Posting/RichPosting.c
@@ -129,15 +129,15 @@ RichPost_Add_Inversion_To_Pool_IMP(RichPosting *self, 
PostingPool *post_pool,
         RawPostingIVARS *const raw_post_ivars = RawPost_IVARS(raw_posting);
         char *const start = raw_post_ivars->blob + token_ivars->len;
         char *dest = start;
-        uint32_t last_prox = 0;
+        int32_t last_prox = 0;
 
         // Positions and boosts.
         for (uint32_t i = 0; i < freq; i++) {
             TokenIVARS *const t_ivars = Token_IVARS(tokens[i]);
-            const uint32_t prox_delta = t_ivars->pos - last_prox;
+            const int32_t prox_delta = t_ivars->pos - last_prox;
             const float boost = field_boost * t_ivars->boost;
 
-            NumUtil_encode_cu32(prox_delta, &dest);
+            NumUtil_encode_ci32(prox_delta, &dest);
             last_prox = t_ivars->pos;
 
             *((uint8_t*)dest) = Sim_Encode_Norm(sim, boost);

http://git-wip-us.apache.org/repos/asf/lucy/blob/a94f500f/core/Lucy/Index/Posting/ScorePosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/ScorePosting.c 
b/core/Lucy/Index/Posting/ScorePosting.c
index 34bb5f9..ea33346 100644
--- a/core/Lucy/Index/Posting/ScorePosting.c
+++ b/core/Lucy/Index/Posting/ScorePosting.c
@@ -100,7 +100,7 @@ ScorePost_Add_Inversion_To_Pool_IMP(ScorePosting *self,
         RawPostingIVARS *const raw_post_ivars = RawPost_IVARS(raw_posting);
         char *const start  = raw_post_ivars->blob + token_ivars->len;
         char *dest         = start;
-        uint32_t last_prox = 0;
+        int32_t last_prox = 0;
 
         // Field_boost.
         *((uint8_t*)dest) = field_boost_byte;
@@ -109,8 +109,8 @@ ScorePost_Add_Inversion_To_Pool_IMP(ScorePosting *self,
         // Positions.
         for (uint32_t i = 0; i < freq; i++) {
             TokenIVARS *const t_ivars = Token_IVARS(tokens[i]);
-            const uint32_t prox_delta = t_ivars->pos - last_prox;
-            NumUtil_encode_cu32(prox_delta, &dest);
+            const int32_t prox_delta = t_ivars->pos - last_prox;
+            NumUtil_encode_ci32(prox_delta, &dest);
             last_prox = t_ivars->pos;
         }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/a94f500f/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index 8cc2907..9605903 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -404,7 +404,7 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, 
Searcher *searcher,
         I32Array *tv_end_positions   = TV_Get_Positions(last_tv);
         I32Array *tv_start_offsets   = TV_Get_Start_Offsets(first_tv);
         I32Array *tv_end_offsets     = TV_Get_End_Offsets(last_tv);
-        uint32_t  terms_max          = num_terms - 1;
+        int32_t   terms_max          = (int32_t)num_terms - 1;
         I32Array *valid_posits       = BitVec_To_Array(posit_vec);
         size_t    num_valid_posits   = I32Arr_Get_Size(valid_posits);
         size_t j = 0;

http://git-wip-us.apache.org/repos/asf/lucy/blob/a94f500f/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c 
b/core/LucyX/Search/ProximityQuery.c
index 170bdda..7c4e215 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -433,7 +433,7 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler 
*self,
         I32Array *tv_end_positions   = TV_Get_Positions(last_tv);
         I32Array *tv_start_offsets   = TV_Get_Start_Offsets(first_tv);
         I32Array *tv_end_offsets     = TV_Get_End_Offsets(last_tv);
-        uint32_t  terms_max          = num_terms - 1;
+        int32_t   terms_max          = (int32_t)num_terms - 1;
         I32Array *valid_posits       = BitVec_To_Array(posit_vec);
         size_t    num_valid_posits   = I32Arr_Get_Size(valid_posits);
         size_t    j = 0;

Reply via email to