mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-11 15:16:27 +01:00
Bug1829, more: check all errors flushing and closing export files...
... MP3 export already did this, the other five needed work.
This commit is contained in:
@@ -127,7 +127,16 @@ inline R SFCall(F fun, Args&&... args)
|
||||
}
|
||||
|
||||
//RAII for SNDFILE*
|
||||
struct SFFileCloser { void operator () (SNDFILE*) const; };
|
||||
using SFFile = std::unique_ptr<SNDFILE, SFFileCloser>;
|
||||
struct SFFileCloser { int operator () (SNDFILE*) const; };
|
||||
struct SFFile : public std::unique_ptr<SNDFILE, SFFileCloser>
|
||||
{
|
||||
// Close explicitly, not ignoring return values.
|
||||
int close()
|
||||
{
|
||||
auto result = get_deleter() ( get() );
|
||||
release();
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user