MAPREDUCE-6412. Make hadoop-mapreduce-client Native code -Wall-clean (Alan Burlison via aw)
This commit is contained in:
parent
0e344902aa
commit
ab99d953e4
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
return _kvOffsets.size();
|
||||
}
|
||||
|
||||
KVBuffer * getKVBuffer(int index);
|
||||
KVBuffer * getKVBuffer(uint32_t index);
|
||||
|
||||
void sort(SortAlgorithm type, ComparatorPtr comparator);
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user