1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 12:14:26 +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);