]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
common: fix warning (#8036)
authorJohannes Gäßler <redacted>
Thu, 20 Jun 2024 14:40:13 +0000 (16:40 +0200)
committerGitHub <redacted>
Thu, 20 Jun 2024 14:40:13 +0000 (16:40 +0200)
* common: fix warning

* Update common/common.cpp

Co-authored-by: slaren <redacted>
---------

Co-authored-by: slaren <redacted>
common/common.cpp

index 73ff0e85b7b4e23934c10ca9d67bea860ee35a28..9c23d001bfba97040fb677614b9c5c2049ac5eca 100644 (file)
@@ -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;