mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-27 03:50:29 +00:00
Add error chcking to ensure sizeof (off_t) == sizeof (sf_count_t).
This commit is contained in:
parent
5310c42655
commit
0f1a712ecd
@ -25,6 +25,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -61,6 +62,17 @@ int
|
||||
psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode)
|
||||
{ int oflag, mode ;
|
||||
|
||||
/*
|
||||
** Sanity check. If everything is OK, this test and the printfs will
|
||||
** be optimised out. This is meant to catch the problems caused by
|
||||
** "config.h" being included after <stdio.h>.
|
||||
*/
|
||||
if (sizeof (off_t) != sizeof (sf_count_t))
|
||||
{ puts ("\n\n*** Fatal error : sizeof (off_t) != sizeof (sf_count_t)") ;
|
||||
puts ("*** This means that libsndfile was not configured correctly.\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
switch (open_mode)
|
||||
{ case SFM_READ :
|
||||
oflag = O_RDONLY ;
|
||||
|
Loading…
Reference in New Issue
Block a user