common : cont

ggml-ci
This commit is contained in:
Georgi Gerganov 2025-01-12 16:19:18 +02:00
parent 10eb87409e
commit a59ee7c4eb
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 4 additions and 4 deletions

View file

@ -19,7 +19,7 @@ function(llama_add_compile_flags)
list(APPEND CXX_FLAGS -Wshadow) list(APPEND CXX_FLAGS -Wshadow)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND CXX_FLAGS -Wshadow -Wshadow-field-in-constructor) list(APPEND CXX_FLAGS -Wshadow-field-in-constructor)
endif() endif()
endif() endif()

View file

@ -1208,7 +1208,7 @@ static bool common_download_file(const std::string & url, const std::string & pa
{ {
typedef size_t(*CURLOPT_HEADERFUNCTION_PTR)(char *, size_t, size_t, void *); typedef size_t(*CURLOPT_HEADERFUNCTION_PTR)(char *, size_t, size_t, void *);
auto header_callback = [](char * buffer, size_t /*size*/, size_t n_items, void * userdata) -> size_t { auto header_callback = [](char * buffer, size_t /*size*/, size_t n_items, void * userdata) -> size_t {
common_load_model_from_url_headers * headers = (common_load_model_from_url_headers *) userdata; common_load_model_from_url_headers * cur = (common_load_model_from_url_headers *) userdata;
static std::regex header_regex("([^:]+): (.*)\r\n"); static std::regex header_regex("([^:]+): (.*)\r\n");
static std::regex etag_regex("ETag", std::regex_constants::icase); static std::regex etag_regex("ETag", std::regex_constants::icase);
@ -1220,9 +1220,9 @@ static bool common_download_file(const std::string & url, const std::string & pa
const std::string & key = match[1]; const std::string & key = match[1];
const std::string & value = match[2]; const std::string & value = match[2];
if (std::regex_match(key, match, etag_regex)) { if (std::regex_match(key, match, etag_regex)) {
headers->etag = value; cur->etag = value;
} else if (std::regex_match(key, match, last_modified_regex)) { } else if (std::regex_match(key, match, last_modified_regex)) {
headers->last_modified = value; cur->last_modified = value;
} }
} }
return n_items; return n_items;