From: Johannes Gäßler Date: Thu, 20 Jun 2024 14:40:13 +0000 (+0200) Subject: common: fix warning (#8036) X-Git-Tag: upstream/0.0.4488~1297 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=abd894ad96a242043b8e197ec130d8649eead22e;p=pkg%2Fggml%2Fsources%2Fllama.cpp common: fix warning (#8036) * common: fix warning * Update common/common.cpp Co-authored-by: slaren --------- Co-authored-by: slaren --- diff --git a/common/common.cpp b/common/common.cpp index 73ff0e85..9c23d001 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -6,7 +6,6 @@ #include "llama.h" #include -#include #include #include #include @@ -2657,7 +2656,14 @@ static bool llama_download_file(const std::string & url, const std::string & pat } // Set the output file - std::unique_ptr outfile(fopen(path_temporary.c_str(), "wb"), fclose); + + struct FILE_deleter { + void operator()(FILE * f) const { + fclose(f); + } + }; + + std::unique_ptr outfile(fopen(path_temporary.c_str(), "wb")); if (!outfile) { fprintf(stderr, "%s: error opening local file for writing: %s\n", __func__, path.c_str()); return false;