Adapt for size_t ByteBuf APIs.

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

Branch: refs/heads/master
Commit: a52a0a998d6eaf97bb389d6a40c0834f3a4585a2
Parents: 56cabf0
Author: Marvin Humphrey <[email protected]>
Authored: Mon Apr 25 16:45:10 2016 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Mon Apr 25 17:01:55 2016 -0700

----------------------------------------------------------------------
 core/Lucy/Index/HighlightWriter.c | 6 +++++-
 core/Lucy/Index/PostingPool.c     | 2 +-
 core/Lucy/Store/RAMFileHandle.c   | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/a52a0a99/core/Lucy/Index/HighlightWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/HighlightWriter.c 
b/core/Lucy/Index/HighlightWriter.c
index 72153b2..b580dbc 100644
--- a/core/Lucy/Index/HighlightWriter.c
+++ b/core/Lucy/Index/HighlightWriter.c
@@ -199,7 +199,11 @@ HLWriter_TV_Buf_IMP(HighlightWriter *self, Inversion 
*inversion) {
         } while (--freq && (token = *++tokens));
 
         // Set new byte length.
-        BB_Set_Size(tv_buf, ptr - orig);
+        ptrdiff_t diff = ptr - orig;
+        if (diff < 0) { // sanity check
+            diff = 0;
+        }
+        BB_Set_Size(tv_buf, (size_t)diff);
     }
 
     // Go back and start the term vector string with the posting count.

http://git-wip-us.apache.org/repos/asf/lucy/blob/a52a0a99/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index 74b0e0c..9bb785a 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -356,7 +356,7 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter 
*post_writer,
     ByteBuf *last_term_text
         = BB_new_bytes(post_ivars->blob, post_ivars->content_len);
     char     *last_text_buf  = BB_Get_Buf(last_term_text);
-    uint32_t  last_text_size = BB_Get_Size(last_term_text);
+    uint32_t  last_text_size = (uint32_t)BB_Get_Size(last_term_text);
     SkipStepper_Set_ID_And_Filepos(skip_stepper, 0, 0);
 
     // Initialize sentinel to be used on the last iter, using an empty string

http://git-wip-us.apache.org/repos/asf/lucy/blob/a52a0a99/core/Lucy/Store/RAMFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFileHandle.c b/core/Lucy/Store/RAMFileHandle.c
index 7895d25..4545d8d 100644
--- a/core/Lucy/Store/RAMFileHandle.c
+++ b/core/Lucy/Store/RAMFileHandle.c
@@ -64,7 +64,7 @@ RAMFH_do_open(RAMFileHandle *self, String *path, uint32_t 
flags,
     }
 
     ivars->contents = (ByteBuf*)INCREF(RAMFile_Get_Contents(ivars->ram_file));
-    ivars->len      = BB_Get_Size(ivars->contents);
+    ivars->len      = (int64_t)BB_Get_Size(ivars->contents);
 
     return self;
 }

Reply via email to