THRIFT-916: Fix warnings in C++ when compiling with -Wall.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1031222 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/test/TBufferBaseTest.cpp b/lib/cpp/test/TBufferBaseTest.cpp
index 6e1bf16..1a0552a 100644
--- a/lib/cpp/test/TBufferBaseTest.cpp
+++ b/lib/cpp/test/TBufferBaseTest.cpp
@@ -164,7 +164,7 @@
 
   // Repeatability.  Kind of.
   std::srand(42);
-  for (int i = 0; i < (int)(sizeof(data)/sizeof(data[0])); ++i) {
+  for (size_t i = 0; i < (sizeof(data)/sizeof(data[0])); ++i) {
     data[i] = (uint8_t)rand();
   }
 
@@ -398,7 +398,7 @@
     1<<14, 1<<17,
   };
 
-  for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
     int size = sizes[i];
     for (int d1 = 0; d1 < 3; d1++) {
       shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
@@ -429,7 +429,7 @@
     1<<14, 1<<17,
   };
 
-  for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
     int size = sizes[i];
     for (int d1 = 0; d1 < 3; d1++) {
       shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(data, sizeof(data)));
@@ -462,7 +462,7 @@
     1<<14, 1<<17,
   };
 
-  for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
     int size = sizes[i];
     for (int d1 = 0; d1 < 3; d1++) {
       shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(data, sizeof(data)));
@@ -496,7 +496,7 @@
     1<<14, 1<<17,
   };
 
-  for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
     int size = sizes[i];
     for (int d1 = 0; d1 < 3; d1++) {
       shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
@@ -559,9 +559,9 @@
 
   int probs[] = { 1, 2, 4, 8, 16, 32, };
 
-  for (int i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
+  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
     int size = sizes[i];
-    for (int j = 0; j < sizeof (probs) / sizeof (probs[0]); j++) {
+    for (size_t j = 0; j < sizeof (probs) / sizeof (probs[0]); j++) {
       int prob = probs[j];
       for (int d1 = 0; d1 < 3; d1++) {
         shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
@@ -592,7 +592,7 @@
         int read_offset = 0;
         int read_index = 0;
 
-        for (int k = 0; k < flush_sizes.size(); k++) {
+        for (unsigned int k = 0; k < flush_sizes.size(); k++) {
           int fsize = flush_sizes[k];
           // We are exploiting an implementation detail of TFramedTransport.
           // The read buffer starts empty and it will never do more than one
diff --git a/lib/cpp/test/TFileTransportTest.cpp b/lib/cpp/test/TFileTransportTest.cpp
index fade095..98fd18d 100644
--- a/lib/cpp/test/TFileTransportTest.cpp
+++ b/lib/cpp/test/TFileTransportTest.cpp
@@ -272,7 +272,8 @@
   const FsyncLog::CallList* calls = log.getCalls();
   // We added 1 fsync call above.
   // Make sure TFileTransport called fsync at least once
-  BOOST_CHECK_GT(calls->size(), 1);
+  BOOST_CHECK_GT(calls->size(),
+                 static_cast<FsyncLog::CallList::size_type>(1));
 
   const struct timeval* prev_time = NULL;
   for (FsyncLog::CallList::const_iterator it = calls->begin();
@@ -346,9 +347,6 @@
 }
 
 void parse_args(int argc, char* argv[]) {
-  int seed;
-  int *seedptr = NULL;
-
   struct option long_opts[] = {
     { "help", false, NULL, 'h' },
     { "tmp-dir", true, NULL, 't' },
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
index 0762eca..46a89a7 100644
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -575,8 +575,8 @@
   transports.out->flush();
   set_trigger(3, transports.out, 1);
   uint32_t bytes_read = transports.in->read(read_buf, 10);
-  BOOST_CHECK_EQUAL(numTriggersFired, 0);
-  BOOST_CHECK_EQUAL(bytes_read, 9);
+  BOOST_CHECK_EQUAL(numTriggersFired, (unsigned int) 0);
+  BOOST_CHECK_EQUAL(bytes_read, (uint32_t) 9);
 
   clear_triggers();
 }
@@ -615,7 +615,7 @@
 
   // Now read 4 bytes, so that we are partway through the written data.
   uint32_t bytes_read = transports.in->read(read_buf, 4);
-  BOOST_CHECK_EQUAL(bytes_read, 4);
+  BOOST_CHECK_EQUAL(bytes_read, (uint32_t) 4);
 
   // Now attempt to read 10 bytes.  Only 9 more are available.
   //
@@ -628,13 +628,13 @@
   while (total_read < 9) {
     set_trigger(3, transports.out, 1);
     bytes_read = transports.in->read(read_buf, 10);
-    BOOST_REQUIRE_EQUAL(numTriggersFired, 0);
-    BOOST_REQUIRE_GT(bytes_read, 0);
+    BOOST_REQUIRE_EQUAL(numTriggersFired, (unsigned int) 0);
+    BOOST_REQUIRE_GT(bytes_read, (uint32_t) 0);
     total_read += bytes_read;
-    BOOST_REQUIRE_LE(total_read, 9);
+    BOOST_REQUIRE_LE(total_read, (uint32_t) 9);
   }
 
-  BOOST_CHECK_EQUAL(total_read, 9);
+  BOOST_CHECK_EQUAL(total_read, (uint32_t) 9);
 
   clear_triggers();
 }
@@ -656,7 +656,7 @@
   set_trigger(3, transports.out, 1);
   uint32_t borrow_len = 10;
   const uint8_t* borrowed_buf = transports.in->borrow(read_buf, &borrow_len);
-  BOOST_CHECK_EQUAL(numTriggersFired, 0);
+  BOOST_CHECK_EQUAL(numTriggersFired, (unsigned int) 0);
   BOOST_CHECK(borrowed_buf == NULL);
 
   clear_triggers();
@@ -682,11 +682,11 @@
   add_trigger(1, transports.out, 8);
   uint32_t bytes_read = transports.in->read(read_buf, 10);
   if (bytes_read == 0) {
-    BOOST_CHECK_EQUAL(numTriggersFired, 0);
+    BOOST_CHECK_EQUAL(numTriggersFired, (unsigned int) 0);
     clear_triggers();
   } else {
-    BOOST_CHECK_EQUAL(numTriggersFired, 1);
-    BOOST_CHECK_EQUAL(bytes_read, 2);
+    BOOST_CHECK_EQUAL(numTriggersFired, (unsigned int) 1);
+    BOOST_CHECK_EQUAL(bytes_read, (uint32_t) 2);
   }
 
   clear_triggers();
@@ -706,7 +706,7 @@
   uint32_t borrow_len = 10;
   const uint8_t* borrowed_buf = transports.in->borrow(NULL, &borrow_len);
   BOOST_CHECK(borrowed_buf == NULL);
-  BOOST_CHECK_EQUAL(numTriggersFired, 0);
+  BOOST_CHECK_EQUAL(numTriggersFired, (unsigned int) 0);
 
   clear_triggers();
 }
diff --git a/lib/cpp/test/ZlibTest.cpp b/lib/cpp/test/ZlibTest.cpp
index c9d3f38..9df9dc4 100644
--- a/lib/cpp/test/ZlibTest.cpp
+++ b/lib/cpp/test/ZlibTest.cpp
@@ -234,7 +234,7 @@
     }
     uint32_t got = zlib_trans->read(mirror.get() + tot, read_len);
     BOOST_REQUIRE_LE(got, expected_read_len);
-    BOOST_REQUIRE_NE(got, 0);
+    BOOST_REQUIRE_NE(got, (uint32_t) 0);
     tot += got;
   }
 
@@ -325,7 +325,7 @@
     TZlibTransport w_zlib_trans(membuf);
   }
 
-  BOOST_CHECK_EQUAL(membuf->available_read(), 0);
+  BOOST_CHECK_EQUAL(membuf->available_read(), (uint32_t) 0);
 }
 
 /*