From 14b20e4b8b9bc7ed3b234e8426776563a54bcfd2 Mon Sep 17 00:00:00 2001 From: Oleg Lomaka Date: Mon, 4 Mar 2024 07:27:31 -0500 Subject: [PATCH] Remove some compilation and CI warnings --- .github/workflows/build.yml | 18 +++++++++--------- build/fr.cpp | 5 +++-- src/calcwit.cpp | 5 +++-- src/witnesscalc.cpp | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 08eb701..160d4d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: submodules: "recursive" - name: Cache gmp build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | depends/gmp @@ -103,7 +103,7 @@ jobs: cd ../ - name: Cache circuits - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | circuits @@ -126,7 +126,7 @@ jobs: ./run_tests.sh - name: upload macOS arm64 artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: witnesscalc-macOS-arm64 path: | @@ -134,7 +134,7 @@ jobs: if-no-files-found: error - name: upload iOS artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: witnesscalc-iOS path: | @@ -142,7 +142,7 @@ jobs: if-no-files-found: error - name: upload iOS Simulator artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: witnesscalc-iOS-Simulator path: | @@ -163,7 +163,7 @@ jobs: version: 1.0 - name: Cache gmp build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | depends/gmp @@ -189,7 +189,7 @@ jobs: run: make android_x86_64 - name: upload Linux amd64 artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: witnesscalc-linux-amd64 path: | @@ -197,7 +197,7 @@ jobs: if-no-files-found: error - name: upload Android artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: witnesscalc-Android path: | @@ -205,7 +205,7 @@ jobs: if-no-files-found: error - name: upload Android x86_64 artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: witnesscalc-Android-x86_64 path: | diff --git a/build/fr.cpp b/build/fr.cpp index 415a824..9fc8501 100644 --- a/build/fr.cpp +++ b/build/fr.cpp @@ -65,8 +65,9 @@ char *Fr_element2str(PFrElement pE) { mpz_t r; if (!(pE->type & Fr_LONG)) { if (pE->shortVal>=0) { - char *r = new char[32]; - sprintf(r, "%d", pE->shortVal); + const size_t rLn = 32; + char *r = new char[rLn]; + snprintf(r, rLn, "%d", pE->shortVal); return r; } else { mpz_init_set_si(r, pE->shortVal); diff --git a/src/calcwit.cpp b/src/calcwit.cpp index daa9c89..b43305a 100644 --- a/src/calcwit.cpp +++ b/src/calcwit.cpp @@ -107,8 +107,9 @@ void Circom_CalcWit::setInputSignal(u64 h, uint i, FrElement & val){ uint si = circuit->InputHashMap[pos].signalid+i; if (inputSignalAssigned[si-get_main_input_signal_start()]) { fprintf(stderr, "Signal assigned twice: %d\n", si); - char err[256]; - sprintf(err, "Signal assigned twice: %d", si); + const size_t errLn = 256; + char err[errLn]; + snprintf(err, errLn, "Signal assigned twice: %d", si); throw std::runtime_error(err); } signalValues[si] = val; diff --git a/src/witnesscalc.cpp b/src/witnesscalc.cpp index f228df9..59b5239 100644 --- a/src/witnesscalc.cpp +++ b/src/witnesscalc.cpp @@ -85,7 +85,7 @@ Circom_Circuit* loadCircuit(const void *buffer, unsigned long buffer_size) { templateInsId2IOSignalInfo1[index[i]] = p; } } - circuit->templateInsId2IOSignalInfo = move(templateInsId2IOSignalInfo1); + circuit->templateInsId2IOSignalInfo = std::move(templateInsId2IOSignalInfo1); return circuit; }