libwebm_utils: Add FileDeleter.
Put the FILE clean up functor in a common place to avoid duplication. Change-Id: I7bcb5b3e4df7aa37bb90920ecb8acccf94eeaa57
This commit is contained in:
@@ -13,6 +13,16 @@
|
||||
|
||||
namespace libwebm {
|
||||
|
||||
// fclose functor for wrapping FILE in std::unique_ptr.
|
||||
struct FILEDeleter {
|
||||
int operator()(FILE* f) {
|
||||
if (f != nullptr)
|
||||
return fclose(f);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
typedef std::unique_ptr<FILE, FILEDeleter> FilePtr;
|
||||
|
||||
struct Range {
|
||||
Range(std::size_t off, std::size_t len) : offset(off), length(len) {}
|
||||
Range() = delete;
|
||||
|
||||
Reference in New Issue
Block a user