Skip to content

Commit

Permalink
fix code-ql warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
phlptp committed Jan 1, 2024
1 parent 71f331d commit 3377bd3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# tell git that the workspace directory is safe
- run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand All @@ -80,7 +84,6 @@ jobs:
- run: |
echo "Run, Build Application using script"
unset VCPKG_ROOT
git config --global --add safe.directory ${GITHUB_WORKSPACE}
source scripts/setup-helics-ci-options.sh
mkdir -p build && cd build
../scripts/ci-build.sh
Expand Down
5 changes: 3 additions & 2 deletions src/helics/application_api/Subscriptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ class VectorSubscription2d {
static_assert(
std::is_base_of<ValueFederate, std::remove_reference_t<decltype(*valueFed)>>::value,
"Second argument must be a pointer to a ValueFederate");
ids.reserve(count_x * count_y);
vals.resize(count_x * count_y, defValue);
std::size_t arrayCount=static_cast<std::size_t>(count_x) * static_cast<std::size_t>(count_y);
ids.reserve(arrayCount);
vals.resizea(arrayCount, defValue);

for (auto ind_x = startIndex_x; ind_x < startIndex_x + count_x; ++ind_x) {
for (auto ind_y = startIndex_y; ind_y < startIndex_y + count_y; ++ind_y) {
Expand Down
2 changes: 1 addition & 1 deletion src/helics/application_api/ValueConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ namespace detail {
// making use of array oriented access for complex numbers
// See https://en.cppreference.com/w/cpp/numeric/complex
checks::swapBytes<8>(reinterpret_cast<std::byte*>(&v));
checks::swapBytes<8>(reinterpret_cast<std::byte*>(&v) + sizeof(double));
checks::swapBytes<8>(reinterpret_cast<std::byte*>(&v) + 8);
}
}
}
Expand Down

0 comments on commit 3377bd3

Please sign in to comment.