Enabling -Wshadow [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-08-26 05:13:41 +03:00
parent 8a0239b6ad
commit 281faa1686
5 changed files with 10 additions and 9 deletions

View File

@ -84,13 +84,13 @@ void AIOContextPool::fulfillPromises(const io_event events[], const int num_even
for (const auto & event : boost::make_iterator_range(events, events + num_events)) for (const auto & event : boost::make_iterator_range(events, events + num_events))
{ {
/// get id from event /// get id from event
const auto id = event.data; const auto completed_id = event.data;
/// set value via promise and release it /// set value via promise and release it
const auto it = promises.find(id); const auto it = promises.find(completed_id);
if (it == std::end(promises)) if (it == std::end(promises))
{ {
LOG_ERROR(&Poco::Logger::get("AIOcontextPool"), "Found io_event with unknown id " << id); LOG_ERROR(&Poco::Logger::get("AIOcontextPool"), "Found io_event with unknown id " << completed_id);
continue; continue;
} }
@ -126,7 +126,8 @@ std::future<AIOContextPool::BytesRead> AIOContextPool::post(struct iocb & iocb)
std::unique_lock<std::mutex> lock{mutex}; std::unique_lock<std::mutex> lock{mutex};
/// get current id and increment it by one /// get current id and increment it by one
const auto request_id = id++; const auto request_id = next_id;
++next_id;
/// create a promise and put request in "queue" /// create a promise and put request in "queue"
promises.emplace(request_id, std::promise<BytesRead>{}); promises.emplace(request_id, std::promise<BytesRead>{});

View File

@ -26,7 +26,7 @@ class AIOContextPool : public ext::singleton<AIOContextPool>
using BytesRead = ssize_t; using BytesRead = ssize_t;
/// Autoincremental id used to identify completed requests /// Autoincremental id used to identify completed requests
ID id{}; ID next_id{};
mutable std::mutex mutex; mutable std::mutex mutex;
mutable std::condition_variable have_resources; mutable std::condition_variable have_resources;
std::map<ID, std::promise<BytesRead>> promises; std::map<ID, std::promise<BytesRead>> promises;

View File

@ -191,7 +191,7 @@ off_t ReadBufferAIO::doSeek(off_t off, int whence)
void ReadBufferAIO::synchronousRead() void ReadBufferAIO::synchronousRead()
{ {
CurrentMetrics::Increment metric_increment{CurrentMetrics::Read}; CurrentMetrics::Increment metric_increment_read{CurrentMetrics::Read};
prepare(); prepare();
bytes_read = ::pread(fd, buffer_begin, region_aligned_size, region_aligned_begin); bytes_read = ::pread(fd, buffer_begin, region_aligned_size, region_aligned_begin);
@ -227,7 +227,7 @@ bool ReadBufferAIO::waitForAIOCompletion()
if (is_eof || !is_pending_read) if (is_eof || !is_pending_read)
return false; return false;
CurrentMetrics::Increment metric_increment{CurrentMetrics::Read}; CurrentMetrics::Increment metric_increment_read{CurrentMetrics::Read};
bytes_read = future_bytes_read.get(); bytes_read = future_bytes_read.get();
is_pending_read = false; is_pending_read = false;

View File

@ -70,7 +70,7 @@ bool ZlibInflatingReadBuffer::nextImpl()
} }
else else
{ {
int rc = inflateReset(&zstr); rc = inflateReset(&zstr);
if (rc != Z_OK) if (rc != Z_OK)
throw Exception(std::string("inflateReset failed: ") + zError(rc), ErrorCodes::ZLIB_INFLATE_FAILED); throw Exception(std::string("inflateReset failed: ") + zError(rc), ErrorCodes::ZLIB_INFLATE_FAILED);
return true; return true;

View File

@ -372,7 +372,7 @@ ReturnType readFloatTextFastImpl(T & x, ReadBuffer & in)
auto after_point_num_leading_zeros = after_leading_zeros_count - after_point_count; auto after_point_num_leading_zeros = after_leading_zeros_count - after_point_count;
readUIntTextUpToNSignificantDigits<significant_digits>(after_point, in); readUIntTextUpToNSignificantDigits<significant_digits>(after_point, in);
int read_digits = in.count() - after_leading_zeros_count; read_digits = in.count() - after_leading_zeros_count;
after_point_exponent = (read_digits > significant_digits ? -significant_digits : -read_digits) - after_point_num_leading_zeros; after_point_exponent = (read_digits > significant_digits ? -significant_digits : -read_digits) - after_point_num_leading_zeros;
} }