Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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()
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>::max() / nmemb) {
if (nmemb != 0 && size > (std::numeric_limits<size_t>::max)() / nmemb) {
return 0;
}
size_t total = size * nmemb;
Expand All @@ -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<size_t>::max() / nitems) {
if (nitems != 0 && size > (std::numeric_limits<size_t>::max)() / nitems) {
return 0;
}
size_t total = size * nitems;
Expand Down
Loading