You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2018/04/23 17:31:43 UTC

orc git commit: ORC-333: [C++] Minor changes to avoid warnings from MSVC

Repository: orc
Updated Branches:
  refs/heads/master 6c67bc8cc -> 221c85e07


ORC-333: [C++] Minor changes to avoid warnings from MSVC

Fixes #242

Signed-off-by: Owen O'Malley <om...@apache.org>


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

Branch: refs/heads/master
Commit: 221c85e07b7b0a9ed5157b73c0181b6cac73611c
Parents: 6c67bc8
Author: rip-nsk <ri...@gmail.com>
Authored: Sun Apr 8 16:30:28 2018 -0700
Committer: Owen O'Malley <om...@apache.org>
Committed: Mon Apr 23 10:31:17 2018 -0700

----------------------------------------------------------------------
 c++/include/orc/Int128.hh    | 4 ++--
 c++/src/ColumnWriter.cc      | 2 +-
 c++/src/Compression.cc       | 4 ++--
 c++/test/TestColumnReader.cc | 8 ++++----
 c++/test/TestWriter.cc       | 8 ++++----
 5 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/221c85e0/c++/include/orc/Int128.hh
----------------------------------------------------------------------
diff --git a/c++/include/orc/Int128.hh b/c++/include/orc/Int128.hh
index 160f1b0..f86d8f0 100644
--- a/c++/include/orc/Int128.hh
+++ b/c++/include/orc/Int128.hh
@@ -285,9 +285,9 @@ namespace orc {
     bool fitsInLong() const {
       switch (highbits) {
       case 0:
-        return !(lowbits & LONG_SIGN_BIT);
+        return 0 == (lowbits & LONG_SIGN_BIT);
       case -1:
-        return lowbits & LONG_SIGN_BIT;
+        return 0 != (lowbits & LONG_SIGN_BIT);
       default:
         return false;
       }

http://git-wip-us.apache.org/repos/asf/orc/blob/221c85e0/c++/src/ColumnWriter.cc
----------------------------------------------------------------------
diff --git a/c++/src/ColumnWriter.cc b/c++/src/ColumnWriter.cc
index 1a51b12..91e6713 100644
--- a/c++/src/ColumnWriter.cc
+++ b/c++/src/ColumnWriter.cc
@@ -649,7 +649,7 @@ namespace orc {
     for (uint64_t i = 0; i < numValues; ++i) {
       if (notNull == nullptr || notNull[i]) {
         boolStats->increase(1);
-        boolStats->update(byteData[i], 1);
+        boolStats->update(byteData[i] != 0, 1);
       } else if (!hasNull) {
         hasNull = true;
       }

http://git-wip-us.apache.org/repos/asf/orc/blob/221c85e0/c++/src/Compression.cc
----------------------------------------------------------------------
diff --git a/c++/src/Compression.cc b/c++/src/Compression.cc
index cb4bcdd..518bddc 100644
--- a/c++/src/Compression.cc
+++ b/c++/src/Compression.cc
@@ -545,7 +545,7 @@ DIAGNOSTIC_POP
 
   void ZlibDecompressionStream::seek(PositionProvider& position) {
     input->seek(position);
-    bytesReturned = input->ByteCount();
+    bytesReturned = static_cast<off_t>(input->ByteCount());
     if (!Skip(static_cast<int>(position.next()))) {
       throw ParseError("Bad skip in ZlibDecompressionStream::seek");
     }
@@ -673,7 +673,7 @@ DIAGNOSTIC_POP
       *data = outputBufferPtr;
       *size = static_cast<int>(outputBufferLength);
       outputBufferPtr += outputBufferLength;
-      bytesReturned += outputBufferLength;
+      bytesReturned += static_cast<off_t>(outputBufferLength);
       outputBufferLength = 0;
       return true;
     }

http://git-wip-us.apache.org/repos/asf/orc/blob/221c85e0/c++/test/TestColumnReader.cc
----------------------------------------------------------------------
diff --git a/c++/test/TestColumnReader.cc b/c++/test/TestColumnReader.cc
index fe1740f..36d168a 100644
--- a/c++/test/TestColumnReader.cc
+++ b/c++/test/TestColumnReader.cc
@@ -208,11 +208,11 @@ TEST(TestColumnReader, testByteWithNulls) {
 
   // range(256)
   char buffer[258];
-  buffer[0] = static_cast<char>(0x80);
+  buffer[0] = '\x80';
   for (unsigned int i = 0; i < 128; ++i) {
     buffer[i + 1] = static_cast<char>(i);
   }
-  buffer[129] = static_cast<char>(0x80);
+  buffer[129] = '\x80';
   for (unsigned int i = 128; i < 256; ++i) {
     buffer[i + 2] = static_cast<char>(i);
   }
@@ -271,11 +271,11 @@ TEST(TestColumnReader, testByteSkipsWithNulls) {
 
   // range(256)
   char buffer[258];
-  buffer[0] = static_cast<char>(0x80);
+  buffer[0] = '\x80';
   for (unsigned int i = 0; i < 128; ++i) {
     buffer[i + 1] = static_cast<char>(i);
   }
-  buffer[129] = static_cast<char>(0x80);
+  buffer[129] = '\x80';
   for (unsigned int i = 128; i < 256; ++i) {
     buffer[i + 2] = static_cast<char>(i);
   }

http://git-wip-us.apache.org/repos/asf/orc/blob/221c85e0/c++/test/TestWriter.cc
----------------------------------------------------------------------
diff --git a/c++/test/TestWriter.cc b/c++/test/TestWriter.cc
index 53f5f16..636ad6b 100644
--- a/c++/test/TestWriter.cc
+++ b/c++/test/TestWriter.cc
@@ -476,7 +476,7 @@ namespace orc {
       dynamic_cast<LongVectorBatch *>(structBatch->fields[0]);
 
     for (uint64_t i = 0; i < rowCount; ++i) {
-      byteBatch->data[i] = (i % 3) == 0;
+      byteBatch->data[i] = (i % 3) == 0 ? 1 : 0;
     }
     structBatch->numElements = rowCount;
     byteBatch->numElements = rowCount;
@@ -496,7 +496,7 @@ namespace orc {
     structBatch = dynamic_cast<StructVectorBatch *>(batch.get());
     byteBatch = dynamic_cast<LongVectorBatch *>(structBatch->fields[0]);
     for (uint64_t i = 0; i < rowCount; ++i) {
-      EXPECT_EQ((i % 3) == 0, byteBatch->data[i]);
+      EXPECT_EQ((i % 3) == 0 ? 1 : 0, byteBatch->data[i]);
     }
   }
 
@@ -1075,7 +1075,7 @@ namespace orc {
           break;
         case 2:
           offsets[i] = boolOffset;
-          boolData[boolOffset++] = (i % 2 == 0);
+          boolData[boolOffset++] = (i % 2 == 0) ? 1 : 0;
           break;
       }
       tag = (tag + 1) % 3;
@@ -1129,7 +1129,7 @@ namespace orc {
             std::abs(static_cast<double>(i) + 0.5 - doubleData[offset]) < 0.000001);
           break;
         case 2:
-          EXPECT_EQ(i % 2 == 0, boolData[offset]);
+          EXPECT_EQ(i % 2 == 0 ? 1 : 0, boolData[offset]);
           break;
       }
     }