From 6ecb1a268beb82f5bfd22e1a772a76420a0c521f Mon Sep 17 00:00:00 2001 From: yuygfgg <140488233+yuygfgg@users.noreply.github.com> Date: Wed, 9 Oct 2024 13:02:55 +0800 Subject: [PATCH] silence sprintf deprecated warnings and enable imwri in macos build (#11) --- .github/workflows/macos.yml | 16 ++++++++-------- src/core/vscore.cpp | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 39291e48..3fce1188 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -11,7 +11,7 @@ jobs: CXX: clang++ steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Print compiler version run: ${{ env.CC }} --version @@ -19,7 +19,7 @@ jobs: - name: Install autotools run: | brew update - brew install automake autoconf libtool pkg-config + brew install automake autoconf libtool pkg-config llvm - name: Install zimg run: | @@ -33,7 +33,7 @@ jobs: rm -rf zimg - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: # Version range or exact version of a Python version to use, using SemVer's version range syntax. python-version: 3.9 @@ -48,12 +48,10 @@ jobs: - name: configure run: | + export CC=/opt/homebrew/opt/llvm/bin/clang + export CXX=/opt/homebrew/opt/llvm/bin/clang++ ./autogen.sh - # somehow newer macOS imagemagick requires -fopenmp to build? - ./configure --disable-imwri - - - name: make - run: make -j3 + ./configure - name: make install run: | @@ -62,3 +60,5 @@ jobs: - name: Run test run: python -m unittest discover -s test -p "*test.py" + + diff --git a/src/core/vscore.cpp b/src/core/vscore.cpp index ab080422..99efe3b4 100644 --- a/src/core/vscore.cpp +++ b/src/core/vscore.cpp @@ -1493,7 +1493,7 @@ const vs3::VSVideoFormat *VSCore::queryVideoFormat3(vs3::VSColorFamily colorFami if (sampleType == stFloat) strcpy(suffix, (bitsPerSample == 32) ? "S" : "H"); else - sprintf(suffix, "%d", (colorFamily == vs3::cmRGB ? 3:1) * bitsPerSample); + snprintf(suffix, sizeof(suffix), "%d", (colorFamily == vs3::cmRGB ? 3 : 1) * bitsPerSample); const char *yuvName = nullptr; @@ -1853,7 +1853,7 @@ bool VSCore::getVideoFormatName(const VSVideoFormat &format, char *buffer) noexc if (format.sampleType == stFloat) strcpy(suffix, (format.bitsPerSample == 32) ? "S" : "H"); else - sprintf(suffix, "%d", (format.colorFamily == cfRGB ? 3:1) * format.bitsPerSample); + snprintf(suffix, sizeof(suffix), "%d", (format.colorFamily == cfRGB ? 3 : 1) * format.bitsPerSample); const char *yuvName = nullptr;