diff options
author | Johannes Gäßler <johannesg@5d6.de> | 2024-06-20 16:40:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 16:40:13 +0200 |
commit | abd894ad96a242043b8e197ec130d8649eead22e (patch) | |
tree | 7005bdca9cdae44bd9b6bb00116ec1655c59664d /common/common.cpp | |
parent | de391e4c803383bbea054b6edd016e78c024a74d (diff) |
common: fix warning (#8036)
* common: fix warning
* Update common/common.cpp
Co-authored-by: slaren <slarengh@gmail.com>
---------
Co-authored-by: slaren <slarengh@gmail.com>
Diffstat (limited to 'common/common.cpp')
-rw-r--r-- | common/common.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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 <algorithm> -#include <cassert> #include <cinttypes> #include <cmath> #include <codecvt> @@ -2657,7 +2656,14 @@ static bool llama_download_file(const std::string & url, const std::string & pat } // Set the output file - std::unique_ptr<FILE, decltype(&fclose)> outfile(fopen(path_temporary.c_str(), "wb"), fclose); + + struct FILE_deleter { + void operator()(FILE * f) const { + fclose(f); + } + }; + + std::unique_ptr<FILE, FILE_deleter> 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; |