Skip to content

Commit 769aaae

Browse files
committed
use a custom type instead of a pointer function (shut a warning off)
1 parent b0dddfe commit 769aaae

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

library/core/Image.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ namespace gf {
5656
return static_cast<int>(stream->finished());
5757
}
5858

59+
struct FileCloseDeleter {
60+
void operator()(std::FILE* file) const noexcept
61+
{
62+
std::fclose(file);
63+
}
64+
};
65+
5966
} // namespace
6067

6168
Image::Image()
@@ -268,7 +275,7 @@ namespace gf {
268275

269276
Vec2I image_size(const std::filesystem::path& filename)
270277
{
271-
const std::unique_ptr<std::FILE, decltype(&std::fclose)> file(std::fopen(filename.string().c_str(), "rb"), std::fclose);
278+
const std::unique_ptr<std::FILE, FileCloseDeleter> file(std::fopen(filename.string().c_str(), "rb"));
272279

273280
if (!file) {
274281
Log::fatal("Unknwon file: {}", filename.string());

0 commit comments

Comments
 (0)