hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject [13/30] hadoop git commit: MAPREDUCE-6412. Make hadoop-mapreduce-client Native code -Wall-clean (Alan Burlison via aw)
Date Fri, 30 Oct 2015 18:00:26 GMT
MAPREDUCE-6412. Make hadoop-mapreduce-client Native code -Wall-clean (Alan Burlison via aw)


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

Branch: refs/heads/HDFS-8966
Commit: ab99d953e464f240691b6eb45c28f2f4db27d8f0
Parents: 0e34490
Author: Allen Wittenauer <aw@apache.org>
Authored: Tue Oct 27 12:15:11 2015 -0700
Committer: Allen Wittenauer <aw@apache.org>
Committed: Tue Oct 27 12:15:11 2015 -0700

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt            |  3 +++
 .../src/main/native/src/lib/Buffers.h           | 21 ++++++++++----------
 .../src/main/native/src/lib/MemoryBlock.cc      |  4 ++--
 .../src/main/native/src/lib/MemoryBlock.h       |  2 +-
 .../src/main/native/src/util/Random.cc          |  4 ++--
 .../src/main/native/src/util/WritableUtils.cc   |  3 ++-
 .../src/main/native/test/TestPrimitives.cc      |  2 +-
 7 files changed, 21 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab99d953/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index f09a353..4b5413f 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -211,6 +211,9 @@ Trunk (Unreleased)
     MAPREDUCE-6391. util/Timer.cc completely misunderstands _POSIX_CPUTIME
     (Alan Burlison via aw)
 
+    MAPREDUCE-6412. Make hadoop-mapreduce-client Native code -Wall-clean
+    (Alan Burlison via aw)
+
   BREAKDOWN OF MAPREDUCE-2841 (NATIVE TASK) SUBTASKS
 
     MAPREDUCE-5985. native-task: Fix build on macosx. Contributed by

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab99d953/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/Buffers.h
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/Buffers.h
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/Buffers.h
index 13cd545..4929426 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/Buffers.h
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/Buffers.h
@@ -349,31 +349,31 @@ public:
     return this->_capacity;
   }
 
-  int remain() {
+  uint32_t remain() {
     return _limit - _position;
   }
 
-  int limit() {
+  uint32_t limit() {
     return _limit;
   }
 
-  int advance(int positionOffset) {
+  uint32_t advance(int positionOffset) {
     _position += positionOffset;
     return _position;
   }
 
-  int position() {
+  uint32_t position() {
     return this->_position;
   }
 
-  void position(int newPos) {
+  void position(uint32_t newPos) {
     this->_position = newPos;
   }
 
-  void rewind(int newPos, int newLimit) {
+  void rewind(uint32_t newPos, uint32_t newLimit) {
     this->_position = newPos;
-    if (newLimit < 0 || newLimit > this->_capacity) {
-      THROW_EXCEPTION(IOException, "length smaller than zero or larger than input buffer
capacity");
+    if (newLimit > this->_capacity) {
+      THROW_EXCEPTION(IOException, "length larger than input buffer capacity");
     }
     this->_limit = newLimit;
   }
@@ -474,11 +474,10 @@ public:
    * return the length of actually filled data.
    */
   uint32_t fill(const char * source, uint32_t maxSize) {
-    int remain = _size - _pos;
-    if (remain <= 0) {
+    if (_pos > _size) {
       return 0;
     }
-
+    uint32_t remain = _size - _pos;
     uint32_t length = (maxSize < remain) ? maxSize : remain;
     simple_memcpy(_buff + _pos, source, length);
     _pos += length;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab99d953/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.cc
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.cc
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.cc
index b3734a1..cd6872a 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.cc
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.cc
@@ -39,8 +39,8 @@ MemoryBlock::MemoryBlock(char * pos, uint32_t size)
     : _base(pos), _size(size), _position(0), _sorted(false) {
 }
 
-KVBuffer * MemoryBlock::getKVBuffer(int index) {
-  if (index < 0 || index >= _kvOffsets.size()) {
+KVBuffer * MemoryBlock::getKVBuffer(uint32_t index) {
+  if (index >= _kvOffsets.size()) {
     return NULL;
   }
   uint32_t offset = _kvOffsets.at(index);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab99d953/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.h
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.h
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.h
index f85c3b6..29f4518 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.h
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/MemoryBlock.h
@@ -97,7 +97,7 @@ public:
     return _kvOffsets.size();
   }
 
-  KVBuffer * getKVBuffer(int index);
+  KVBuffer * getKVBuffer(uint32_t index);
 
   void sort(SortAlgorithm type, ComparatorPtr comparator);
 };

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab99d953/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/Random.cc
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/Random.cc
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/Random.cc
index 6266b1f..2747cd9 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/Random.cc
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/Random.cc
@@ -179,7 +179,7 @@ char * Words[] = {"diurnalness", "Homoiousian", "spiranthic", "tetragynian",
"si
     "lithotresis", "minniebush", "zanyism", "eucalypteol", "sterilely", "unrealize", "unpatched",
     "hypochondriacism", "critically", "cheesecutter", };
 
-static size_t WordsCount = sizeof(Words) / sizeof(char *);
+static uint32_t WordsCount = sizeof(Words) / sizeof(char *);
 
 Random::Random() {
   setSeed(time(NULL) + clock() + RandomInitializeID++);
@@ -249,7 +249,7 @@ uint64_t Random::nextLog2(uint64_t range) {
 }
 
 uint64_t Random::nextLog10(uint64_t range) {
-  double range_r = log10(range);
+  double range_r = log10((double)range);
   double v = nextDouble() * range_r;
   return (uint64_t)pow(10, v);
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab99d953/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/WritableUtils.cc
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/WritableUtils.cc
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/WritableUtils.cc
index 2436681..8ed8dd2 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/WritableUtils.cc
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/WritableUtils.cc
@@ -155,7 +155,8 @@ int64_t WritableUtils::ReadVLong(InputStream * stream) {
   }
   uint32_t len = DecodeVLongSize(buff);
   if (len > 1) {
-    if (stream->readFully(buff + 1, len - 1) != len - 1) {
+    len--;
+    if (stream->readFully(buff + 1, len) != (int32_t)len) {
       THROW_EXCEPTION(IOException, "ReadVLong reach EOF");
     }
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ab99d953/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test/TestPrimitives.cc
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test/TestPrimitives.cc
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test/TestPrimitives.cc
index b2051c7..9373273 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test/TestPrimitives.cc
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/test/TestPrimitives.cc
@@ -141,7 +141,7 @@ inline char * memchrbrf4(char * p, char ch, size_t len) {
       return p + i + 2;
     }
   }
-  for (; i < len; i++) {
+  for (; i < (ssize_t)len; i++) {
     if (p[i] == ch) {
       return p + i;
     }


Mime
View raw message