Skip to content

Commit

Permalink
azure-storage-cpp: fix removed ptr_fun
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Nov 16, 2023
1 parent ccbb55d commit be2c683
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions recipes/azure-storage-cpp/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ sources:
"7.5.0":
url: "https://github.com/Azure/azure-storage-cpp/archive/refs/tags/v7.5.0.tar.gz"
sha256: "446a821d115949f6511b7eb01e6a0e4f014b17bfeba0f3dc33a51750a9d5eca5"
patches:
"7.5.0":
- patch_file: "patches/7.5.0-fix-removed-ptr_fun.patch"
patch_type: "portability"
patch_description: "Fix usage of ptr_fun, which was removed in C++17"
5 changes: 4 additions & 1 deletion recipes/azure-storage-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, replace_in_file
from conan.tools.files import copy, get, replace_in_file, export_conandata_patches, apply_conandata_patches, rm
from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc
from conan.tools.scm import Version

Expand Down Expand Up @@ -46,6 +46,7 @@ def _minimum_compiler_version(self):
}

def export_sources(self):
export_conandata_patches(self)
copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder)

def config_options(self):
Expand Down Expand Up @@ -112,6 +113,8 @@ def generate(self):
deps.generate()

def _patch_sources(self):
rm(self, "Find*.cmake", os.path.join("Microsoft.WindowsAzure.Storage", "cmake", "Modules"))
apply_conandata_patches(self)
cmakelists_path = os.path.join(self.source_folder, "Microsoft.WindowsAzure.Storage", "CMakeLists.txt")
replace_in_file(self, cmakelists_path, "-std=c++11", "")
replace_in_file(self, cmakelists_path, "-stdlib=libc++", "")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- Microsoft.WindowsAzure.Storage/src/util.cpp
+++ Microsoft.WindowsAzure.Storage/src/util.cpp
@@ -334,8 +334,8 @@

utility::string_t str_trim_starting_trailing_whitespaces(const utility::string_t& str)
{
- auto non_space_begin = std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun<int, int>(isspace)));
- auto non_space_end = std::find_if(str.rbegin(), str.rend(), std::not1(std::ptr_fun<int, int>(isspace))).base();
+ auto non_space_begin = std::find_if(str.begin(), str.end(), [](unsigned char c) { return !std::isspace(c); });
+ auto non_space_end = std::find_if(str.rbegin(), str.rend(), [](unsigned char c) { return !std::isspace(c); }).base();
return utility::string_t(non_space_begin, non_space_end);
}

0 comments on commit be2c683

Please sign in to comment.