fraunhoferhhi/vvdec

Completion of error handling

Closed this issue · 1 comments

Would you like to add more error handling for return values from functions like the following?

👀 Further update candidates were left over.

Example:

template<typename T>
void UnitBuf<T>::writeToFile( std::string filename ) const
{
FILE* f = fopen( filename.c_str(), "w" );
CHECK( f == nullptr, "writeToFile() cannot open file for writing" )
for( auto& b: bufs )
{
for( unsigned y = 0; y < b.height; y++ )
{
fwrite( b.bufAt( 0, y ), sizeof( T ), b.width, f );
}
}
fclose( f );
}

💭 I suggest to avoid ignorance of return values a bit more.
Would you like to detect every error situation as early as possible?