mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
add flushed fwrite in Valgrind mode
This commit is contained in:
@@ -28,6 +28,18 @@
|
||||
#endif
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
|
||||
#ifdef FLAC__VALGRIND_TESTING
|
||||
static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
{
|
||||
size_t ret = fwrite(ptr, size, nmemb, stream);
|
||||
if(!ferror(stream))
|
||||
fflush(stream);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#define local__fwrite fwrite
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
FILE *file;
|
||||
} encoder_client_struct;
|
||||
@@ -38,7 +50,7 @@ static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__Stream
|
||||
|
||||
(void)encoder, (void)samples, (void)current_frame;
|
||||
|
||||
if(fwrite(buffer, 1, bytes, ecd->file) != bytes)
|
||||
if(local__fwrite(buffer, 1, bytes, ecd->file) != bytes)
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
|
||||
else
|
||||
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
|
||||
|
||||
Reference in New Issue
Block a user