fix compilation on clang 19

This commit is contained in:
Max Bachmann 2024-10-24 12:22:56 +02:00
parent 74b5cc60ce
commit 7d9f4ebabf
8 changed files with 21 additions and 18 deletions

View File

@ -60,7 +60,7 @@ jobs:
run: |
git clone https://github.com/rapidfuzz/rapidfuzz-cpp.git
cd rapidfuzz-cpp
git checkout v3.0.5
git checkout v3.1.0
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
@ -104,7 +104,7 @@ jobs:
run: |
git clone https://github.com/rapidfuzz/rapidfuzz-cpp.git
cd rapidfuzz-cpp
git checkout v3.0.5
git checkout v3.1.0
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .

View File

@ -1,6 +1,13 @@
Changelog
---------
[3.10.1] - 2024-10-24
^^^^^^^^^^^^^^^^^^^^^
Fixed
~~~~~
- fix compilation on clang-19
[3.10.0] - 2024-09-21
^^^^^^^^^^^^^^^^^^^^^
Fixed

View File

@ -110,7 +110,7 @@ else()
add_library(Taskflow::Taskflow ALIAS Taskflow)
endif()
find_package(rapidfuzz 3.0.5 QUIET)
find_package(rapidfuzz 3.1.0 QUIET)
if(rapidfuzz_FOUND)
message(STATUS "Using system supplied version of rapidfuzz-cpp")
else()

@ -1 +1 @@
Subproject commit cbdf84388cea0f12d8a02d9bac28d806b178302a
Subproject commit 05036b7055b71017331ce0a95fbbe1fcff399c90

View File

@ -6,7 +6,7 @@ from __future__ import annotations
__author__: str = "Max Bachmann"
__license__: str = "MIT"
__version__: str = "3.10.0"
__version__: str = "3.10.1"
from rapidfuzz import distance, fuzz, process, utils

View File

@ -708,7 +708,7 @@ static inline bool multi_normalized_distance_init(RF_ScorerFunc* self, int64_t s
static inline PyObject* opcodes_apply(const rf::Opcodes& ops, const RF_String& str1, const RF_String& str2)
{
return visitor(str1, str2, [&](auto s1, auto s2) {
auto proc_str = rf::opcodes_apply<uint32_t>(ops, s1, s2);
auto proc_str = rf::opcodes_apply_vec<uint32_t>(ops, s1, s2);
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
});
}
@ -716,7 +716,7 @@ static inline PyObject* opcodes_apply(const rf::Opcodes& ops, const RF_String& s
static inline PyObject* editops_apply(const rf::Editops& ops, const RF_String& str1, const RF_String& str2)
{
return visitor(str1, str2, [&](auto s1, auto s2) {
auto proc_str = rf::editops_apply<uint32_t>(ops, s1, s2);
auto proc_str = rf::editops_apply_vec<uint32_t>(ops, s1, s2);
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
});
}

View File

@ -10,7 +10,7 @@
#include <cwctype>
#include <limits>
#include <stdint.h>
#include <string>
#include <vector>
uint32_t UnicodeDefaultProcess(uint32_t ch);
@ -80,11 +80,10 @@ int64_t default_process(CharT* str, int64_t len)
}
template <typename CharT>
std::basic_string<CharT> default_process(std::basic_string<CharT> s)
std::vector<CharT> default_process_copy(CharT* str_, int64_t len_)
{
std::basic_string<CharT> str(s);
int64_t len = default_process(&str[0], str.size());
std::vector<CharT> str(str_, str_ + len_);
int64_t len = default_process(str.data(), str.size());
str.resize(len);
return str;
}

View File

@ -9,20 +9,17 @@ static inline PyObject* default_process_impl(PyObject* sentence)
switch (c_sentence.kind) {
case RF_UINT8:
{
auto proc_str = default_process(
std::basic_string<uint8_t>(static_cast<uint8_t*>(c_sentence.data), c_sentence.length));
auto proc_str = default_process_copy(static_cast<uint8_t*>(c_sentence.data), c_sentence.length);
return PyUnicode_FromKindAndData(PyUnicode_1BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
}
case RF_UINT16:
{
auto proc_str = default_process(
std::basic_string<uint16_t>(static_cast<uint16_t*>(c_sentence.data), c_sentence.length));
auto proc_str = default_process_copy(static_cast<uint16_t*>(c_sentence.data), c_sentence.length);
return PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
}
case RF_UINT32:
{
auto proc_str = default_process(
std::basic_string<uint32_t>(static_cast<uint32_t*>(c_sentence.data), c_sentence.length));
auto proc_str = default_process_copy(static_cast<uint32_t*>(c_sentence.data), c_sentence.length);
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size());
}
// ToDo: for now do not process these elements should be done in some way in the future