1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Fix Cppcheck 1.75 warnings (#159)

- The scope of the variable 'last_index' & 'index' could be reduced.
- Prefer prefix ++/-- operators for non-primitive types.
This commit is contained in:
Huemac
2016-08-14 22:29:53 +03:00
committed by Matias Fontanini
parent e843ee7117
commit 64725e2ed9
2 changed files with 2 additions and 2 deletions

View File

@@ -287,8 +287,8 @@ void DNS::add_additional(const resource& resource){
string DNS::encode_domain_name(const string& dn) {
string output;
size_t last_index(0), index;
if (!dn.empty()) {
size_t last_index(0), index;
while ((index = dn.find('.', last_index+1)) != string::npos) {
output.push_back(static_cast<char>(index - last_index));
output.append(dn.begin() + last_index, dn.begin() + index);

View File

@@ -215,7 +215,7 @@ void LLC::write_serialization(uint8_t* buffer, uint32_t total_sz, const Tins::PD
break;
}
for (field_list::const_iterator it = information_fields_.begin(); it != information_fields_.end(); it++) {
for (field_list::const_iterator it = information_fields_.begin(); it != information_fields_.end(); ++it) {
stream.write(it->begin(), it->end());
}
}