mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-10-29 08:41:22 +00:00
chat : fix debug build assertion in trim function (#15520)
This commit is contained in:
@@ -16,10 +16,10 @@
|
|||||||
static std::string trim(const std::string & str) {
|
static std::string trim(const std::string & str) {
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
size_t end = str.size();
|
size_t end = str.size();
|
||||||
while (start < end && isspace(str[start])) {
|
while (start < end && isspace(static_cast<unsigned char>(str[start]))) {
|
||||||
start += 1;
|
start += 1;
|
||||||
}
|
}
|
||||||
while (end > start && isspace(str[end - 1])) {
|
while (end > start && isspace(static_cast<unsigned char>(str[end - 1]))) {
|
||||||
end -= 1;
|
end -= 1;
|
||||||
}
|
}
|
||||||
return str.substr(start, end - start);
|
return str.substr(start, end - start);
|
||||||
|
|||||||
Reference in New Issue
Block a user