diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a161eb..aa09bf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - name: Build run: | mkdir build && cd build - cmake -DWRAPSLASH_BUILD_TESTS=ON .. + cmake -DWRAPSLASH_BUILD_TESTS=ON -DWRAPSLASH_BUILD_EXAMPLES=ON .. cmake --build . - name: Test @@ -40,7 +40,7 @@ jobs: - name: Build run: | mkdir build && cd build - cmake -DWRAPSLASH_BUILD_TESTS=ON .. + cmake -DWRAPSLASH_BUILD_TESTS=ON -DWRAPSLASH_BUILD_EXAMPLES=ON .. cmake --build . - name: Test @@ -53,23 +53,22 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install vcpkg + - name: Setup vcpkg run: | git clone https://github.com/microsoft/vcpkg.git C:\vcpkg C:\vcpkg\bootstrap-vcpkg.bat - - - name: Install dependencies - run: | - C:\vcpkg\vcpkg.exe install curl:x64-windows nlohmann-json:x64-windows openssl:x64-windows + shell: cmd - name: Build run: | mkdir build cd build - cmake -DWRAPSLASH_BUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake .. + cmake -DWRAPSLASH_BUILD_TESTS=ON -DWRAPSLASH_BUILD_EXAMPLES=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake .. cmake --build . --config Release + shell: cmd - name: Test run: | cd build ctest --output-on-failure -C Release + shell: cmd diff --git a/CMakeLists.txt b/CMakeLists.txt index f345ff2..008296f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.16) project(wrapsplash++ VERSION 1.0.0 LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -40,7 +40,7 @@ target_link_libraries(wrapsplash++ PUBLIC OpenSSL::Crypto ) -target_compile_features(wrapsplash++ PUBLIC cxx_std_17) +target_compile_features(wrapsplash++ PUBLIC cxx_std_20) if(WRAPSLASH_BUILD_TESTS) enable_testing() diff --git a/README.md b/README.md index eb1ac5e..b067391 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # WrapSplash++ v1.0.0 -[![license](https://img.shields.io/github/license/Sandeepv68/wrapsplash-cpp.svg)](https://github.com/Sandeepv68/wrapsplash-cpp/blob/master/LICENSE) ![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg) ![cpp version](https://img.shields.io/badge/C%2B%2B-17-blue.svg) [![CI](https://github.com/Sandeepv68/wrapsplash-cpp/workflows/CI/badge.svg)](https://github.com/Sandeepv68/wrapsplash-cpp/actions?query=workflow%3ACI) ![GitHub issues](https://img.shields.io/github/issues/Sandeepv68/wrapsplash-cpp.svg) ![GitHub forks](https://img.shields.io/github/forks/Sandeepv68/wrapsplash-cpp.svg) ![GitHub stars](https://img.shields.io/github/stars/Sandeepv68/wrapsplash-cpp.svg) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![C++17](https://img.shields.io/badge/C%2B%2B-17-blue.svg)](https://en.cppreference.com/w/cpp/17) +[![CI](https://github.com/Sandeepv68/wrapsplash-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/Sandeepv68/wrapsplash-cpp/actions/workflows/ci.yml) +[![GitHub issues](https://img.shields.io/github/issues/Sandeepv68/wrapsplash-cpp.svg)](https://github.com/Sandeepv68/wrapsplash-cpp/issues) +[![GitHub forks](https://img.shields.io/github/forks/Sandeepv68/wrapsplash-cpp.svg)](https://github.com/Sandeepv68/wrapsplash-cpp/network/members) +[![GitHub stars](https://img.shields.io/github/stars/Sandeepv68/wrapsplash-cpp.svg)](https://github.com/Sandeepv68/wrapsplash-cpp/stargazers) WrapSplash++ is a simple, synchronous API wrapper for the popular [Unsplash](https://unsplash.com/) platform. The library is written in **C++17**, built with **CMake**, and can be used in any C++ project. This is a C++ port of the popular [wrapsplash](https://www.npmjs.com/package/wrapsplash) TypeScript library. Unsplash provides beautiful high quality free images and photos that you can download and use for any project without any attribution. diff --git a/src/http_client.cpp b/src/http_client.cpp index 498e2b4..1bd27ba 100644 --- a/src/http_client.cpp +++ b/src/http_client.cpp @@ -11,7 +11,7 @@ namespace { size_t write_callback(char* ptr, size_t size, size_t nmemb, std::string* data) { - if (nmemb != 0 && size > std::numeric_limits::max() / nmemb) { + if (nmemb != 0 && size > (std::numeric_limits::max)() / nmemb) { return 0; } size_t total = size * nmemb; @@ -20,7 +20,7 @@ size_t write_callback(char* ptr, size_t size, size_t nmemb, std::string* data) { } size_t header_callback(char* buffer, size_t size, size_t nitems, void* userdata) { - if (nitems != 0 && size > std::numeric_limits::max() / nitems) { + if (nitems != 0 && size > (std::numeric_limits::max)() / nitems) { return 0; } size_t total = size * nitems;