Add error chcking to ensure sizeof (off_t) == sizeof (sf_count_t).

This commit is contained in:
Erik de Castro Lopo 2004-02-24 23:30:45 +00:00
parent 5310c42655
commit 0f1a712ecd

View File

@ -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 ;