From 6a002cda46009b8d4feea15aa66567043ea51ecc Mon Sep 17 00:00:00 2001 From: SChernykh Date: Wed, 27 Oct 2021 15:16:25 +0200 Subject: [PATCH] Create msvc-analysis.yml --- .github/workflows/msvc-analysis.yml | 61 +++++++++++++++++++++++++++++ src/p2pool.h | 6 +-- src/pow_hash.h | 6 +-- 3 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/msvc-analysis.yml diff --git a/.github/workflows/msvc-analysis.yml b/.github/workflows/msvc-analysis.yml new file mode 100644 index 0000000..ad857df --- /dev/null +++ b/.github/workflows/msvc-analysis.yml @@ -0,0 +1,61 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# +# Find more information at: +# https://github.com/microsoft/msvc-code-analysis-action + +name: Microsoft C++ Code Analysis + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '40 10 * * 0' + +env: + # Path to the CMake build directory. + build: '${{ github.workspace }}/build' + +jobs: + analyze: + name: Analyze + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + submodules: true + + - name: Configure CMake + run: cmake -B ${{ env.build }} + + # Build is not required unless generated source files are used + # - name: Build CMake + # run: cmake --build ${{ env.build }} + + - name: Initialize MSVC Code Analysis + uses: microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99 + # Provide a unique ID to access the sarif output path + id: run-analysis + with: + cmakeBuildDirectory: ${{ env.build }} + # Ruleset file that will determine what checks will be run + ruleset: NativeRecommendedRules.ruleset + + # Upload SARIF file to GitHub Code Scanning Alerts + - name: Upload SARIF to GitHub + uses: github/codeql-action/upload-sarif@v1 + with: + sarif_file: ${{ steps.run-analysis.outputs.sarif }} + + # Upload SARIF file as an Artifact to download and view + - name: Upload SARIF as an Artifact + uses: actions/upload-artifact@v2 + with: + name: sarif-file + path: ${{ steps.run-analysis.outputs.sarif }} diff --git a/src/p2pool.h b/src/p2pool.h index c69b9f3..144bb5e 100644 --- a/src/p2pool.h +++ b/src/p2pool.h @@ -157,9 +157,9 @@ private: struct SubmitBlockData { - uint32_t template_id; - uint32_t nonce; - uint32_t extra_nonce; + uint32_t template_id = 0; + uint32_t nonce = 0; + uint32_t extra_nonce = 0; std::vector blob; }; diff --git a/src/pow_hash.h b/src/pow_hash.h index 21f4778..ee2e0d8 100644 --- a/src/pow_hash.h +++ b/src/pow_hash.h @@ -44,8 +44,8 @@ private: struct ThreadSafeVM { - uv_mutex_t mutex; - randomx_vm* vm; + uv_mutex_t mutex{}; + randomx_vm* vm = nullptr; }; p2pool* m_pool; @@ -62,7 +62,7 @@ private: // 1: light VM for the previous seed // 2: full dataset VM for the current seed enum { FULL_DATASET_VM = 2 }; - ThreadSafeVM m_vm[3]; + ThreadSafeVM m_vm[3]{}; hash m_seed[2]; uint32_t m_index;