Skip to content

Commit

Permalink
Fix clang-tidy benign warnings (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomagdy committed Feb 14, 2023
1 parent e3e9e09 commit fbfdaec
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
Checks:
'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,modernize-*,bugprone-*,misc-*,-modernize-use-trailing-return-type'
'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,modernize-*,bugprone-*,misc-*,
-modernize-use-trailing-return-type,-bugprone-easily-swappable-parameters,-readability-identifier-length'
WarningsAsErrors: '*'
HeaderFilterRegex: 'include/aws/.*\.h$'
FormatStyle: 'none'
Expand Down
5 changes: 5 additions & 0 deletions ci/codebuild/format-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ FAIL=0
SOURCE_FILES=$(find src include tests -type f -name "*.h" -o -name "*.cpp")
for i in $SOURCE_FILES
do
if [[ "$i" == *"gtest.h" || "$i" == *"backward.h" ]]; then
continue
fi

echo "$i\n"
if [ $($CLANG_FORMAT -output-replacements-xml $i | grep -c "<replacement ") -ne 0 ]
then
echo "$i failed clang-format check."
Expand Down
3 changes: 1 addition & 2 deletions include/aws/lambda-runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ class invocation_response {
bool is_success() const { return m_success; }
};

struct no_result {
};
struct no_result {};

class runtime {
public:
Expand Down
9 changes: 7 additions & 2 deletions src/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <cassert>
#include <chrono>
#include <array>
#include <iterator>
#include <cstdlib> // for strtoul
#include <cinttypes>

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

if (unread <= limit) {
std::copy_n(ctx->first.begin() + ctx->second, unread, buffer);
auto from = ctx->first.begin();
std::advance(from, ctx->second);
std::copy_n(from, unread, buffer);
ctx->second += unread;
return unread;
}

std::copy_n(ctx->first.begin() + ctx->second, limit, buffer);
auto from = ctx->first.begin();
std::advance(from, ctx->second);
std::copy_n(from, limit, buffer);
ctx->second += limit;
return limit;
}
Expand Down

0 comments on commit fbfdaec

Please sign in to comment.