mirror of
https://github.com/fmang/opustags.git
synced 2025-01-15 12:43:17 +01:00
Wrap fclose to avoid compiler warnings
This commit is contained in:
parent
d9b051210b
commit
3293647e8f
@ -119,13 +119,16 @@ using byte_string_view = std::basic_string_view<uint8_t>;
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** fclose wrapper for std::unique_ptr’s deleter. */
|
||||
void close_file(FILE*);
|
||||
|
||||
/**
|
||||
* Smart auto-closing FILE* handle.
|
||||
*
|
||||
* It implictly converts from an already opened FILE*.
|
||||
*/
|
||||
struct file : std::unique_ptr<FILE, decltype(&fclose)> {
|
||||
file(FILE* f = nullptr) : std::unique_ptr<FILE, decltype(&fclose)>(f, &fclose) {}
|
||||
struct file : std::unique_ptr<FILE, decltype(&close_file)> {
|
||||
file(FILE* f = nullptr) : std::unique_ptr<FILE, decltype(&close_file)>(f, &close_file) {}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,11 @@ ot::byte_string_view operator""_bsv(const char* data, size_t size)
|
||||
return ot::byte_string_view(reinterpret_cast<const uint8_t*>(data), size);
|
||||
}
|
||||
|
||||
void ot::close_file(FILE* file)
|
||||
{
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void ot::partial_file::open(const char* destination)
|
||||
{
|
||||
final_name = destination;
|
||||
|
Loading…
x
Reference in New Issue
Block a user