You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/08/13 17:52:03 UTC

[4/5] git commit: refs/heads/master - Const a few char pointers

Const a few char pointers


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

Branch: refs/heads/master
Commit: 5640701c67fbf4e36792110fc2536af949e14e2e
Parents: 4e1caaf
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Aug 10 19:20:35 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Aug 12 21:36:11 2014 +0200

----------------------------------------------------------------------
 core/Lucy/Index/DocWriter.c       | 8 ++++----
 core/Lucy/Index/HighlightWriter.c | 3 +--
 core/Lucy/Store/RAMFileHandle.c   | 2 +-
 core/LucyX/Search/MockMatcher.c   | 2 +-
 4 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/5640701c/core/Lucy/Index/DocWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DocWriter.c b/core/Lucy/Index/DocWriter.c
index cb4e7ef..8b70d14 100644
--- a/core/Lucy/Index/DocWriter.c
+++ b/core/Lucy/Index/DocWriter.c
@@ -122,8 +122,8 @@ DocWriter_Add_Inverted_Doc_IMP(DocWriter *self, Inverter *inverter,
                     break;
                 }
                 case FType_BLOB: {
-                    char   *buf  = BB_Get_Buf((ByteBuf*)value);
-                    size_t  size = BB_Get_Size((ByteBuf*)value);
+                    const char *buf  = BB_Get_Buf((ByteBuf*)value);
+                    size_t      size = BB_Get_Size((ByteBuf*)value);
                     OutStream_Write_C32(dat_out, size);
                     OutStream_Write_Bytes(dat_out, buf, size);
                     break;
@@ -183,8 +183,8 @@ DocWriter_Add_Segment_IMP(DocWriter *self, SegReader *reader,
 
                 // Copy record over.
                 DefDocReader_Read_Record(doc_reader, buffer, i);
-                char *buf   = BB_Get_Buf(buffer);
-                size_t size = BB_Get_Size(buffer);
+                const char *buf  = BB_Get_Buf(buffer);
+                size_t      size = BB_Get_Size(buffer);
                 OutStream_Write_Bytes(dat_out, buf, size);
 
                 // Write file pointer.

http://git-wip-us.apache.org/repos/asf/lucy/blob/5640701c/core/Lucy/Index/HighlightWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/HighlightWriter.c b/core/Lucy/Index/HighlightWriter.c
index 501d522..9655455 100644
--- a/core/Lucy/Index/HighlightWriter.c
+++ b/core/Lucy/Index/HighlightWriter.c
@@ -143,7 +143,6 @@ HLWriter_TV_Buf_IMP(HighlightWriter *self, Inversion *inversion) {
     size_t      last_len = 0;
     ByteBuf    *tv_buf = BB_new(20 + Inversion_Get_Size(inversion) * 8);
     uint32_t    num_postings = 0;
-    char       *dest;
     Token     **tokens;
     uint32_t    freq;
     UNUSED_VAR(self);
@@ -202,7 +201,7 @@ HLWriter_TV_Buf_IMP(HighlightWriter *self, Inversion *inversion) {
     }
 
     // Go back and start the term vector string with the posting count.
-    dest = BB_Get_Buf(tv_buf);
+    char *dest = BB_Get_Buf(tv_buf);
     NumUtil_encode_padded_c32(num_postings, &dest);
 
     return tv_buf;

http://git-wip-us.apache.org/repos/asf/lucy/blob/5640701c/core/Lucy/Store/RAMFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFileHandle.c b/core/Lucy/Store/RAMFileHandle.c
index ce9cba0..8db9f60 100644
--- a/core/Lucy/Store/RAMFileHandle.c
+++ b/core/Lucy/Store/RAMFileHandle.c
@@ -129,7 +129,7 @@ RAMFH_Read_IMP(RAMFileHandle *self, char *dest, int64_t offset, size_t len) {
         return false;
     }
     else {
-        char *const source = BB_Get_Buf(ivars->contents) + offset;
+        const char *const source = BB_Get_Buf(ivars->contents) + offset;
         memcpy(dest, source, len);
         return true;
     }

http://git-wip-us.apache.org/repos/asf/lucy/blob/5640701c/core/LucyX/Search/MockMatcher.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/MockMatcher.c b/core/LucyX/Search/MockMatcher.c
index e340e78..867d7a2 100644
--- a/core/LucyX/Search/MockMatcher.c
+++ b/core/LucyX/Search/MockMatcher.c
@@ -60,7 +60,7 @@ MockMatcher_Score_IMP(MockMatcher* self) {
     if (!ivars->scores) {
         THROW(ERR, "Can't call Score() unless scores supplied");
     }
-    float *raw_scores = (float*)BB_Get_Buf(ivars->scores);
+    const float *raw_scores = (const float*)BB_Get_Buf(ivars->scores);
     return raw_scores[ivars->tick];
 }