/* test_libFLAC++ - Unit tester for libFLAC++
- * Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson
+ * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#if HAVE_CONFIG_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#if defined _MSC_VER || defined __MINGW32__
-#if _MSC_VER <= 1200 /* @@@ [2G limit] */
-#define fseeko fseek
-#define ftello ftell
-#endif
-#endif
#include "decoders.h"
#include "FLAC/assert.h"
#include "FLAC/metadata.h" // for ::FLAC__metadata_object_is_equal()
#include "FLAC++/decoder.h"
#include "share/grabbag.h"
+#include "share/compat.h"
extern "C" {
#include "test_libs_common/file_utils_flac.h"
#include "test_libs_common/metadata_utils.h"
static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_;
static ::FLAC__StreamMetadata *expected_metadata_sequence_[9];
static unsigned num_expected_;
-static off_t flacfilesize_;
+static FLAC__off_t flacfilesize_;
static const char *flacfilename(bool is_ogg)
{
- return is_ogg? "metadata.ogg" : "metadata.flac";
+ return is_ogg? "metadata.oga" : "metadata.flac";
}
static bool die_(const char *msg)
if(error_occurred_)
return ::FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
- if(fseeko(file_, (off_t)absolute_byte_offset, SEEK_SET) < 0) {
+ if(fseeko(file_, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) {
error_occurred_ = true;
return ::FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
}
if(error_occurred_)
return ::FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
- off_t offset = ftello(file_);
+ FLAC__off_t offset = ftello(file_);
*absolute_byte_offset = (FLAC__uint64)offset;
if(offset < 0) {
printf("OK\n");
printf("testing finish()... ");
- finish();
+ if(!finish()) {
+ State state = get_state();
+ printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+ return false;
+ }
printf("OK\n");
return true;
printf("OK\n");
printf("testing finish()... ");
- finish();
+ if(!finish()) {
+ State state = get_state();
+ printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+ return false;
+ }
printf("OK\n");
return true;
}
printf("testing finish()... ");
- decoder->finish();
+ if(!decoder->finish()) {
+ state = decoder->get_state();
+ printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+ return false;
+ }
printf("OK\n");
/*