Skip to content

Commit 5c0acab

Browse files
author
Marco Magdy
committed
Fix clang-tidy benign warnings
Disabled the parameters easily swappable warning because there isn't an easy way to fix that in C++ without introducing another library or a lot of boilerplate code. The code is small enough to not warrant introducing solutions to avoid that warnings.
1 parent e3e9e09 commit 5c0acab

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.clang-tidy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
Checks:
3-
'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,modernize-*,bugprone-*,misc-*,-modernize-use-trailing-return-type'
3+
'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,modernize-*,bugprone-*,misc-*,
4+
-modernize-use-trailing-return-type,-bugprone-easily-swappable-parameters,-readability-identifier-length'
45
WarningsAsErrors: '*'
56
HeaderFilterRegex: 'include/aws/.*\.h$'
67
FormatStyle: 'none'

src/runtime.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <cassert>
2626
#include <chrono>
2727
#include <array>
28+
#include <iterator>
2829
#include <cstdlib> // for strtoul
2930
#include <cinttypes>
3031

@@ -133,12 +134,16 @@ static size_t read_data(char* buffer, size_t size, size_t nitems, void* userdata
133134
}
134135

135136
if (unread <= limit) {
136-
std::copy_n(ctx->first.begin() + ctx->second, unread, buffer);
137+
auto from = ctx->first.begin();
138+
std::advance(from, ctx->second);
139+
std::copy_n(from, unread, buffer);
137140
ctx->second += unread;
138141
return unread;
139142
}
140143

141-
std::copy_n(ctx->first.begin() + ctx->second, limit, buffer);
144+
auto from = ctx->first.begin();
145+
std::advance(from, ctx->second);
146+
std::copy_n(from, limit, buffer);
142147
ctx->second += limit;
143148
return limit;
144149
}

0 commit comments

Comments
 (0)