diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml index 9dba6df..c7139c8 100644 --- a/.github/workflows/cmake-windows.yml +++ b/.github/workflows/cmake-windows.yml @@ -5,8 +5,6 @@ on: [push, pull_request] env: BUILD_TYPE: RelWithDebInfo CMAKE_BUILD_PARALLEL_LEVEL: 3 - VCPKG_MANIFEST_DIR: .github - VCPKG_INSTALLED_DIR: ${{ github.workspace }}/build/vcpkg_installed jobs: build: @@ -14,27 +12,20 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Cache vcpkg uses: actions/cache@v4 with: path: ${{ github.workspace }}/vcpkg_cache - key: vcpkg-${{ hashFiles(format('{0}/vcpkg.json', env.VCPKG_MANIFEST_DIR)) }} + key: vcpkg-${{ hashFiles('vcpkg.json') }} - - name: Prepare vcpkg and libraries - uses: lukka/run-vcpkg@v11 - with: - vcpkgJsonGlob: ${{ env.VCPKG_MANIFEST_DIR }}/vcpkg.json - runVcpkgInstall: true + - name: Configure CMake env: VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg_cache,readwrite - - - name: Configure CMake run: | cmake -A x64 -S . -B build "-DCMAKE_BUILD_TYPE=${env:BUILD_TYPE}" ` - "-DCMAKE_TOOLCHAIN_FILE=${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" ` - "-DVCPKG_MANIFEST_DIR=${{ env.VCPKG_MANIFEST_DIR }}" + "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" - name: Build run: cmake --build build --config ${env:BUILD_TYPE} diff --git a/lib/libpcsc-cpp/tests/mock/test-byte-vector-string-operator.cpp b/lib/libpcsc-cpp/tests/mock/test-byte-vector-string-operator.cpp index e96604d..96db686 100644 --- a/lib/libpcsc-cpp/tests/mock/test-byte-vector-string-operator.cpp +++ b/lib/libpcsc-cpp/tests/mock/test-byte-vector-string-operator.cpp @@ -31,7 +31,7 @@ TEST(byte_vector_stringOperatorTest, appendsHexToNonEmptyString) byte_vector data = {0x12, 0x34, 0xAB, 0xFF}; std::string prefix = "prefix-"; - std::string result = prefix + data; + std::string result = std::move(prefix) + data; EXPECT_EQ(result, "prefix-1234abff"); } @@ -41,7 +41,7 @@ TEST(byte_vector_stringOperatorTest, appendsHexToEmptyString) byte_vector data = {0x01, 0xA0, 0xFF}; std::string prefix; - std::string result = prefix + data; + std::string result = std::move(prefix) + data; EXPECT_EQ(result, "01a0ff"); } @@ -51,7 +51,7 @@ TEST(byte_vector_stringOperatorTest, handlesEmptyByteVector) byte_vector data; std::string prefix = "nothing-changes-"; - std::string result = prefix + data; + std::string result = std::move(prefix) + data; EXPECT_EQ(result, "nothing-changes-"); } diff --git a/src/electronic-ids/pcsc/EIDThales.cpp b/src/electronic-ids/pcsc/EIDThales.cpp index 4988ba5..d2f66fc 100644 --- a/src/electronic-ids/pcsc/EIDThales.cpp +++ b/src/electronic-ids/pcsc/EIDThales.cpp @@ -69,7 +69,7 @@ byte_vector EIDThales::getCertificateImpl(const SmartCard::Session& session, ElectronicID::PinInfo EIDThales::pinRetriesLeft(const SmartCard::Session& session, byte_type pinReference, bool pinActive) const { - const auto GET_DATA = smartcard().protocol() == SmartCard::Protocol::T1 + const auto& GET_DATA = smartcard().protocol() == SmartCard::Protocol::T1 ? CommandApdu {0x00, 0xCB, 0x00, 0xFF, {0xA0, 0x03, 0x83, 0x01, pinReference}, 0x00} : CommandApdu {0x00, 0xCB, 0x00, 0xFF, {0xA0, 0x03, 0x83, 0x01, pinReference}}; const auto response = session.transmit(GET_DATA); diff --git a/src/electronic-ids/pcsc/LatEIDIDEMIAv2.cpp b/src/electronic-ids/pcsc/LatEIDIDEMIAv2.cpp index df8097f..23e231e 100644 --- a/src/electronic-ids/pcsc/LatEIDIDEMIAv2.cpp +++ b/src/electronic-ids/pcsc/LatEIDIDEMIAv2.cpp @@ -117,7 +117,9 @@ TLV LatEIDIDEMIAV2::readEF_File(const SmartCard::Session& session, byte_vector f if (auto it = cache.find(file); it != cache.end()) { return TLV(it->second); } - return TLV(cache[std::move(file)] = readFile(session, CommandApdu::selectEF(0x02, file))); + auto value = readFile(session, CommandApdu::selectEF(0x02, file)); + auto it = cache.try_emplace(std::move(file), std::move(value)).first; + return TLV(it->second); } TLV LatEIDIDEMIAV2::readDCODInfo(const SmartCard::Session& session, byte_type type, diff --git a/.github/vcpkg.json b/vcpkg.json similarity index 100% rename from .github/vcpkg.json rename to vcpkg.json