Skip to content

Commit

Permalink
common: fix warning (ggerganov#8036)
Browse files Browse the repository at this point in the history
* common: fix warning

* Update common/common.cpp

Co-authored-by: slaren <[email protected]>

---------

Co-authored-by: slaren <[email protected]>
  • Loading branch information
JohannesGaessler and slaren authored Jun 20, 2024
1 parent de391e4 commit abd894a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "llama.h"

#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <codecvt>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit abd894a

Please sign in to comment.