Fix issuess with potential unsigned int overflow.
Restore semantic of move constructor.
Change-Id: I7fd86e253a3fc3d840cfb94b535c99cba19149eb
{
static_assert(GET_SIZE(DerivedType::KEYS) == GET_SIZE(DerivedType::STATES), "Incorrect activity");
- for (auto i = 0u; i < GET_SIZE(DerivedType::KEYS); i++) {
+ for (size_t i = 0u; i < GET_SIZE(DerivedType::KEYS); i++) {
auto state = Singleton<VConfInterface>::instance().get({DerivedType::KEYS[i]}, 0);
if (!state) {
markAsCompleted();
size_t VconfBoolTypeMenuItem::getIndex() const
{
auto idx = 0;
- for (auto i = 0u; i < vconfStateKeys.size(); ++i) {
+ for (size_t i = 0u; i < vconfStateKeys.size(); ++i) {
auto val = Singleton<VConfInterface>::instance().get(vconfStateKeys[i], false) ? 1 : 0;
idx += val * (1 << i);
}
t->elems = std::move(std::get<0>(elems));
t->names.resize(t->elems.size());
auto atspi = Singleton<UniversalSwitch>::instance().getAtspi();
- for (auto i = 0u; i < t->elems.size(); ++i) {
+ for (size_t i = 0u; i < t->elems.size(); ++i) {
atspi->getName(t->elems[i], [ = ](DBus::ValueOrError<std::string> name) {
if (name) t->names[i] = std::move(std::get<0>(name));
});
auto fakeElem = Rectangle{{menuGeo.position.x, menuGeo.position.y}, {itemSize}};
- for (auto i = 0u; i < itemsNo; ++i) {
+ for (size_t i = 0u; i < itemsNo; ++i) {
if (x > fakeElem.position.x && x < fakeElem.position.x + itemSize.width && y > fakeElem.position.y && y < fakeElem.position.y + itemSize.height)
return gengridItemsData[i].first->getName();
return {};
}
- for (auto i = 0u; i < list.count; i++) {
+ for (size_t i = 0u; i < list.count; i++) {
telephony_call_h *callList;
unsigned int callCount;
break;
}
- for (auto k = 0u; k < callCount; ++k) {
+ for (size_t k = 0u; k < callCount; ++k) {
telephony_call_status_e callState;
error = telephony_call_get_status(callList[i], &callState);
if (error != TELEPHONY_ERROR_NONE) {
return "IDS_MENU_BUTTONS_KEYS_WIFI";
}
- for (auto i = 0u; i < list.count; i++) {
+ for (size_t i = 0u; i < list.count; i++) {
telephony_sim_state_e simState;
error = telephony_sim_get_state(list.handle[i], &simState);
if (error != TELEPHONY_ERROR_NONE) {
virtual void detach(const Observer<T> *observer, const T *item)
{
- for (auto i = 0u; i < observers.size();) {
+ for (size_t i = 0u; i < observers.size();) {
auto tempObserver = observers[i].first.lock();
if (!tempObserver || (tempObserver.get() == observer && observers[i].second->getItem().get() == item)) {
auto exec = std::make_shared<Exec>();
exec->callback = std::move(callback);
exec->results.resize(sources.size());
- for (auto i = 0u; i < sources.size(); ++i) {
+ for (size_t i = 0u; i < sources.size(); ++i) {
makeUIElement(sources[i], [i, exec](DBus::ValueOrError<std::shared_ptr<UIElement>> ui) {
if (!ui) {
if (!exec->error)
auto data = ApplicationInfoIterCbDataType{ nullptr, {}, this, "" };
- for (auto row = 0; row < rows; ++row) {
+ for (size_t row = 0; row < rows; ++row) {
rua_history_get_rec(&record, table, rows, cols, row);
std::get<0>(data) = &record;
}
auto sleep_until = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds{ 400 };
- for (auto i = 0u; i < tapCount; ++i)
+ for (size_t i = 0u; i < tapCount; ++i)
{
executeOnMainThread([&]() {
auto res = utils::generateTapGesture(coord.x, coord.y, 0.0f, fingerCount);
{
std::vector<bool> used(expectedArgCount, false);
detail::Converter<0, expectedArgCount>::convert(args, sourceArgs, firstDefaultArgIndex, defaultArguments, sourceArgs.size());
- for (auto i = 0u; i < sourceArgs.size(); ++i) used[i] = true;
+ for (size_t i = 0u; i < sourceArgs.size(); ++i) used[i] = true;
for (auto &val : sourceArgs.keywords()) {
auto it = keywordIndexes.find(val.first);
if (it == keywordIndexes.end()) {
used[it->second] = true;
detail::Converter<0, expectedArgCount>::convertSingleArgumentByIndex(args, val.second, it->second);
}
- for (auto i = 0u; i < firstDefaultArgIndex; ++i) {
+ for (size_t i = 0u; i < firstDefaultArgIndex; ++i) {
if (!used[i]) {
throw EvaluationFailure{} << "argument " << (i + 1) << " not set";
}
}
- for (auto i = firstDefaultArgIndex; i < expectedArgCount; ++i) {
+ for (size_t i = firstDefaultArgIndex; i < expectedArgCount; ++i) {
if (!used[i]) {
auto &val = defaultArguments[i - firstDefaultArgIndex];
detail::Converter<0, expectedArgCount>::convertSingleArgumentByIndex(args, val, i);
if (name == "states") {
auto tmp = EvaluationContext::getCurrentEvaluationContext().executionInterface().getUIElementStates(value);
EvaluationValueSet v;
- for (auto i = 0u; i < tmp.size(); ++i) {
+ for (size_t i = 0u; i < tmp.size(); ++i) {
if (tmp[i])
v.insert(i);
}
return EvaluationValueBase::oper_order(other);
auto &o = other->asVector();
- for (auto i = 0u; i < std::min(value.size(), o.size()); ++i) {
+ for (size_t i = 0u; i < std::min(value.size(), o.size()); ++i) {
if (value[i] == o[i]) continue;
return value[i] < o[i] ? -1 : 1;
}
auto indexes = getDoubleIndexes(from, to, value.size());
std::vector<EvaluationValue> tmp;
tmp.reserve(indexes.second - indexes.first);
- for (auto i = indexes.first; i < indexes.second; ++i)
+ for (size_t i = indexes.first; i < indexes.second; ++i)
tmp.push_back(value[i]);
return create(std::move(tmp));
}
ASSERT(kind == Kind::DICT);
EvaluationValueDict tmp;
- for (auto i = 0u; i < vals.size(); i += 2) {
+ for (size_t i = 0u; i < vals.size(); i += 2) {
tmp.insert({ std::move(vals[i]), std::move(vals[i + 1]) });
}
return std::move(tmp);
}
}
if (kind == Kind::SET || kind == Kind::VECTOR) {
- for (auto i = 0u; i < values.size(); ++i) {
+ for (size_t i = 0u; i < values.size(); ++i) {
printLocationAndIndent(location(), depth) << "element " << (i + 1);
values[i]->printSelfInfo(depth + 1);
}
os << desc;
}
- for (auto i = 0u; i < args.size(); ++i) {
+ for (size_t i = 0u; i < args.size(); ++i) {
printLocationAndIndent(location(), depth) << "element " << (i + 1);
args[i]->printSelfInfo(depth + 1);
}
return false;
};
auto l = args[0]->evaluate();
- for (auto i = 0u; i < kinds.size(); ++i) {
+ for (size_t i = 0u; i < kinds.size(); ++i) {
auto r = args[i + 1]->evaluate();
if (!cmp(l, r, locations[i], kinds[i]))
return false;
}
}
- for (auto i = 0u; i < args.size(); ++i) {
+ for (size_t i = 0u; i < args.size(); ++i) {
printLocationAndIndent(location(), depth) << "argument " << (i + 1) << " key";
args[i]->printSelfInfo(depth + 1);
}
{
printLocationAndIndent(location(), depth) << "function call";
function->printSelfInfo(depth + 1);
- for (auto i = 0u; i < args.size(); ++i) {
+ for (size_t i = 0u; i < args.size(); ++i) {
printLocationAndIndent(location(), depth) << "arg " << i << " is";
args[i]->printSelfInfo(depth + 1);
}
if (this->argNames.size() != args.size())
throw EvaluationFailure{} << "invalid number of arguments";
EvaluationContext ctx;
- for (auto i = 0u; i < args.size(); ++i)
+ for (size_t i = 0u; i < args.size(); ++i)
{
ctx.setVariable(argNames[i], args[i]);
}
void LambdaEvaluator::printSelfInfo(unsigned int depth) const
{
printLocationAndIndent(location(), depth) << "lambda definition";
- for (auto i = 0u; i < argNames.size(); ++i) {
+ for (size_t i = 0u; i < argNames.size(); ++i) {
printLocationAndIndent(location(), depth) << "arg " << i << " is " << argNames[i];
}
printLocationAndIndent(location(), depth) << "body";
if (this->argNames.size() != args.size())
throw EvaluationFailure{} << "invalid number of arguments";
EvaluationContext ctx(data);
- for (auto i = 0u; i < args.size(); ++i)
+ for (size_t i = 0u; i < args.size(); ++i)
{
ctx.setVariable(argNames[i], args[i]);
}
void FunctionEvaluator::printSelfInfo(unsigned int depth) const
{
printLocationAndIndent(location(), depth) << "function definition " << functionName;
- for (auto i = 0u; i < argNames.size(); ++i) {
+ for (size_t i = 0u; i < argNames.size(); ++i) {
printLocationAndIndent(location(), depth) << "arg " << i << " is " << argNames[i];
}
printLocationAndIndent(location(), depth) << "body";
DebugEvaluator{} << getDebugId() << ": executing main block of wait clause";
exec->evaluate();
DebugEvaluator{} << getDebugId() << ": joining waiters (" << waits.size() << ")";
- for (auto i = 0u; i < waits.size(); ++i) {
+ for (size_t i = 0u; i < waits.size(); ++i) {
DebugEvaluator{} << getDebugId() << ": joining waiter " << i << " from " << waits[i]->getDebugId();
auto &w = waitsValues[i];
w.asWait()->join();
if (f) f();
}
DefferedCall(const DefferedCall &) = delete;
- DefferedCall(DefferedCall &&o)
+ DefferedCall(DefferedCall &&o) noexcept : f(std::move(o.f))
{
- f = o.f;
o.f = {};
}
DefferedCall &operator = (const DefferedCall &) = delete;
- DefferedCall &operator = (DefferedCall &&o)
+ DefferedCall &operator = (DefferedCall &&o) noexcept
{
if (this != &o) {
if (f) f();
- f = o.f;
+ f = std::move(o.f);
o.f = {};
}
return *this;
ASSERT_EQ(tokens.size(), expectedTokens.size());
- for (auto i = 0u; i < tokens.size(); ++i) {
+ for (size_t i = 0u; i < tokens.size(); ++i) {
ASSERT_EQ(tokens[i].text(), std::get<0>(expectedTokens[i])) << "token " << i;
ASSERT_EQ(tokens[i].location().lineNum(), std::get<1>(expectedTokens[i])) << "token " << i;
ASSERT_EQ(tokens[i].location().offsetNum(), std::get<2>(expectedTokens[i])) << "token " << i;
if (q < ' ') q = ' ';
output << std::setw(2) << c << ": " << m << "\n";
if (e.hasLocation() && c == e.location().lineNum()) {
- for (auto i = 1u; i < e.location().offsetNum(); ++i)
+ for (size_t i = 1u; i < e.location().offsetNum(); ++i)
output << " ";
output << " ^\n";
}
EXPECT_EQ(actualMenuItems.size(), expectedMenuItemsNames.size());
- for (auto ii = 0u; ii < actualMenuItems.size(); ++ii) {
+ for (size_t ii = 0u; ii < actualMenuItems.size(); ++ii) {
EXPECT_EQ(actualMenuItems[ii]->getName(), expectedMenuItemsNames[ii]);
}
}
void testVconfTypeMenuItemStates(MenuItem *item, const std::string &key, const std::vector<std::string> &requiredStates, int typeShift)
{
- for (auto ii = 0u; ii < requiredStates.size(); ++ii) {
+ for (size_t ii = 0u; ii < requiredStates.size(); ++ii) {
eventLoop::run([&]() {
if (typeShift)
Singleton<VConfInterface>::instance().set(key, int(ii + typeShift));