Fix C26451 warning.

GitOrigin-RevId: 7c7fa7df4078dec15dfdc3db2df30ab5be234b5b
This commit is contained in:
levlam 2018-10-25 21:29:10 +03:00
parent df71b93768
commit 1f216df1d8
3 changed files with 8 additions and 8 deletions

View File

@ -396,22 +396,22 @@ class LinkTokenMasterActor : public Actor {
}
void loop() override {
for (int i = 0; i < 100 && cnt_ > 0; cnt_--, i++) {
auto token = static_cast<uint64>(cnt_ + 1);
switch (i % 4) {
case 0: {
send_closure(ActorShared<LinkTokenSlave>(child_, cnt_ + 1), &LinkTokenSlave::add, cnt_ + 1);
send_closure(ActorShared<LinkTokenSlave>(child_, token), &LinkTokenSlave::add, token);
break;
}
case 1: {
send_closure_later(ActorShared<LinkTokenSlave>(child_, cnt_ + 1), &LinkTokenSlave::add, cnt_ + 1);
send_closure_later(ActorShared<LinkTokenSlave>(child_, token), &LinkTokenSlave::add, token);
break;
}
case 2: {
EventCreator::closure(ActorShared<LinkTokenSlave>(child_, cnt_ + 1), &LinkTokenSlave::add, cnt_ + 1)
.try_emit();
EventCreator::closure(ActorShared<LinkTokenSlave>(child_, token), &LinkTokenSlave::add, token).try_emit();
break;
}
case 3: {
EventCreator::closure(ActorShared<LinkTokenSlave>(child_, cnt_ + 1), &LinkTokenSlave::add, cnt_ + 1)
EventCreator::closure(ActorShared<LinkTokenSlave>(child_, token), &LinkTokenSlave::add, token)
.try_emit_later();
break;
}

View File

@ -132,7 +132,7 @@ class NetStats {
void on_change(LocalNetStats &stats, uint64 size) {
stats.unsync_size += size;
auto now = Time::now();
if (stats.unsync_size > 10000 || now - stats.last_update > 5 * 60) {
if (stats.unsync_size > 10000 || now - stats.last_update > 300) {
stats.unsync_size = 0;
stats.last_update = now;
callback_->on_stats_updated();

View File

@ -208,7 +208,7 @@ std::enable_if_t<std::is_signed<T>::value, T> to_integer(Slice str) {
begin++;
}
while (begin != end && is_digit(*begin)) {
integer_value = static_cast<unsigned_T>(integer_value * 10 + (*begin++ - '0'));
integer_value = static_cast<unsigned_T>(integer_value * 10 + static_cast<unsigned_T>(*begin++ - '0'));
}
if (integer_value > static_cast<unsigned_T>(std::numeric_limits<T>::max())) {
static_assert(~0 + 1 == 0, "Two's complement");
@ -230,7 +230,7 @@ std::enable_if_t<std::is_unsigned<T>::value, T> to_integer(Slice str) {
auto begin = str.begin();
auto end = str.end();
while (begin != end && is_digit(*begin)) {
integer_value = static_cast<T>(integer_value * 10 + (*begin++ - '0'));
integer_value = static_cast<T>(integer_value * 10 + static_cast<T>(*begin++ - '0'));
}
return integer_value;
}