Change some int signs to avoid compiler warnings.

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

Branch: refs/heads/compiler-warnings-20130314
Commit: 7d07c8c0a677676f745a19387b8c6541759199a7
Parents: fadd602
Author: Marvin Humphrey <[email protected]>
Authored: Wed Mar 13 17:31:35 2013 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Thu Mar 14 13:51:10 2013 -0700

----------------------------------------------------------------------
 core/Clownfish/VTable.c             |   10 +++++-----
 core/Lucy/Test/Plan/TestFieldMisc.c |    2 +-
 modules/unicode/utf8proc/utf8proc.c |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/7d07c8c0/core/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/VTable.c b/core/Clownfish/VTable.c
index e02bae2..e3ea324 100644
--- a/core/Clownfish/VTable.c
+++ b/core/Clownfish/VTable.c
@@ -51,7 +51,7 @@ VTable_bootstrap(VTableSpec *specs, size_t num_specs)
      * - Initialize refcount, parent, flags, obj_alloc_size, vt_alloc_size.
      * - Initialize method pointers.
      */
-    for (int i = 0; i < num_specs; ++i) {
+    for (size_t i = 0; i < num_specs; ++i) {
         VTableSpec *spec   = &specs[i];
         VTable     *parent = spec->parent ? *spec->parent : NULL;
 
@@ -73,7 +73,7 @@ VTable_bootstrap(VTableSpec *specs, size_t num_specs)
             memcpy(vtable->method_ptrs, parent->method_ptrs, parent_ptrs_size);
         }
 
-        for (int i = 0; i < spec->num_fresh; ++i) {
+        for (size_t i = 0; i < spec->num_fresh; ++i) {
             MethodSpec *mspec = &spec->method_specs[i];
             VTable_override(vtable, mspec->func, *mspec->offset);
         }
@@ -84,7 +84,7 @@ VTable_bootstrap(VTableSpec *specs, size_t num_specs)
     /* Pass 2:
      * - Initialize 'vtable' instance variable.
      */
-    for (int i = 0; i < num_specs; ++i) {
+    for (size_t i = 0; i < num_specs; ++i) {
         VTableSpec *spec   = &specs[i];
         VTable     *vtable = *spec->vtable;
 
@@ -97,14 +97,14 @@ VTable_bootstrap(VTableSpec *specs, size_t num_specs)
      * - Inititalize name and method array.
      * - Register vtable.
      */
-    for (int i = 0; i < num_specs; ++i) {
+    for (size_t i = 0; i < num_specs; ++i) {
         VTableSpec *spec   = &specs[i];
         VTable     *vtable = *spec->vtable;
 
         vtable->name    = CB_newf("%s", spec->name);
         vtable->methods = VA_new(0);
 
-        for (int i = 0; i < spec->num_fresh; ++i) {
+        for (size_t i = 0; i < spec->num_fresh; ++i) {
             MethodSpec *mspec = &spec->method_specs[i];
             if (mspec->is_novel) {
                 CharBuf *name = CB_newf("%s", mspec->name);

http://git-wip-us.apache.org/repos/asf/lucy/blob/7d07c8c0/core/Lucy/Test/Plan/TestFieldMisc.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Plan/TestFieldMisc.c 
b/core/Lucy/Test/Plan/TestFieldMisc.c
index c9f3b22..6cb5f23 100644
--- a/core/Lucy/Test/Plan/TestFieldMisc.c
+++ b/core/Lucy/Test/Plan/TestFieldMisc.c
@@ -127,7 +127,7 @@ S_add_doc(Indexer *indexer, CharBuf *field_name) {
 
 static void
 S_check(TestBatch *batch, RAMFolder *folder, CharBuf *field,
-        CharBuf *query_text, int expected_num_hits) {
+        CharBuf *query_text, uint32_t expected_num_hits) {
     TermQuery *query = TermQuery_new(field, (Obj*)query_text);
     IndexSearcher *searcher = IxSearcher_new((Obj*)folder);
     Hits *hits = IxSearcher_Hits(searcher, (Obj*)query, 0, 10, NULL);

http://git-wip-us.apache.org/repos/asf/lucy/blob/7d07c8c0/modules/unicode/utf8proc/utf8proc.c
----------------------------------------------------------------------
diff --git a/modules/unicode/utf8proc/utf8proc.c 
b/modules/unicode/utf8proc/utf8proc.c
index 8d489a3..3bc1878 100644
--- a/modules/unicode/utf8proc/utf8proc.c
+++ b/modules/unicode/utf8proc/utf8proc.c
@@ -407,7 +407,7 @@ ssize_t utf8proc_decompose(
       if (decomp_result < 0) return decomp_result;
       wpos += decomp_result;
       /* prohibiting integer overflows due to too long strings: */
-      if (wpos < 0 || wpos > SSIZE_MAX/sizeof(int32_t)/2)
+      if (wpos < 0 || wpos > (ssize_t)(SSIZE_MAX/sizeof(int32_t)/2))
         return UTF8PROC_ERROR_OVERFLOW;
     }
   }

Reply via email to