complete largefile support
authorJosh Coalson <jcoalson@users.sourceforce.net>
Wed, 24 May 2006 04:41:36 +0000 (04:41 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Wed, 24 May 2006 04:41:36 +0000 (04:41 +0000)
110 files changed:
build/config.mk
configure.in
doc/html/changelog.html
include/share/grabbag/file.h
src/flac/analyze.c
src/flac/decode.c
src/flac/encode.c
src/flac/encode.h
src/flac/local_string_utils.c
src/flac/main.c
src/libFLAC/bitbuffer.c
src/libFLAC/bitmath.c
src/libFLAC/cpu.c
src/libFLAC/crc.c
src/libFLAC/file_decoder.c
src/libFLAC/file_encoder.c
src/libFLAC/fixed.c
src/libFLAC/float.c
src/libFLAC/format.c
src/libFLAC/lpc.c
src/libFLAC/md5.c
src/libFLAC/memory.c
src/libFLAC/metadata_iterators.c
src/libFLAC/metadata_object.c
src/libFLAC/seekable_stream_decoder.c
src/libFLAC/seekable_stream_encoder.c
src/libFLAC/stream_decoder.c
src/libFLAC/stream_encoder.c
src/libFLAC/stream_encoder_framing.c
src/libFLAC/window.c
src/libOggFLAC/file_decoder.c
src/libOggFLAC/file_encoder.c
src/libOggFLAC/ogg_decoder_aspect.c
src/libOggFLAC/ogg_encoder_aspect.c
src/libOggFLAC/ogg_helper.c
src/libOggFLAC/ogg_mapping.c
src/libOggFLAC/seekable_stream_decoder.c
src/libOggFLAC/seekable_stream_encoder.c
src/libOggFLAC/stream_decoder.c
src/libOggFLAC/stream_encoder.c
src/metaflac/operations.c
src/metaflac/operations_shorthand_cuesheet.c
src/metaflac/operations_shorthand_seektable.c
src/metaflac/operations_shorthand_streaminfo.c
src/metaflac/operations_shorthand_vorbiscomment.c
src/metaflac/options.c
src/metaflac/usage.c
src/metaflac/utils.c
src/monkeys_audio_utilities/flac_mac/main.c
src/monkeys_audio_utilities/flac_ren/main.c
src/plugin_common/charset.c
src/plugin_common/dither.c
src/plugin_common/replaygain.c
src/plugin_common/tags.c
src/plugin_winamp2/Makefile.am
src/plugin_winamp2/configure.c [moved from src/plugin_winamp2/config.c with 95% similarity]
src/plugin_winamp2/configure.h [moved from src/plugin_winamp2/config.h with 100% similarity]
src/plugin_winamp2/in_flac.c
src/plugin_winamp2/in_flac.dsp
src/plugin_winamp2/infobox.c
src/plugin_winamp2/playback.c
src/plugin_winamp2/playback.h
src/plugin_xmms/charset.c
src/plugin_xmms/configure.c
src/plugin_xmms/fileinfo.c
src/plugin_xmms/http.c
src/plugin_xmms/plugin.c
src/plugin_xmms/tag.c
src/share/getopt/getopt.c
src/share/getopt/getopt1.c
src/share/grabbag/cuesheet.c
src/share/grabbag/file.c
src/share/grabbag/replaygain.c
src/share/grabbag/seektable.c
src/share/replaygain_analysis/replaygain_analysis.c
src/share/replaygain_synthesis/replaygain_synthesis.c
src/share/utf8/charset.c
src/share/utf8/charset_test.c
src/share/utf8/iconvert.c
src/share/utf8/makemap.c
src/share/utf8/utf8.c
src/test_grabbag/cuesheet/main.c
src/test_libFLAC++/decoders.cpp
src/test_libFLAC++/file_utils.c
src/test_libFLAC++/file_utils.h
src/test_libFLAC++/metadata_manip.cpp
src/test_libFLAC++/metadata_utils.c
src/test_libFLAC/bitbuffer.c
src/test_libFLAC/decoders.c
src/test_libFLAC/encoders.c
src/test_libFLAC/file_utils.c
src/test_libFLAC/file_utils.h
src/test_libFLAC/format.c
src/test_libFLAC/main.c
src/test_libFLAC/metadata.c
src/test_libFLAC/metadata_manip.c
src/test_libFLAC/metadata_object.c
src/test_libFLAC/metadata_utils.c
src/test_libOggFLAC++/decoders.cpp
src/test_libOggFLAC++/file_utils.c
src/test_libOggFLAC++/file_utils.h
src/test_libOggFLAC++/metadata_utils.c
src/test_libOggFLAC/decoders.c
src/test_libOggFLAC/encoders.c
src/test_libOggFLAC/file_utils.c
src/test_libOggFLAC/file_utils.h
src/test_libOggFLAC/main.c
src/test_libOggFLAC/metadata_utils.c
src/test_seeking/main.c
src/test_streams/main.c

index 400949d..3def3db 100644 (file)
@@ -44,12 +44,12 @@ all default: $(DEFAULT_BUILD)
 VERSION=\"CVS\"
 
 ifeq ($(DARWIN_BUILD),yes)
-#CONFIG_CFLAGS=-DHAVE_INTTYPES_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DHAVE_SOCKLEN_T -DFLAC__HAS_OGG -DFLAC__SYS_DARWIN
-CONFIG_CFLAGS=-DHAVE_INTTYPES_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DFLAC__HAS_OGG -DFLAC__SYS_DARWIN
+#CONFIG_CFLAGS=-DHAVE_INTTYPES_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DHAVE_SOCKLEN_T -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFLAC__SYS_DARWIN
+CONFIG_CFLAGS=-DHAVE_INTTYPES_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFLAC__SYS_DARWIN
 ICONV_INCLUDE_DIR=$(HOME)/local.i18n/include
 ICONV_LIB_DIR=$(HOME)/local.i18n/lib
 else
-CONFIG_CFLAGS=-DHAVE_INTTYPES_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DHAVE_SOCKLEN_T -DFLAC__HAS_OGG
+CONFIG_CFLAGS=-DHAVE_INTTYPES_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DHAVE_SOCKLEN_T -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 endif
 
 OGG_INCLUDE_DIR=$(HOME)/local/include
index fddfb87..ffe07ac 100644 (file)
@@ -42,6 +42,9 @@ AC_PROG_MAKE_SET
 AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO
 
+#@@@ new name is AC_CONFIG_HEADERS
+AM_CONFIG_HEADER(config.h)
+
 AC_CHECK_TYPES(socklen_t, [], [])
 
 dnl check for getopt in standard library
@@ -49,13 +52,25 @@ dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
 AC_CHECK_FUNCS(getopt_long, [], [])
 
 case "$host_cpu" in
-       i*86)   cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
-       powerpc)        cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
-       sparc)  cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
+       i*86)
+               cpu_ia32=true
+               AC_DEFINE(FLAC__CPU_IA32)
+               AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
+               ;;
+       powerpc)
+               cpu_ppc=true
+               AC_DEFINE(FLAC__CPU_PPC)
+               AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
+               ;;
+       sparc)
+               cpu_sparc=true
+               AC_DEFINE(FLAC__CPU_SPARC)
+               AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
+               ;;
 esac
-AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
-AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
-AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
+AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
+AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
+AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
 case "$host" in
        i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
        *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
@@ -63,20 +78,30 @@ case "$host" in
 esac
 AC_SUBST(OBJ_FORMAT)
 case "$host" in
-       *-pc-linux-gnu) sys_linux=true ; AC_DEFINE(FLAC__SYS_LINUX) ;;
-       *-*-darwin*) sys_darwin=true ; AC_DEFINE(FLAC__SYS_DARWIN) ;;
+       *-pc-linux-gnu)
+               sys_linux=true
+               AC_DEFINE(FLAC__SYS_LINUX)
+               AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
+               ;;
+       *-*-darwin*)
+               sys_darwin=true
+               AC_DEFINE(FLAC__SYS_DARWIN)
+               AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
+               ;;
 esac
-AM_CONDITIONAL(FLaC__SYS_DARWIN, test x$sys_darwin = xtrue)
-AM_CONDITIONAL(FLaC__SYS_LINUX, test x$sys_linux = xtrue)
+AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
+AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
 
-if test x$cpu_ia32 = xtrue ; then
+if test "x$cpu_ia32" = xtrue ; then
 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
+AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
 fi
 
-AC_ARG_ENABLE(asm-optimizations, [  --disable-asm-optimizations    Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
-AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
-if test x$asm_opt = xno ; then
+AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
+AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
+if test "x$asm_opt" = xno ; then
 AC_DEFINE(FLAC__NO_ASM)
+AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
 fi
 
 AC_ARG_ENABLE(debug,
@@ -86,7 +111,7 @@ AC_ARG_ENABLE(debug,
        no)  debug=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
 esac],[debug=false])
-AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
+AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
 
 AC_ARG_ENABLE(sse,
 [  --enable-sse                   Enable SSE support by asserting that the OS supports SSE instructions],
@@ -95,9 +120,10 @@ AC_ARG_ENABLE(sse,
        no)  sse_os=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
 esac],[sse_os=false])
-AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
-if test x$sse_os = xtrue ; then
+AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xtrue)
+if test "x$sse_os" = xtrue ; then
 AC_DEFINE(FLAC__SSE_OS)
+AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
 fi
 
 AC_ARG_ENABLE(3dnow,
@@ -107,9 +133,10 @@ AC_ARG_ENABLE(3dnow,
        no)  use_3dnow=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
 esac],[use_3dnow=true])
-AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
-if test x$use_3dnow = xtrue ; then
+AM_CONDITIONAL(FLaC__USE_3DNOW, test "x$use_3dnow" = xtrue)
+if test "x$use_3dnow" = xtrue ; then
 AC_DEFINE(FLAC__USE_3DNOW)
+AH_TEMPLATE(FLAC__USE_3DNOW, [define to enable use of 3Dnow! instructions])
 fi
 
 AC_ARG_ENABLE(altivec,
@@ -119,9 +146,10 @@ AC_ARG_ENABLE(altivec,
        no)  use_altivec=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
 esac],[use_altivec=true])
-AM_CONDITIONAL(FLaC__USE_ALTIVEC, test x$use_altivec = xtrue)
-if test x$use_altivec = xtrue ; then
+AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
+if test "x$use_altivec" = xtrue ; then
 AC_DEFINE(FLAC__USE_ALTIVEC)
+AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
 fi
 
 AC_ARG_ENABLE(local-xmms-plugin,
@@ -131,7 +159,7 @@ AC_ARG_ENABLE(local-xmms-plugin,
        no)  install_xmms_plugin_locally=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
 esac],[install_xmms_plugin_locally=false])
-AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test x$install_xmms_plugin_locally = xtrue)
+AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
 
 AC_ARG_ENABLE(exhaustive-tests,
 [  --enable-exhaustive-tests      Enable exhaustive testing],
@@ -140,50 +168,57 @@ AC_ARG_ENABLE(exhaustive-tests,
        no)  exhaustive_tests=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
 esac],[exhaustive_tests=false])
-AM_CONDITIONAL(FLaC__EXHAUSTIVE_TESTS, test x$exhaustive_tests = xtrue)
-if test x$exhaustive_tests = xtrue ; then
+AM_CONDITIONAL(FLaC__EXHAUSTIVE_TESTS, test "x$exhaustive_tests" = xtrue)
+if test "x$exhaustive_tests" = xtrue ; then
 AC_DEFINE(FLAC__EXHAUSTIVE_TESTS)
+AH_TEMPLATE(FLAC__EXHAUSTIVE_TESTS, [define to run even more tests])
 fi
 
 AC_ARG_ENABLE(valgrind-testing,
-[  --enable-valgrind-testing      Run all tests inside Valgrind],
+AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
 [case "${enableval}" in
        yes) valgrind_testing=true ;;
        no)  valgrind_testing=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
 esac],[valgrind_testing=false])
-AM_CONDITIONAL(FLaC__VALGRIND_TESTING, test x$valgrind_testing = xtrue)
-if test x$valgrind_testing = xtrue ; then
+AM_CONDITIONAL(FLaC__VALGRIND_TESTING, test "x$valgrind_testing" = xtrue)
+if test "x$valgrind_testing" = xtrue ; then
 AC_DEFINE(FLAC__VALGRIND_TESTING)
+AH_TEMPLATE(FLAC__VALGRIND_TESTING, [define to enable use of Valgrind in testers])
 fi
 
+AC_ARG_ENABLE(doxygen-docs,
+AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
+[case "${enableval}" in
+       yes) enable_doxygen_docs=true ;;
+       no)  enable_doxygen_docs=false ;;
+       *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
+esac],[enable_doxygen_docs=true])
+if test "x$enable_doxygen_docs" != xno ; then
+       AC_CHECK_PROGS(DOXYGEN, doxygen)
+fi
+AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
+
 dnl check for ogg library
 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
-AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
-if test x$have_ogg = xyes ; then
+AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
+if test "x$have_ogg" = xyes ; then
 AC_DEFINE(FLAC__HAS_OGG)
+AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library])
 fi
 
 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - xmms support will not be built]))
-AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
+AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
 
 dnl check for i18n(internationalization); these are from libiconv/gettext
 AM_ICONV
 AM_LANGINFO_CODESET
 
-AC_ARG_ENABLE(doxygen_docs, AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]))
-if test "x$enable_doxygen_docs" != "xno" ; then
-       AC_CHECK_PROGS(DOXYGEN, doxygen)
-fi
-AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
-if test -n "$DOXYGEN" ; then
-AC_DEFINE(FLAC__HAS_DOXYGEN)
-fi
-
 AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
 AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
 if test -n "$DOCBOOK_TO_MAN" ; then
 AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
+AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
 fi
 
 # only matters for x86
@@ -191,6 +226,7 @@ AC_CHECK_PROGS(NASM, nasm)
 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
 if test -n "$NASM" ; then
 AC_DEFINE(FLAC__HAS_NASM)
+AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
 fi
 
 # only matters for PowerPC
@@ -203,18 +239,20 @@ AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
 AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
 if test "$AS" = "as" ; then
 AC_DEFINE(FLAC__HAS_AS)
+AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
 fi
 if test "$AS" = "gas" ; then
 # funniest. macro. ever.
 AC_DEFINE(FLAC__HAS_GAS)
+AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
 fi
 
 OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
-if test x$debug = xtrue; then
+if test "x$debug" = xtrue; then
        OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -g -O0 -DDEBUG"
 else
        OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O2 -DNDEBUG"
-       if test x$GCC = xyes; then
+       if test "x$GCC" = xyes; then
                OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O3 -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
        fi
 fi
@@ -225,27 +263,7 @@ CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS"
 AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
 AM_CONDITIONAL(FLaC__HAS_GAS__TEMPORARILY_DISABLED, test "yes" = "no")
 
-AM_CONFIG_HEADER(config.h)
-AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA,  [define to align allocated memory on 32-byte boundaries])
-AH_TEMPLATE(FLAC__CPU_IA32,  [define if building for ia32/i386])
-AH_TEMPLATE(FLAC__CPU_PPC,  [define if building for PowerPC])
-AH_TEMPLATE(FLAC__CPU_SPARC,  [define if building for SPARC])
-AH_TEMPLATE(FLAC__SYS_DARWIN,  [define if building for Darwin / MacOS X])
-AH_TEMPLATE(FLAC__SYS_LINUX,  [define if building for Linux])
-AH_TEMPLATE(FLAC__EXHAUSTIVE_TESTS,  [define to run even more tests])
-AH_TEMPLATE(FLAC__VALGRIND_TESTING,  [define to enable use of Valgrind in testers])
-AH_TEMPLATE(FLAC__HAS_DOXYGEN,  [define if you have Doxygen])
-AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN,  [define if you have docbook-to-man or docbook2man])
-AH_TEMPLATE(FLAC__HAS_NASM,  [define if you are compiling for x86 and have the NASM assembler])
-AH_TEMPLATE(FLAC__HAS_AS,  [define if you are compiling for PowerPC and have the 'as' assembler])
-AH_TEMPLATE(FLAC__HAS_GAS,  [define if you are compiling for PowerPC and have the 'gas' assembler])
-AH_TEMPLATE(FLAC__HAS_OGG,  [define if you have the ogg library])
-AH_TEMPLATE(FLAC__NO_ASM,  [define to disable use of assembly code])
-AH_TEMPLATE(FLAC__SSE_OS,  [define if your operating system supports SSE instructions])
-AH_TEMPLATE(FLAC__USE_3DNOW,  [define to enable use of 3Dnow! instructions])
-AH_TEMPLATE(FLAC__USE_ALTIVEC,  [define to enable use of Altivec instructions])
-
-AC_OUTPUT( \
+AC_CONFIG_FILES([ \
        Makefile \
        src/Makefile \
        src/libFLAC/Makefile \
@@ -311,4 +329,5 @@ AC_OUTPUT( \
        obj/release/bin/Makefile \
        obj/release/lib/Makefile \
        flac.pbproj/Makefile \
-)
+])
+AC_OUTPUT
index 2aabf84..144e06e 100644 (file)
@@ -65,7 +65,7 @@
                        <li>
                                General:
                                <ul>
-                                       <li>(none)</li>
+                                       <li>Large file (&gt;2GB) support everywhere</li>
                                </ul>
                        </li>
                        <li>
@@ -98,6 +98,7 @@
                                <ul>
                                        <li>Added a new option <a href="documentation.html#metaflac_shorthand_set_tag_from_file"><span class="argument">--set-tag-from-file</span></a> for setting a tag from file (e.g. for importing a cuesheet as a tag).</li>
                                        <li>Added shorthand operation <a href="documentation.html#metaflac_shorthand_remove_replay_gain"><span class="argument">--remove-replay-gain</span></a> for removing ReplayGain tags.</li>
+                                       <li><a href="documentation.html#metaflac_shorthand_export_cuesheet_to"><span class="argument">--export-cuesheet-to</span></a> now properly specifies the FLAC file name (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1272825&amp;group_id=13478&amp;atid=363478">SF #1272825</a>).</li>
                                        <li>Importing of non-CDDA-compliant cuesheets now issues a warning.</li>
                                </ul>
                        </li>
                                plugins:
                                <ul>
                                        <li>When ReplayGain is on, if tags for the preferred kind of gain (album/track) are not in a stream, the other kind will be used.</li>
-                                       <li>Add ReplayGain info to file info box in XMMS plugin</li>
+                                       <li>Added ReplayGain info to file info box in XMMS plugin</li>
                                        <li>Fixed UTF-8 decoder to disallow non-shortest-form and surrogate sequences (see <a href="http://www.unicode.org/versions/corrigendum1.html">here</a>).</li>
                                </ul>
                        </li>
                        <li>
                                build system:
                                <ul>
-                                       <li>Add support for building on OS/2 with EMX (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1229495&group_id=13478&atid=113478">SF #1229495</a>)</li>
+                                       <li>Added support for building on OS/2 with EMX (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1229495&group_id=13478&atid=113478">SF #1229495</a>)</li>
+                                       <li>Added <span class="argument">--disable-doxygen-docs</span> to <span class="command">configure</span> for disabling Doxygen-based API doc generation (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1365935&group_id=13478&atid=313478">SF #1365935</a>).</li>
+                                       <li>Added large file support with <span class="argument">AC_SYS_LARGEFILE</span>; use <span class="argument">--disable-largefile</span> with <span class="command">configure</span> to disable.</li>
                                </ul>
                        </li>
                        <li>
index f98003f..e7d02cf 100644 (file)
 #ifndef GRABAG__FILE_H
 #define GRABAG__FILE_H
 
+/* needed because of off_t */
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <sys/types.h> /* for off_t */
 #include <stdio.h> /* for FILE */
 #include "FLAC/ordinals.h"
index 614b4d2..207543e 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <errno.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -208,7 +213,7 @@ FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename)
        outfile = fopen(filename, "w");
 
        if(0 == outfile) {
-               fprintf(stderr, "ERROR opening %s\n", filename);
+               fprintf(stderr, "ERROR opening %s: %s\n", filename, strerror(errno));
                return false;
        }
 
index 920f89e..5940ab9 100644 (file)
@@ -16,8 +16,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+#  include <config.h>
 #endif
 
 #if defined _WIN32 && !defined __CYGWIN__
 #else
 # include <unistd.h>
 #endif
+#if defined _MSC_VER || defined __MINGW32__
+#include <sys/types.h> /* for off_t */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
+#endif
 #include <errno.h>
 #include <math.h> /* for floor() */
-#include <stdio.h> /* for FILE et al. */
-#include <string.h> /* for strcmp() */
+#include <stdio.h> /* for FILE etc. */
+#include <string.h> /* for strcmp(), strerror() */
 #include "FLAC/all.h"
 #include "share/grabbag.h"
 #include "share/replaygain_synthesis.h"
@@ -72,9 +78,9 @@ typedef struct {
 
        struct {
                FLAC__bool needs_fixup;
-               unsigned riff_offset; /* or FORM offset for AIFF */
-               unsigned data_offset; /* or SSND offset for AIFF */
-               unsigned frames_offset; /* AIFF only */
+               off_t riff_offset; /* or FORM offset for AIFF */
+               off_t data_offset; /* or SSND offset for AIFF */
+               off_t frames_offset; /* AIFF only */
        } wave_chunk_size_fixup;
 
        FLAC__bool is_big_endian;
@@ -292,7 +298,7 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__
                }
                else {
                        if(0 == (d->fout = fopen(outfilename, "wb"))) {
-                               flac__utils_printf(stderr, 1, "%s: ERROR: can't open output file %s\n", d->inbasefilename, outfilename);
+                               flac__utils_printf(stderr, 1, "%s: ERROR: can't open output file %s: %s\n", d->inbasefilename, outfilename, strerror(errno));
                                DecoderSession_destroy(d, /*error_occurred=*/true);
                                return false;
                        }
@@ -639,7 +645,7 @@ FLAC__bool write_necessary_headers(DecoderSession *decoder_session)
                                return false;
 
                        if(decoder_session->wave_chunk_size_fixup.needs_fixup)
-                               decoder_session->wave_chunk_size_fixup.riff_offset = ftell(decoder_session->fout);
+                               decoder_session->wave_chunk_size_fixup.riff_offset = ftello(decoder_session->fout);
 
                        if(!write_little_endian_uint32(decoder_session->fout, aligned_data_size+36)) /* filesize-8 */
                                return false;
@@ -672,7 +678,7 @@ FLAC__bool write_necessary_headers(DecoderSession *decoder_session)
                                return false;
 
                        if(decoder_session->wave_chunk_size_fixup.needs_fixup)
-                               decoder_session->wave_chunk_size_fixup.data_offset = ftell(decoder_session->fout);
+                               decoder_session->wave_chunk_size_fixup.data_offset = ftello(decoder_session->fout);
 
                        if(!write_little_endian_uint32(decoder_session->fout, (FLAC__uint32)data_size)) /* data size */
                                return false;
@@ -682,7 +688,7 @@ FLAC__bool write_necessary_headers(DecoderSession *decoder_session)
                                return false;
 
                        if(decoder_session->wave_chunk_size_fixup.needs_fixup)
-                               decoder_session->wave_chunk_size_fixup.riff_offset = ftell(decoder_session->fout);
+                               decoder_session->wave_chunk_size_fixup.riff_offset = ftello(decoder_session->fout);
 
                        if(!write_big_endian_uint32(decoder_session->fout, aligned_data_size+46)) /* filesize-8 */
                                return false;
@@ -697,7 +703,7 @@ FLAC__bool write_necessary_headers(DecoderSession *decoder_session)
                                return false;
 
                        if(decoder_session->wave_chunk_size_fixup.needs_fixup)
-                               decoder_session->wave_chunk_size_fixup.frames_offset = ftell(decoder_session->fout);
+                               decoder_session->wave_chunk_size_fixup.frames_offset = ftello(decoder_session->fout);
 
                        if(!write_big_endian_uint32(decoder_session->fout, (FLAC__uint32)decoder_session->total_samples))
                                return false;
@@ -712,7 +718,7 @@ FLAC__bool write_necessary_headers(DecoderSession *decoder_session)
                                return false;
 
                        if(decoder_session->wave_chunk_size_fixup.needs_fixup)
-                               decoder_session->wave_chunk_size_fixup.data_offset = ftell(decoder_session->fout);
+                               decoder_session->wave_chunk_size_fixup.data_offset = ftello(decoder_session->fout);
 
                        if(!write_big_endian_uint32(decoder_session->fout, (FLAC__uint32)data_size+8)) /* data size */
                                return false;
@@ -805,11 +811,11 @@ FLAC__bool fixup_wave_chunk_size(const char *outfilename, FLAC__bool is_wave_out
 {
        const char *fmt_desc = (is_wave_out? "WAVE" : "AIFF");
        FLAC__bool (*write_it)(FILE *, FLAC__uint32) = (is_wave_out? write_little_endian_uint32 : write_big_endian_uint32);
-       FILE *f = fopen(outfilename, "r+b");
        FLAC__uint32 data_size, aligned_data_size;
+       FILE *f = fopen(outfilename, "r+b");
 
        if(0 == f) {
-               flac__utils_printf(stderr, 1, "ERROR, couldn't open file %s while fixing up %s chunk size\n", outfilename, fmt_desc);
+               flac__utils_printf(stderr, 1, "ERROR, couldn't open file %s while fixing up %s chunk size: %s\n", outfilename, fmt_desc, strerror(errno));
                return false;
        }
 
@@ -817,7 +823,7 @@ FLAC__bool fixup_wave_chunk_size(const char *outfilename, FLAC__bool is_wave_out
        if(aligned_data_size & 1)
                aligned_data_size++;
 
-       if(fseek(f, riff_offset, SEEK_SET) < 0) {
+       if(fseeko(f, riff_offset, SEEK_SET) < 0) {
                flac__utils_printf(stderr, 1, "ERROR, couldn't seek in file %s while fixing up %s chunk size\n", outfilename, fmt_desc);
                fclose(f);
                return false;
@@ -828,7 +834,7 @@ FLAC__bool fixup_wave_chunk_size(const char *outfilename, FLAC__bool is_wave_out
                return false;
        }
        if(!is_wave_out) {
-               if(fseek(f, frames_offset, SEEK_SET) < 0) {
+               if(fseeko(f, frames_offset, SEEK_SET) < 0) {
                        flac__utils_printf(stderr, 1, "ERROR, couldn't seek in file %s while fixing up %s chunk size\n", outfilename, fmt_desc);
                        fclose(f);
                        return false;
@@ -839,7 +845,7 @@ FLAC__bool fixup_wave_chunk_size(const char *outfilename, FLAC__bool is_wave_out
                        return false;
                }
        }
-       if(fseek(f, data_offset, SEEK_SET) < 0) {
+       if(fseeko(f, data_offset, SEEK_SET) < 0) {
                flac__utils_printf(stderr, 1, "ERROR, couldn't seek in file %s while fixing up %s chunk size\n", outfilename, fmt_desc);
                fclose(f);
                return false;
index 61d1b03..8d42148 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #if defined _WIN32 && !defined __CYGWIN__
 /* where MSVC puts unlink() */
 # include <io.h>
 #else
 # include <unistd.h>
 #endif
+#if defined _MSC_VER || defined __MINGW32__
+#include <sys/types.h> /* for off_t */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
+#endif
+#include <errno.h>
 #include <limits.h> /* for LONG_MAX */
 #include <math.h> /* for floor() */
 #include <stdio.h> /* for FILE etc. */
 #include <stdlib.h> /* for malloc */
-#include <string.h> /* for strcmp() */
+#include <string.h> /* for strcmp(), strerror( */
 #include "FLAC/all.h"
 #include "share/grabbag.h"
 #include "encode.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef FLAC__HAS_OGG
 #include "OggFLAC/stream_encoder.h"
 #include "OggFLAC/file_encoder.h"
@@ -160,7 +167,7 @@ static FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset);
 /*
  * public routines
  */
-int flac__encode_aif(FILE *infile, long infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc)
+int flac__encode_aif(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc)
 {
        EncoderSession encoder_session;
        FLAC__uint16 x;
@@ -525,7 +532,7 @@ int flac__encode_aif(FILE *infile, long infilesize, const char *infilename, cons
        return EncoderSession_finish_ok(&encoder_session, info_align_carry, info_align_zero);
 }
 
-int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options)
+int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options)
 {
        EncoderSession encoder_session;
        FLAC__bool is_unsigned_samples = false;
@@ -860,7 +867,7 @@ int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, cons
        return EncoderSession_finish_ok(&encoder_session, info_align_carry, info_align_zero);
 }
 
-int flac__encode_raw(FILE *infile, long infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options)
+int flac__encode_raw(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options)
 {
        EncoderSession encoder_session;
        size_t bytes_read;
@@ -906,7 +913,7 @@ int flac__encode_raw(FILE *infile, long infilesize, const char *infilename, cons
        else {
                /* *options.common.align_reservoir_samples will be 0 unless --sector-align is used */
                FLAC__ASSERT(options.common.sector_align || *options.common.align_reservoir_samples == 0);
-               total_samples_in_input = (unsigned)infilesize / bytes_per_wide_sample + *options.common.align_reservoir_samples;
+               total_samples_in_input = (FLAC__uint64)infilesize / bytes_per_wide_sample + *options.common.align_reservoir_samples;
        }
 
        /*
@@ -918,13 +925,13 @@ int flac__encode_raw(FILE *infile, long infilesize, const char *infilename, cons
        encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples;
        FLAC__ASSERT(!options.common.sector_align || encoder_session.until == 0);
 
-       infilesize -= (unsigned)encoder_session.skip * bytes_per_wide_sample; /*@@@ WATCHOUT: 4GB limit */
+       infilesize -= (off_t)encoder_session.skip * bytes_per_wide_sample;
        encoder_session.total_samples_to_encode = total_samples_in_input - encoder_session.skip;
        if(encoder_session.until > 0) {
                const FLAC__uint64 trim = total_samples_in_input - encoder_session.until;
                FLAC__ASSERT(total_samples_in_input > 0);
                FLAC__ASSERT(!options.common.sector_align);
-               infilesize -= (unsigned int)trim * bytes_per_wide_sample;
+               infilesize -= (off_t)trim * bytes_per_wide_sample;
                encoder_session.total_samples_to_encode -= trim;
        }
        if(infilesize >= 0 && options.common.sector_align) {
@@ -979,7 +986,7 @@ int flac__encode_raw(FILE *infile, long infilesize, const char *infilename, cons
                }
                else {
                        *options.common.align_reservoir_samples = align_remainder;
-                       infilesize -= (long)((*options.common.align_reservoir_samples) * bytes_per_wide_sample);
+                       infilesize -= (off_t)((*options.common.align_reservoir_samples) * bytes_per_wide_sample);
                        FLAC__ASSERT(infilesize >= 0);
                }
        }
@@ -1024,7 +1031,7 @@ int flac__encode_raw(FILE *infile, long infilesize, const char *infilename, cons
                }
        }
        else {
-               const FLAC__uint64 max_input_bytes = (FLAC__uint64)infilesize;
+               const FLAC__uint64 max_input_bytes = infilesize;
                FLAC__uint64 total_input_bytes_read = 0;
                while(total_input_bytes_read < max_input_bytes) {
                        {
@@ -1858,7 +1865,7 @@ FLAC__bool parse_cuesheet_(FLAC__StreamMetadata **cuesheet, const char *cuesheet
        }
 
        if(0 == (f = fopen(cuesheet_filename, "r"))) {
-               flac__utils_printf(stderr, 1, "%s: ERROR opening cuesheet \"%s\" for reading\n", inbasefilename, cuesheet_filename);
+               flac__utils_printf(stderr, 1, "%s: ERROR opening cuesheet \"%s\" for reading: %s\n", inbasefilename, cuesheet_filename, strerror(errno));
                return false;
        }
 
@@ -2143,7 +2150,7 @@ FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset)
 
        while(offset > 0) {
                long need = (long)min(offset, LONG_MAX);
-               if(fseek(f, need, SEEK_CUR) < 0) {
+               if(fseeko(f, need, SEEK_CUR) < 0) {
                        need = (long)min(offset, sizeof(dump));
                        if((long)fread(dump, 1, need, f) < need)
                                return false;
index 40739d6..cfda543 100644 (file)
 #ifndef flac__encode_h
 #define flac__encode_h
 
+/* needed because of off_t */
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/metadata.h"
 #include "utils.h"
 
@@ -84,8 +89,8 @@ typedef struct {
        unsigned sample_rate;
 } raw_encode_options_t;
 
-int flac__encode_aif(FILE *infile, long infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc);
-int flac__encode_wav(FILE *infile, long infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options);
-int flac__encode_raw(FILE *infile, long infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options);
+int flac__encode_aif(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc);
+int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options);
+int flac__encode_raw(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options);
 
 #endif
index 9b0d49f..1d78d18 100644 (file)
@@ -1,6 +1,10 @@
 /* flac - Command-line FLAC encoder/decoder
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <string.h>
 
 #include "utils.h"
index 7c94762..14db8da 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <ctype.h>
+#include <errno.h>
 #include <locale.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #if !defined _MSC_VER && !defined __MINGW32__
 /* unlink is in stdio.h in VC++ */
 #include <unistd.h> /* for unlink() */
@@ -245,7 +246,7 @@ static struct {
        int format_channels;
        int format_bps;
        int format_sample_rate;
-       long format_input_size;
+       off_t format_input_size;
        int blocksize;
        int min_residual_partition_order;
        int max_residual_partition_order;
@@ -591,7 +592,7 @@ FLAC__bool init_options()
        option_values.format_channels = -1;
        option_values.format_bps = -1;
        option_values.format_sample_rate = -1;
-       option_values.format_input_size = -1;
+       option_values.format_input_size = (off_t)(-1);
        option_values.blocksize = -1;
        option_values.min_residual_partition_order = -1;
        option_values.max_residual_partition_order = -1;
@@ -682,7 +683,23 @@ int parse_option(int short_option, const char *long_option, const char *option_a
                }
                else if(0 == strcmp(long_option, "input-size")) {
                        FLAC__ASSERT(0 != option_argument);
-                       option_values.format_input_size = atol(option_argument);
+                       {
+                               char *end;
+#ifdef _MSC_VER
+                               FLAC__int64 i;
+                               i = strtol(option_argument, &end, 10); /* [2G limit] */
+#else
+                               long long i;
+                               i = strtoll(option_argument, &end, 10);
+#endif
+                               if(0 == strlen(option_argument) || *end)
+                                       return usage_error("ERROR: --%s must be a number\n", long_option);
+                               option_values.format_input_size = (off_t)i;
+                               if(option_values.format_input_size != i) /* check if off_t is smaller than long long */
+                                       return usage_error("ERROR: --%s too large; this flac does not support filesizes over 2GB\n", long_option);
+                               if(option_values.format_input_size <= 0)
+                                       return usage_error("ERROR: --%s must be > 0\n", long_option);
+                       }
                }
                else if(0 == strcmp(long_option, "cue")) {
                        FLAC__ASSERT(0 != option_argument);
@@ -1533,7 +1550,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
        FileFormat fmt = RAW;
        FLAC__bool is_aifc = false;
        int retval;
-       long infilesize;
+       off_t infilesize;
        encode_options_t common_options;
        const char *outfilename = get_encoded_outfilename(infilename);
 
@@ -1552,13 +1569,13 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
        }
 
        if(0 == strcmp(infilename, "-")) {
-               infilesize = -1;
+               infilesize = (off_t)(-1);
                encode_infile = grabbag__file_get_binary_stdin();
        }
        else {
                infilesize = grabbag__file_get_filesize(infilename);
                if(0 == (encode_infile = fopen(infilename, "rb"))) {
-                       flac__utils_printf(stderr, 1, "ERROR: can't open input file %s\n", infilename);
+                       flac__utils_printf(stderr, 1, "ERROR: can't open input file %s: %s\n", infilename, strerror(errno));
                        return 1;
                }
        }
index b120de4..f6b1b74 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for memcpy(), memset() */
 #include "private/bitbuffer.h"
index bad52e7..a3e8b37 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "private/bitmath.h"
 #include "FLAC/assert.h"
 
index 3bb8ff3..de2bb2a 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "private/cpu.h"
 #include <stdlib.h>
 #include <stdio.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #if defined FLAC__CPU_PPC
 # if !defined FLAC__NO_ASM
 #  if defined FLAC__SYS_DARWIN
index dbe7f03..1d31ca3 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "private/crc.h"
 
 /* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */
index d2e7de4..6e499ed 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for strcmp() */
 #if defined _MSC_VER || defined __MINGW32__
 #include <io.h> /* for _setmode() */
 #include <fcntl.h> /* for _O_BINARY */
+#include <sys/types.h> /* for off_t */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
 #elif defined __CYGWIN__
 #include <io.h> /* for setmode(), O_BINARY */
 #include <fcntl.h> /* for _O_BINARY */
@@ -606,7 +614,7 @@ FLAC__SeekableStreamDecoderSeekStatus seek_callback_(const FLAC__SeekableStreamD
        FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data;
        (void)decoder;
 
-       if(fseek(file_decoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0)
+       if(fseeko(file_decoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
                return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
        else
                return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK;
@@ -615,10 +623,10 @@ FLAC__SeekableStreamDecoderSeekStatus seek_callback_(const FLAC__SeekableStreamD
 FLAC__SeekableStreamDecoderTellStatus tell_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
 {
        FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data;
-       long pos;
+       off_t pos;
        (void)decoder;
 
-       if((pos = ftell(file_decoder->private_->file)) < 0)
+       if((pos = ftello(file_decoder->private_->file)) < 0)
                return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
        else {
                *absolute_byte_offset = (FLAC__uint64)pos;
index 2501779..3469bfd 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for strlen(), strcpy() */
+#if defined _MSC_VER || defined __MINGW32__
+#include <sys/types.h> /* for off_t */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
+#endif
 #include "FLAC/assert.h"
 #include "protected/file_encoder.h"
 
@@ -724,7 +734,7 @@ FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const FLAC__SeekableStreamE
 
        FLAC__ASSERT(0 != file_encoder);
 
-       if(fseek(file_encoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0)
+       if(fseeko(file_encoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
                return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR;
        else
                return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK;
@@ -733,13 +743,13 @@ FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const FLAC__SeekableStreamE
 FLAC__SeekableStreamEncoderTellStatus tell_callback_(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
 {
        FLAC__FileEncoder *file_encoder = (FLAC__FileEncoder*)client_data;
-       long offset;
+       off_t offset;
 
        (void)encoder;
 
        FLAC__ASSERT(0 != file_encoder);
 
-       offset = ftell(file_encoder->private_->file);
+       offset = ftello(file_encoder->private_->file);
 
        if(offset < 0) {
                return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_ERROR;
index d683352..d432962 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <math.h>
 #include "private/bitmath.h"
 #include "private/fixed.h"
index 534aa8d..7c58f65 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/assert.h"
 
 #include "private/float.h"
index 199053b..b5dfcaa 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for qsort() */
 #include "FLAC/assert.h"
 #include "FLAC/format.h"
 #include "private/format.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef min
 #undef min
 #endif
index 14099da..ab73d0b 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <math.h>
 #include "FLAC/assert.h"
 #include "FLAC/format.h"
index 9679387..5ea127a 100644 (file)
  * Still in the public domain.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h>            /* for malloc() */
 #include <string.h>            /* for memcpy() */
 
 #include "private/md5.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifndef FLaC__INLINE
 #define FLaC__INLINE
 #endif
index 287a74c..956cb29 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "private/memory.h"
 #include "FLAC/assert.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address)
 {
        void *x;
index 88d7227..525b759 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #if defined _MSC_VER || defined __MINGW32__
 #include <sys/utime.h> /* for utime() */
 #include <io.h> /* for chmod() */
+#include <sys/types.h> /* for off_t */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
 #else
 #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
 #include <utime.h> /* for utime() */
@@ -109,10 +117,10 @@ static unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IO
 static unsigned seek_to_first_metadata_block_(FILE *f);
 
 static FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append);
-static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, long fixup_is_last_flag_offset, FLAC__bool backup);
+static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, off_t fixup_is_last_flag_offset, FLAC__bool backup);
 
-static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status);
-static FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status);
+static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status);
+static FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status);
 static FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status);
 static FLAC__bool copy_remaining_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Eof eof_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, FLAC__Metadata_SimpleIteratorStatus *status);
 
@@ -288,9 +296,8 @@ struct FLAC__Metadata_SimpleIterator {
        FLAC__bool has_stats;
        FLAC__bool is_writable;
        FLAC__Metadata_SimpleIteratorStatus status;
-       /*@@@ 2G limits here because of the offset type: */
-       long offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH];
-       long first_offset; /* this is the offset to the STREAMINFO block */
+       off_t offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH];
+       off_t first_offset; /* this is the offset to the STREAMINFO block */
        unsigned depth;
        /* this is the metadata block header of the current block we are pointing to: */
        FLAC__bool is_last;
@@ -399,7 +406,7 @@ static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *it
        switch(ret) {
                case 0:
                        iterator->depth = 0;
-                       iterator->first_offset = iterator->offset[iterator->depth] = ftell(iterator->file);
+                       iterator->first_offset = iterator->offset[iterator->depth] = ftello(iterator->file);
                        return read_metadata_block_header_(iterator);
                case 1:
                        iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
@@ -474,19 +481,19 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIte
        if(iterator->is_last)
                return false;
 
-       if(0 != fseek(iterator->file, iterator->length, SEEK_CUR)) {
+       if(0 != fseeko(iterator->file, iterator->length, SEEK_CUR)) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
        }
 
-       iterator->offset[iterator->depth] = ftell(iterator->file);
+       iterator->offset[iterator->depth] = ftello(iterator->file);
 
        return read_metadata_block_header_(iterator);
 }
 
 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator)
 {
-       long this_offset;
+       off_t this_offset;
 
        FLAC__ASSERT(0 != iterator);
        FLAC__ASSERT(0 != iterator->file);
@@ -494,7 +501,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIte
        if(iterator->offset[iterator->depth] == iterator->first_offset)
                return false;
 
-       if(0 != fseek(iterator->file, iterator->first_offset, SEEK_SET)) {
+       if(0 != fseeko(iterator->file, iterator->first_offset, SEEK_SET)) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
        }
@@ -502,13 +509,13 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIte
        if(!read_metadata_block_header_(iterator))
                return false;
 
-       /* we ignore any error from ftell() and catch it in fseek() */
-       while(ftell(iterator->file) + (long)iterator->length < iterator->offset[iterator->depth]) {
-               if(0 != fseek(iterator->file, iterator->length, SEEK_CUR)) {
+       /* we ignore any error from ftello() and catch it in fseeko() */
+       while(ftello(iterator->file) + (off_t)iterator->length < iterator->offset[iterator->depth]) {
+               if(0 != fseeko(iterator->file, iterator->length, SEEK_CUR)) {
                        iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                        return false;
                }
-               this_offset = ftell(iterator->file);
+               this_offset = ftello(iterator->file);
                if(!read_metadata_block_header_(iterator))
                        return false;
        }
@@ -543,7 +550,7 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Me
                }
 
                /* back up to the beginning of the block data to stay consistent */
-               if(0 != fseek(iterator->file, iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH, SEEK_SET)) {
+               if(0 != fseeko(iterator->file, iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH, SEEK_SET)) {
                        iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                        FLAC__metadata_object_delete(block);
                        return 0;
@@ -557,7 +564,7 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Me
 
 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding)
 {
-       FLAC__ASSERT_DECLARATION(long debug_target_offset = iterator->offset[iterator->depth];)
+       FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth];)
        FLAC__bool ret;
 
        FLAC__ASSERT(0 != iterator);
@@ -584,13 +591,13 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp
                if(use_padding && iterator->length >= FLAC__STREAM_METADATA_HEADER_LENGTH + block->length) {
                        ret = write_metadata_block_stationary_with_padding_(iterator, block, iterator->length - FLAC__STREAM_METADATA_HEADER_LENGTH - block->length, block->is_last);
                        FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
-                       FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH);
+                       FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
                        return ret;
                }
                else {
                        ret = rewrite_whole_file_(iterator, block, /*append=*/false);
                        FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
-                       FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH);
+                       FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
                        return ret;
                }
        }
@@ -633,21 +640,21 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp
                        if(padding_leftover == 0) {
                                ret = write_metadata_block_stationary_(iterator, block);
                                FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
-                               FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH);
+                               FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
                                return ret;
                        }
                        else {
                                FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH);
                                ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last);
                                FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
-                               FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH);
+                               FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
                                return ret;
                        }
                }
                else {
                        ret = rewrite_whole_file_(iterator, block, /*append=*/false);
                        FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset);
-                       FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH);
+                       FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
                        return ret;
                }
        }
@@ -658,7 +665,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Meta
        unsigned padding_leftover = 0;
        FLAC__bool padding_is_last = false;
 
-       FLAC__ASSERT_DECLARATION(long debug_target_offset = iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length;)
+       FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length;)
        FLAC__bool ret;
 
        FLAC__ASSERT(0 != iterator);
@@ -713,28 +720,28 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Meta
                if(padding_leftover == 0) {
                        ret = write_metadata_block_stationary_(iterator, block);
                        FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
-                       FLAC__ASSERT(ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH);
+                       FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
                        return ret;
                }
                else {
                        FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH);
                        ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last);
                        FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
-                       FLAC__ASSERT(ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH);
+                       FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
                        return ret;
                }
        }
        else {
                ret = rewrite_whole_file_(iterator, block, /*append=*/true);
                FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset);
-               FLAC__ASSERT(ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH);
+               FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH);
                return ret;
        }
 }
 
 FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding)
 {
-       FLAC__ASSERT_DECLARATION(long debug_target_offset = iterator->offset[iterator->depth];)
+       FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth];)
        FLAC__bool ret;
 
        if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO) {
@@ -756,14 +763,14 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_S
                FLAC__metadata_object_delete(padding);
                if(!FLAC__metadata_simple_iterator_prev(iterator))
                        return false;
-               FLAC__ASSERT(iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length == debug_target_offset);
-               FLAC__ASSERT(ftell(iterator->file) + (long)iterator->length == debug_target_offset);
+               FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset);
+               FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset);
                return true;
        }
        else {
                ret = rewrite_whole_file_(iterator, 0, /*append=*/false);
-               FLAC__ASSERT(iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length == debug_target_offset);
-               FLAC__ASSERT(ftell(iterator->file) + (long)iterator->length == debug_target_offset);
+               FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset);
+               FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset);
                return ret;
        }
 }
@@ -788,13 +795,13 @@ struct FLAC__Metadata_Chain {
        FLAC__Metadata_Node *tail;
        unsigned nodes;
        FLAC__Metadata_ChainStatus status;
-       long first_offset, last_offset; /*@@@ 2G limit */
+       off_t first_offset, last_offset;
        /*
         * This is the length of the chain initially read from the FLAC file.
         * it is used to compare against the current length to decide whether
         * or not the whole file has to be rewritten.
         */
-       unsigned initial_length; /*@@@ 4G limit */
+       off_t initial_length;
 };
 
 struct FLAC__Metadata_Iterator {
@@ -913,10 +920,10 @@ static void chain_delete_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node
        node_delete_(node);
 }
 
-static unsigned chain_calculate_length_(FLAC__Metadata_Chain *chain)
+static off_t chain_calculate_length_(FLAC__Metadata_Chain *chain)
 {
        const FLAC__Metadata_Node *node;
-       unsigned length = 0;
+       off_t length = 0;
        for(node = chain->head; node; node = node->next)
                length += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length);
        return length;
@@ -995,20 +1002,20 @@ static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLA
 /* WATCHOUT: Make sure to also update the logic in
  * FLAC__metadata_chain_check_if_tempfile_needed() if the logic here changes.
  */
-static unsigned chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool use_padding)
+static off_t chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool use_padding)
 {
-       unsigned current_length = chain_calculate_length_(chain);
+       off_t current_length = chain_calculate_length_(chain);
 
        if(use_padding) {
                /* if the metadata shrank and the last block is padding, we just extend the last padding block */
                if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) {
-                       const unsigned delta = chain->initial_length - current_length;
+                       const off_t delta = chain->initial_length - current_length;
                        chain->tail->data->length += delta;
                        current_length += delta;
                        FLAC__ASSERT(current_length == chain->initial_length);
                }
                /* if the metadata shrank more than 4 bytes then there's room to add another padding block */
-               else if(current_length + FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) {
+               else if(current_length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) {
                        FLAC__StreamMetadata *padding;
                        FLAC__Metadata_Node *node;
                        if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) {
@@ -1028,16 +1035,16 @@ static unsigned chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool
                }
                /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */
                else if(current_length > chain->initial_length) {
-                       const unsigned delta = current_length - chain->initial_length;
+                       const off_t delta = current_length - chain->initial_length;
                        if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) {
                                /* if the delta is exactly the size of the last padding block, remove the padding block */
-                               if(chain->tail->data->length + FLAC__STREAM_METADATA_HEADER_LENGTH == delta) {
+                               if((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta) {
                                        chain_delete_node_(chain, chain->tail);
                                        current_length = chain_calculate_length_(chain);
                                        FLAC__ASSERT(current_length == chain->initial_length);
                                }
                                /* if there is at least 'delta' bytes of padding, trim the padding down */
-                               else if(chain->tail->data->length >= delta) {
+                               else if((off_t)chain->tail->data->length >= delta) {
                                        chain->tail->data->length -= delta;
                                        current_length -= delta;
                                        FLAC__ASSERT(current_length == chain->initial_length);
@@ -1080,7 +1087,7 @@ static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle han
                        chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
                        return false;
                }
-               chain->first_offset = (long)pos;
+               chain->first_offset = (off_t)pos;
        }
 
        {
@@ -1125,7 +1132,7 @@ static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle han
                        chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR;
                        return false;
                }
-               chain->last_offset = (long)pos;
+               chain->last_offset = (off_t)pos;
        }
 
        chain->initial_length = chain_calculate_length_(chain);
@@ -1156,7 +1163,7 @@ static FLAC__bool chain_rewrite_metadata_in_place_cb_(FLAC__Metadata_Chain *chai
                }
        }
 
-       /*FLAC__ASSERT(fflush(), ftell() == chain->last_offset);*/
+       /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
 
        chain->status = FLAC__METADATA_CHAIN_STATUS_OK;
        return true;
@@ -1220,10 +1227,10 @@ static FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *t
                        return false;
                }
        }
-       /*FLAC__ASSERT(fflush(), ftell() == chain->last_offset);*/
+       /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
 
        /* copy the file postfix (everything after the metadata) */
-       if(0 != fseek(f, chain->last_offset, SEEK_SET)) {
+       if(0 != fseeko(f, chain->last_offset, SEEK_SET)) {
                cleanup_tempfile_(&tempfile, &tempfilename);
                chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR;
                return false;
@@ -1269,7 +1276,7 @@ static FLAC__bool chain_rewrite_file_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHa
                        return false;
                }
        }
-       /*FLAC__ASSERT(fflush(), ftell() == chain->last_offset);*/
+       /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/
 
        /* copy the file postfix (everything after the metadata) */
        if(0 != seek_cb(handle, chain->last_offset, SEEK_SET)) {
@@ -1371,7 +1378,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata
         * but doesn't actually alter the chain.  Make sure to update the logic
         * here if chain_prepare_for_write_() changes.
         */
-       const unsigned current_length = chain_calculate_length_(chain);
+       const off_t current_length = chain_calculate_length_(chain);
 
        FLAC__ASSERT(0 != chain);
 
@@ -1380,17 +1387,17 @@ FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata
                if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING)
                        return false;
                /* if the metadata shrank more than 4 bytes then there's room to add another padding block */
-               else if(current_length + FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length)
+               else if(current_length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length)
                        return false;
                /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */
                else if(current_length > chain->initial_length) {
-                       const unsigned delta = current_length - chain->initial_length;
+                       const off_t delta = current_length - chain->initial_length;
                        if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) {
                                /* if the delta is exactly the size of the last padding block, remove the padding block */
-                               if(chain->tail->data->length + FLAC__STREAM_METADATA_HEADER_LENGTH == delta)
+                               if((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta)
                                        return false;
                                /* if there is at least 'delta' bytes of padding, trim the padding down */
-                               else if(chain->tail->data->length >= delta)
+                               else if((off_t)chain->tail->data->length >= delta)
                                        return false;
                        }
                }
@@ -1403,7 +1410,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC
 {
        struct stat stats;
        const char *tempfile_path_prefix = 0;
-       unsigned current_length;
+       off_t current_length;
 
        FLAC__ASSERT(0 != chain);
 
@@ -1447,7 +1454,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC
 
 FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks)
 {
-       unsigned current_length;
+       off_t current_length;
 
        FLAC__ASSERT(0 != chain);
 
@@ -1479,7 +1486,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Cha
 
 FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__IOHandle temp_handle, FLAC__IOCallbacks temp_callbacks)
 {
-       unsigned current_length;
+       off_t current_length;
 
        FLAC__ASSERT(0 != chain);
 
@@ -2410,7 +2417,7 @@ FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IO
 
 FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block)
 {
-       if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+       if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
        }
@@ -2421,7 +2428,7 @@ FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *itera
        if(!write_metadata_block_data_(iterator->file, &iterator->status, block))
                return false;
 
-       if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+       if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
        }
@@ -2433,7 +2440,7 @@ FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIt
 {
        FLAC__StreamMetadata *padding;
 
-       if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+       if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
        }
@@ -2464,7 +2471,7 @@ FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIt
 
        FLAC__metadata_object_delete(padding);
 
-       if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+       if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
        }
@@ -2477,7 +2484,7 @@ FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__St
        FILE *tempfile;
        char *tempfilename;
        int fixup_is_last_code = 0; /* 0 => no need to change any is_last flags */
-       long fixup_is_last_flag_offset = -1;
+       off_t fixup_is_last_flag_offset = -1;
 
        FLAC__ASSERT(0 != block || append == false);
 
@@ -2534,7 +2541,7 @@ FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator)
 {
        FLAC__ASSERT(iterator->depth > 0);
        iterator->depth--;
-       if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
+       if(0 != fseeko(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
        }
@@ -2605,9 +2612,9 @@ unsigned seek_to_first_metadata_block_(FILE *f)
 
 FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append)
 {
-       const long offset_end = append? iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length : iterator->offset[iterator->depth];
+       const off_t offset_end = append? iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length : iterator->offset[iterator->depth];
 
-       if(0 != fseek(iterator->file, 0, SEEK_SET)) {
+       if(0 != fseeko(iterator->file, 0, SEEK_SET)) {
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
        }
@@ -2623,12 +2630,12 @@ FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iter
        return true;
 }
 
-FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, long fixup_is_last_flag_offset, FLAC__bool backup)
+FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, off_t fixup_is_last_flag_offset, FLAC__bool backup)
 {
-       long save_offset = iterator->offset[iterator->depth]; /*@@@ 2G limit */
+       off_t save_offset = iterator->offset[iterator->depth];
        FLAC__ASSERT(0 != *tempfile);
 
-       if(0 != fseek(iterator->file, save_offset + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length, SEEK_SET)) {
+       if(0 != fseeko(iterator->file, save_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length, SEEK_SET)) {
                cleanup_tempfile_(tempfile, tempfilename);
                iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                return false;
@@ -2647,7 +2654,7 @@ FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *ite
                 */
                /* MAGIC NUMBERs here; we know the is_last flag is the high bit of the byte at this location */
                FLAC__byte x;
-               if(0 != fseek(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) {
+               if(0 != fseeko(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) {
                        cleanup_tempfile_(tempfile, tempfilename);
                        iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                        return false;
@@ -2665,7 +2672,7 @@ FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *ite
                        FLAC__ASSERT(!(x & 0x80));
                        x |= 0x80;
                }
-               if(0 != fseek(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) {
+               if(0 != fseeko(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) {
                        cleanup_tempfile_(tempfile, tempfilename);
                        iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR;
                        return false;
@@ -2688,7 +2695,7 @@ FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *ite
        if(!simple_iterator_prime_input_(iterator, !iterator->is_writable))
                return false;
        if(backup) {
-               while(iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length < save_offset)
+               while(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length < save_offset)
                        if(!FLAC__metadata_simple_iterator_next(iterator))
                                return false;
                return true;
@@ -2702,10 +2709,10 @@ FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *ite
        }
 }
 
-FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status)
+FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status)
 {
        FLAC__byte buffer[8192];
-       unsigned n;
+       size_t n;
 
        while(bytes > 0) {
                n = min(sizeof(buffer), bytes);
@@ -2723,10 +2730,10 @@ FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@
        return true;
 }
 
-FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status)
+FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status)
 {
        FLAC__byte buffer[8192];
-       unsigned n;
+       size_t n;
 
        while(bytes > 0) {
                n = min(sizeof(buffer), bytes);
@@ -2890,20 +2897,14 @@ void set_file_stats_(const char *filename, struct stat *stats)
 #endif
 }
 
-/* @@@ WATCHOUT @@@
- * We cast FLAC__int64 to long and use fseek()/ftell() because
- * none of our operations on metadata is ever likely to go past
- * 2 gigabytes.
- */
 int fseek_wrapper_(FLAC__IOHandle handle, FLAC__int64 offset, int whence)
 {
-       FLAC__ASSERT(offset <= 0x7fffffff);
-       return fseek((FILE*)handle, (long)offset, whence);
+       return fseeko((FILE*)handle, (off_t)offset, whence);
 }
 
 FLAC__int64 ftell_wrapper_(FLAC__IOHandle handle)
 {
-       return (long)ftell((FILE*)handle);
+       return ftello((FILE*)handle);
 }
 
 FLAC__Metadata_ChainStatus get_equivalent_status_(FLAC__Metadata_SimpleIteratorStatus status)
index a192aff..521a49b 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 
index 7db8309..c301d1f 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for calloc() */
 #include <string.h> /* for memcpy()/memcmp() */
index 771c085..b943db7 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for calloc() */
 #include <string.h> /* for memcpy() */
index e0fd36a..657ece3 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for memset/memcpy() */
 #include "private/lpc.h"
 #include "private/memory.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef max
 #undef max
 #endif
index 2ff2f1c..6ecb872 100644 (file)
 /*@@@@@@*/
 #undef WINDOW_DEBUG_OUTPUT
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
 #include "private/stream_encoder_framing.h"
 #include "private/window.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef min
 #undef min
 #endif
index 311dd31..87611b7 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <string.h> /* for strlen() */
 #include "private/stream_encoder_framing.h"
index a13a21f..04cd662 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <math.h>
 #include "FLAC/assert.h"
 #include "FLAC/format.h"
index 3e8d372..926f6bc 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for strcmp() */
 #if defined _MSC_VER || defined __MINGW32__
 #include <io.h> /* for _setmode() */
 #include <fcntl.h> /* for _O_BINARY */
+#include <sys/types.h> /* for off_t */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
 #elif defined __CYGWIN__
 #include <io.h> /* for setmode(), O_BINARY */
 #include <fcntl.h> /* for _O_BINARY */
@@ -597,7 +605,7 @@ OggFLAC__SeekableStreamDecoderSeekStatus seek_callback_(const OggFLAC__SeekableS
        OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data;
        (void)decoder;
 
-       if(fseek(file_decoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0)
+       if(fseeko(file_decoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
                return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
        else
                return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK;
@@ -606,10 +614,10 @@ OggFLAC__SeekableStreamDecoderSeekStatus seek_callback_(const OggFLAC__SeekableS
 OggFLAC__SeekableStreamDecoderTellStatus tell_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
 {
        OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data;
-       long pos;
+       off_t pos;
        (void)decoder;
 
-       if((pos = ftell(file_decoder->private_->file)) < 0)
+       if((pos = ftello(file_decoder->private_->file)) < 0)
                return OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
        else {
                *absolute_byte_offset = (FLAC__uint64)pos;
index b16c581..e9e2821 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for strlen(), strcpy() */
+#if defined _MSC_VER || defined __MINGW32__
+#include <sys/types.h> /* for off_t */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
+#endif
 #include "FLAC/assert.h"
 #include "OggFLAC/seekable_stream_encoder.h"
 #include "protected/file_encoder.h"
@@ -756,7 +766,7 @@ FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const OggFLAC__SeekableStre
 
        FLAC__ASSERT(0 != file_encoder);
 
-       if(fseek(file_encoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0)
+       if(fseeko(file_encoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
                return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR;
        else
                return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK;
@@ -765,13 +775,13 @@ FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const OggFLAC__SeekableStre
 FLAC__SeekableStreamEncoderTellStatus tell_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
 {
        OggFLAC__FileEncoder *file_encoder = (OggFLAC__FileEncoder*)client_data;
-       long offset;
+       off_t offset;
 
        (void)encoder;
 
        FLAC__ASSERT(0 != file_encoder);
 
-       offset = ftell(file_encoder->private_->file);
+       offset = ftello(file_encoder->private_->file);
 
        if(offset < 0) {
                return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_ERROR;
index 14b6f1e..06e2852 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <string.h> /* for memcpy() */
 #include "FLAC/assert.h"
 #include "private/ogg_decoder_aspect.h"
index 97d4bc0..0ca9eed 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <string.h> /* for memset() */
 #include "FLAC/assert.h"
 #include "private/ogg_encoder_aspect.h"
index 2097907..bebd7f0 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for memcmp(), memcpy() */
 #include "FLAC/assert.h"
index 6dd2367..bfd27ad 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "private/ogg_mapping.h"
 
 const unsigned OggFLAC__MAPPING_PACKET_TYPE_LEN = 8; /* bits */
index 668b5ec..9721ef8 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for calloc() */
 #include <string.h> /* for memcpy()/memcmp() */
index 855b234..b222905 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for calloc() */
 #include <string.h> /* for memcpy() */
index bc253c0..21557c6 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h> /* for calloc() */
 #include "FLAC/assert.h"
 #include "protected/stream_decoder.h"
index dd172ea..1c7c95a 100644 (file)
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for calloc() */
 #include "FLAC/assert.h"
index dd81039..173c091 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "operations.h"
 #include "usage.h"
 #include "utils.h"
index a4d11a0..bd37fd4 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <errno.h>
+#include <stdio.h> /* for snprintf() */
+#include <string.h>
 #include "options.h"
 #include "utils.h"
 #include "FLAC/assert.h"
 #include "share/grabbag.h"
-#include <string.h>
 
 static FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, const char *cs_filename, FLAC__bool *needs_write, FLAC__uint64 lead_out_offset, FLAC__bool is_cdda, Argument_AddSeekpoint *add_seekpoint_link);
 static FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cuesheet, const char *cs_filename);
@@ -118,7 +124,7 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet,
                f = fopen(cs_filename, "r");
 
        if(0 == f) {
-               fprintf(stderr, "%s: ERROR: can't open import file %s\n", filename, cs_filename);
+               fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, cs_filename, strerror(errno));
                return false;
        }
 
@@ -183,7 +189,7 @@ FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cueshe
                f = fopen(cs_filename, "w");
 
        if(0 == f) {
-               fprintf(stderr, "%s: ERROR: can't open export file %s\n", filename, cs_filename);
+               fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, cs_filename, strerror(errno));
                return false;
        }
 
@@ -193,7 +199,11 @@ FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cueshe
                return false;
        }
 
+#ifdef _MSC_VER
+       _snprintf(ref, reflen, "\"%s\" FLAC", filename);
+#else
        snprintf(ref, reflen, "\"%s\" FLAC", filename);
+#endif
 
        grabbag__cuesheet_emit(f, cuesheet, ref);
 
index 8ab93e2..51ba63e 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "utils.h"
 #include "FLAC/assert.h"
 #include "FLAC/file_decoder.h"
index f9d729f..738bec0 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "options.h"
 #include "utils.h"
 #include "FLAC/assert.h"
index e28cbb5..700cdb4 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "options.h"
 #include "utils.h"
 #include "FLAC/assert.h"
 #include "share/grabbag.h" /* for grabbag__file_get_filesize() */
 #include "share/utf8.h"
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -195,10 +200,10 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const
                        die("out of memory allocating tag value");
                data[size] = '\0';
                if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
+                       fprintf(stderr, "%s: ERROR: while reading file '%s' for '%s' tag value: %s\n", filename, field->field_value, field->field_name, strerror(errno));
                        free(data);
                        if(f)
                                fclose(f);
-                       fprintf(stderr, "%s: ERROR: while reading file '%s' for '%s' tag value\n", filename, field->field_value, field->field_name);
                        return false;
                }
                fclose(f);
@@ -291,7 +296,7 @@ FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, con
                f = fopen(vc_filename->value, "r");
 
        if(0 == f) {
-               fprintf(stderr, "%s: ERROR: can't open import file %s\n", filename, vc_filename->value);
+               fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, vc_filename->value, strerror(errno));
                return false;
        }
 
@@ -348,7 +353,7 @@ FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const
                f = fopen(vc_filename->value, "w");
 
        if(0 == f) {
-               fprintf(stderr, "%s: ERROR: can't open export file %s\n", filename, vc_filename->value);
+               fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, vc_filename->value, strerror(errno));
                return false;
        }
 
index 7e94742..8deeaad 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "options.h"
 #include "usage.h"
 #include "utils.h"
index 4ba9f58..2ee9a4d 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "usage.h"
 #include "FLAC/format.h"
 #include <stdarg.h>
index 6dd88f8..75991d6 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "utils.h"
 #include "FLAC/assert.h"
 #include "share/utf8.h"
index 45a6665..adc7aea 100644 (file)
  * how to do this.\r
  */\r
 \r
+#if HAVE_CONFIG_H\r
+#  include <config.h>\r
+#endif\r
+\r
 #include<stdio.h>\r
 #include<stdlib.h>\r
 #include<string.h>\r
index bb07cc9..b307fd5 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
  */\r
 \r
-#include<io.h>\r
-#include<sys/stat.h>\r
-#include<wtypes.h>\r
-#include<winbase.h>\r
+#if HAVE_CONFIG_H\r
+#  include <config.h>\r
+#endif\r
+\r
+#include <io.h>\r
+#include <sys/stat.h>\r
+#include <wtypes.h>\r
+#include <winbase.h>\r
 \r
 int main(int argc, char *argv[])\r
 {\r
index 575ac2a..e63c5c4 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef HAVE_ICONV
 #include <iconv.h>
 #endif
index d7e0bae..feaf298 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "dither.h"
 #include "FLAC/assert.h"
 
index b9c83a4..8818d17 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "replaygain.h"
 #include "FLAC/ordinals.h"
 #include "FLAC/metadata.h"
index cf5a6ce..a8b283d 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index fa193e8..684e170 100644 (file)
@@ -18,8 +18,8 @@
 SUBDIRS = include
 
 EXTRA_DIST = \
-       config.h \
-       config.c \
+       configure.h \
+       configure.c \
        in_flac.c \
        in_flac.dsp \
        infobox.c \
similarity index 95%
rename from src/plugin_winamp2/config.c
rename to src/plugin_winamp2/configure.c
index 913b59b..53975b3 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
  */\r
 \r
+#if HAVE_CONFIG_H\r
+#  include <config.h>\r
+#endif\r
+\r
 #include <windows.h>\r
 #include <commctrl.h>\r
 #include <stdio.h>\r
-#include "config.h"\r
+#include "configure.h"\r
 #include "tagz.h"\r
 #include "resource.h"\r
 \r
index 6c3bea4..48af5f3 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
  */\r
 \r
+#if HAVE_CONFIG_H\r
+#  include <config.h>\r
+#endif\r
+\r
 #include <windows.h>\r
+#include <limits.h> /* for INT_MAX */\r
 #include <stdio.h>\r
 \r
 #include "winamp2/in2.h"\r
-#include "config.h"\r
+#include "configure.h"\r
 #include "infobox.h"\r
 #include "tagz.h"\r
 \r
@@ -326,33 +331,33 @@ static void getfileinfo(char *filename, char *title, int *length_in_msec)
 {\r
        FLAC__StreamMetadata streaminfo;\r
 \r
-       if (!filename || !*filename)\r
-       {\r
+       if (!filename || !*filename) {\r
                filename = lastfn_;\r
-               if (length_in_msec)\r
-               {\r
-                       *length_in_msec = (int)file_info_.length_in_msec;\r
-                       length_in_msec  = 0;    /* force skip in following code */\r
+               if (length_in_msec) {\r
+                       *length_in_msec = file_info_.length_in_msec;\r
+                       length_in_msec = 0;    /* force skip in following code */\r
                }\r
        }\r
 \r
-       if (!FLAC__metadata_get_streaminfo(filename, &streaminfo))\r
-       {\r
+       if (!FLAC__metadata_get_streaminfo(filename, &streaminfo)) {\r
                if (length_in_msec)\r
                        *length_in_msec = -1;\r
                return;\r
        }\r
 \r
-       if (title)\r
-       {\r
+       if (title) {\r
                static WCHAR buffer[400];\r
                format_title(filename, buffer, 400);\r
                WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, buffer, -1, title, 400, NULL, NULL);\r
        }\r
 \r
-       if (length_in_msec)\r
+       if (length_in_msec) {\r
                /* with VC++ you have to spoon feed it the casting from uint64->int64->double */\r
-               *length_in_msec = (int)((double)(FLAC__int64)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5);\r
+               FLAC__uint64 l = (FLAC__uint64)((double)(FLAC__int64)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5);\r
+               if (l > INT_MAX)\r
+                       l = INT_MAX;\r
+               *length_in_msec = (int)l;\r
+       }\r
 }\r
 \r
 /*\r
index 5be233a..8246805 100644 (file)
@@ -107,11 +107,11 @@ SOURCE=.\include\winamp2\out.h
 # End Group\r
 # Begin Source File\r
 \r
-SOURCE=.\config.c\r
+SOURCE=.\configure.c\r
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\config.h\r
+SOURCE=.\configure.h\r
 # End Source File\r
 # Begin Source File\r
 \r
index 640238e..2f9bce1 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
  */\r
 \r
+#if HAVE_CONFIG_H\r
+#  include <config.h>\r
+#endif\r
+\r
 #include <windows.h>\r
 #include <stdio.h>\r
 #include "FLAC/all.h"\r
 #include "plugin_common/all.h"\r
 #include "infobox.h"\r
-#include "config.h"\r
+#include "configure.h"\r
 #include "resource.h"\r
 \r
 \r
index d15ceb7..78965e5 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
  */\r
 \r
+#if HAVE_CONFIG_H\r
+#  include <config.h>\r
+#endif\r
+\r
+#include <limits.h> /* for INT_MAX */\r
 #include <stdlib.h>\r
 #include <string.h> /* for memmove() */\r
 #include "playback.h"\r
@@ -60,8 +65,7 @@ static void metadata_callback(const FLAC__FileDecoder *decoder, const FLAC__Stre
 \r
        if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO)\r
        {\r
-               FLAC__ASSERT(metadata->data.stream_info.total_samples < 0x100000000); /* this plugin can only handle < 4 gigasamples */\r
-               file_info->total_samples = (unsigned)(metadata->data.stream_info.total_samples&0xfffffffful);\r
+               file_info->total_samples = metadata->data.stream_info.total_samples;\r
                file_info->bits_per_sample = metadata->data.stream_info.bits_per_sample;\r
                file_info->channels = metadata->data.stream_info.channels;\r
                file_info->sample_rate = metadata->data.stream_info.sample_rate;\r
@@ -72,7 +76,14 @@ static void metadata_callback(const FLAC__FileDecoder *decoder, const FLAC__Stre
                        file_info->abort_flag = true;\r
                        return;\r
                }\r
-               file_info->length_in_msec = (unsigned)((double)file_info->total_samples / (double)file_info->sample_rate * 1000.0 + 0.5);\r
+\r
+               {\r
+                       /* with VC++ you have to spoon feed it the casting from uint64->int64->double */\r
+                       FLAC__uint64 l = (FLAC__uint64)((double)(FLAC__int64)file_info->total_samples / (double)file_info->sample_rate * 1000.0 + 0.5);\r
+                       if (l > INT_MAX)\r
+                               l = INT_MAX;\r
+                       file_info->length_in_msec = (int)l;\r
+               }\r
        }\r
        else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT)\r
        {\r
@@ -143,7 +154,7 @@ FLAC__bool FLAC_plugin__decoder_init(FLAC__FileDecoder *decoder, const char *fil
        file_info->eof = false;\r
        file_info->seek_to = -1;\r
        file_info->is_playing = true;\r
-       file_info->average_bps = (unsigned)(filesize / (125.*file_info->total_samples/file_info->sample_rate));\r
+       file_info->average_bps = (unsigned)(filesize / (125.*(double)(FLAC__int64)file_info->total_samples/(double)file_info->sample_rate));\r
        \r
        bh_index_last_w = 0;\r
        bh_index_last_o = BITRATE_HIST_SIZE;\r
@@ -176,8 +187,7 @@ void FLAC_plugin__decoder_delete(FLAC__FileDecoder *decoder)
 int FLAC_plugin__seek(FLAC__FileDecoder *decoder, file_info_struct *file_info)\r
 {\r
        int pos;\r
-       const FLAC__uint64 target_sample =\r
-               (FLAC__uint64)file_info->total_samples*file_info->seek_to / file_info->length_in_msec;\r
+       const FLAC__uint64 target_sample = file_info->total_samples * file_info->seek_to / file_info->length_in_msec;\r
 \r
        if (!FLAC__file_decoder_seek_absolute(decoder, target_sample))\r
                return -1;\r
index a39149b..4120791 100644 (file)
@@ -38,12 +38,12 @@ typedef struct {
        volatile FLAC__bool abort_flag;\r
        volatile FLAC__bool eof;\r
        volatile int seek_to;\r
-       unsigned total_samples;\r
+       FLAC__uint64 total_samples;\r
        unsigned bits_per_sample;\r
        unsigned output_bits_per_sample;\r
        unsigned channels;\r
        unsigned sample_rate;\r
-       unsigned length_in_msec;\r
+       int length_in_msec; /* int (instead of FLAC__uint64) only because that's what Winamp uses; seeking won't work right if this maxes out */\r
        unsigned average_bps;\r
        FLAC__bool has_replaygain;\r
        double replay_scale;\r
index a75db2c..ddbca98 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h>
 #include <glib.h>
 #include <string.h>
index 6e6f571..4fd3448 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
index 01f8dba..a79dac0 100644 (file)
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h>
 #include <string.h> /* for strlen() */
 #include <sys/types.h>
@@ -223,7 +227,11 @@ static void show_file_info()
                                (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate % 60));
 
        if(!stat(current_filename, &_stat) && S_ISREG(_stat.st_mode)) {
+#if _FILE_OFFSET_BITS = 64
+               label_set_text(flac_filesize, _("Filesize: %lld B"), _stat.st_size);
+#else
                label_set_text(flac_filesize, _("Filesize: %ld B"), _stat.st_size);
+#endif
                if (streaminfo.data.stream_info.total_samples)
                        label_set_text(flac_bitrate, _("Avg. bitrate: %.1f kb/s\nCompression ratio: %.1f%%"),
                                        8.0 * (float)(_stat.st_size) / (1000.0 * (float)streaminfo.data.stream_info.total_samples / (float)streaminfo.data.stream_info.sample_rate),
index 0876bb4..fadede1 100644 (file)
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 /* modified for FLAC support by Steven Richman (2003) */
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <xmms/util.h>
 #include <xmms/plugin.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "configure.h"
 #include "plugin_common/locale_hack.h"
 #include "FLAC/format.h"
index 1d4e61a..d6f409f 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <limits.h>
 #include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
 #include <xmms/configfile.h>
 #include <xmms/titlestring.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #ifdef HAVE_LANGINFO_CODESET
 #include <langinfo.h>
 #endif
 #endif
 #define min(x,y) ((x)<(y)?(x):(y))
 
-/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */
-#ifdef _MSC_VER
-#define FLAC__U64L(x) x
-#else
-#define FLAC__U64L(x) x##LLU
-#endif
-
 extern void FLAC_XMMS__file_info_box(char *filename);
 
 typedef struct {
@@ -66,11 +60,11 @@ typedef struct {
        FLAC__bool is_playing;
        FLAC__bool eof;
        FLAC__bool play_thread_open; /* if true, is_playing must also be true */
-       unsigned total_samples;
+       FLAC__uint64 total_samples;
        unsigned bits_per_sample;
        unsigned channels;
        unsigned sample_rate;
-       unsigned length_in_msec;
+       int length_in_msec; /* int (instead of FLAC__uint64) only because that's what XMMS uses; seeking won't work right if this maxes out */
        gchar *title;
        AFormat sample_format;
        unsigned sample_format_bytes_per_sample;
@@ -450,8 +444,12 @@ void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec)
        if(title) {
                *title = flac_format_song_title(filename);
        }
-       if(length_in_msec)
-               *length_in_msec = (unsigned)((double)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5);
+       if(length_in_msec) {
+               FLAC__uint64 l = (FLAC__uint64)((double)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5);
+               if (l > INT_MAX)
+                       l = INT_MAX;
+               *length_in_msec = (int)l;
+       }
 }
 
 /***********************************************************************
@@ -524,8 +522,8 @@ void *play_loop_(void *arg)
                        xmms_usleep(10000);
                if(decoder_func_table_->seekable && file_info_.seek_to_in_sec != -1) {
                        const double distance = (double)file_info_.seek_to_in_sec * 1000.0 / (double)file_info_.length_in_msec;
-                       unsigned target_sample = (unsigned)(distance * (double)file_info_.total_samples);
-                       if(FLAC__file_decoder_seek_absolute(decoder_, (FLAC__uint64)target_sample)) {
+                       FLAC__uint64 target_sample = (FLAC__uint64)(distance * (double)file_info_.total_samples);
+                       if(FLAC__file_decoder_seek_absolute(decoder_, target_sample)) {
                                flac_ip.output->flush(file_info_.seek_to_in_sec * 1000);
                                bh_index_last_w = bh_index_last_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE;
                                if(!FLAC__file_decoder_get_decode_position(decoder_, &decode_position_frame))
@@ -610,8 +608,7 @@ static FLAC__bool http_decoder_set_md5_checking (void *decoder, FLAC__bool value
 {
        (void) value;
        // operation unsupported
-       return FLAC__stream_decoder_get_state ((const FLAC__StreamDecoder *) decoder) ==
-               FLAC__STREAM_DECODER_UNINITIALIZED;
+       return FLAC__stream_decoder_get_state ((const FLAC__StreamDecoder *) decoder) == FLAC__STREAM_DECODER_UNINITIALIZED;
 }
 
 static FLAC__bool http_decoder_set_url (void *decoder, const char* url)
@@ -800,12 +797,16 @@ void metadata_callback_(const void *decoder, const FLAC__StreamMetadata *metadat
        file_info_struct *file_info = (file_info_struct *)client_data;
        (void)decoder;
        if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
-               FLAC__ASSERT(metadata->data.stream_info.total_samples < FLAC__U64L(0x100000000)); /* this plugin can only handle < 4 gigasamples */
-               file_info->total_samples = (unsigned)(metadata->data.stream_info.total_samples&0xffffffff);
+               file_info->total_samples = metadata->data.stream_info.total_samples;
                file_info->bits_per_sample = metadata->data.stream_info.bits_per_sample;
                file_info->channels = metadata->data.stream_info.channels;
                file_info->sample_rate = metadata->data.stream_info.sample_rate;
-               file_info->length_in_msec = (unsigned)((double)file_info->total_samples / (double)file_info->sample_rate * 1000.0 + 0.5);
+               {
+                       FLAC__uint64 l = (FLAC__uint64)((double)file_info->total_samples / (double)file_info->sample_rate * 1000.0 + 0.5);
+                       if (l > INT_MAX)
+                               l = INT_MAX;
+                       file_info->length_in_msec = (int)l;
+               }
        }
        else if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
                double gain, peak;
index 0d73c83..308f064 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
index 1e90fa8..279dff0 100644 (file)
@@ -41,8 +41,8 @@
 # define _NO_PROTO
 #endif
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
+#if HAVE_CONFIG_H
+#  include <config.h>
 #endif
 
 #if !defined __STDC__ || !__STDC__
index 6c8c1ca..1e57486 100644 (file)
@@ -32,8 +32,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 \f
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+#  include <config.h>
 #endif
 
 #include "share/getopt.h"
index 19c8938..3de01ed 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "share/grabbag.h"
 #include "FLAC/assert.h"
 #include <stdio.h>
index 6295954..7d7cb5e 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #if defined _MSC_VER || defined __MINGW32__
 #include <sys/utime.h> /* for utime() */
 #include <io.h> /* for chmod(), _setmode(), unlink() */
index ca3316d..356fc9f 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "share/grabbag.h"
 #include "share/replaygain_analysis.h"
 #include "FLAC/assert.h"
index 92f4201..7893eb1 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "share/grabbag.h"
 #include "FLAC/assert.h"
 #include <stdlib.h> /* for atoi() */
index 43e2ba6..5b9637c 100644 (file)
  *  Optimization/clarity suggestions are welcome.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index b497092..85c5aac 100644 (file)
  * Additional code by Magnus Holmgren and Gian-Carlo Pascutto
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <string.h> /* for memset() */
 #include <math.h>
 #include "private/fast_float_math_hack.h"
index 0b79699..3d13064 100644 (file)
@@ -27,8 +27,8 @@
  * 8-bit char, 16-bit short and 32-bit int.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+#  include <config.h>
 #endif
 
 #ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */
index 87426d0..1d5bf71 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <assert.h>
 #include <string.h>
 
index a23168f..b72ad86 100644 (file)
@@ -16,8 +16,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+#  include <config.h>
 #endif
 
 #ifdef HAVE_ICONV
index e19c196..72a9de1 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <errno.h>
 #include <iconv.h>
 #include <stdio.h>
index 174d51f..a77e38b 100644 (file)
  * Convert a string between UTF-8 and the locale's charset.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "utf8.h"
 #include "charset.h"
 
index 1986f97..6bbf04a 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -40,7 +45,7 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64
                fin = stdin;
        }
        else if(0 == (fin = fopen(infilename, "r"))) {
-               fprintf(stderr, "can't open file %s for reading\n", infilename);
+               fprintf(stderr, "can't open file %s for reading: %s\n", infilename, strerror(errno));
                return 255;
        }
        if(0 != (cuesheet = grabbag__cuesheet_parse(fin, &error_message, &last_line_read, is_cdda, lead_out_offset))) {
@@ -60,7 +65,7 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64
        }
        sprintf(tmpfilename, "%s.1", infilename);
        if(0 == (fout = fopen(tmpfilename, "w"))) {
-               fprintf(stderr, "can't open file %s for writing\n", tmpfilename);
+               fprintf(stderr, "can't open file %s for writing: %s\n", tmpfilename, strerror(errno));
                FLAC__metadata_object_delete(cuesheet);
                return 255;
        }
@@ -72,7 +77,7 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64
         * pass 2
         */
        if(0 == (fin = fopen(tmpfilename, "r"))) {
-               fprintf(stderr, "can't open file %s for reading\n", tmpfilename);
+               fprintf(stderr, "can't open file %s for reading: %s\n", tmpfilename, strerror(errno));
                return 255;
        }
        if(0 != (cuesheet = grabbag__cuesheet_parse(fin, &error_message, &last_line_read, is_cdda, lead_out_offset))) {
@@ -92,7 +97,7 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64
        }
        sprintf(tmpfilename, "%s.2", infilename);
        if(0 == (fout = fopen(tmpfilename, "w"))) {
-               fprintf(stderr, "can't open file %s for writing\n", tmpfilename);
+               fprintf(stderr, "can't open file %s for writing: %s\n", tmpfilename, strerror(errno));
                FLAC__metadata_object_delete(cuesheet);
                return 255;
        }
index d682cfd..a6ba8e7 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined _MSC_VER || defined __MINGW32__
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
+#endif
 #include "decoders.h"
 extern "C" {
 #include "file_utils.h"
@@ -25,10 +34,6 @@ extern "C" {
 #include "FLAC/metadata.h" // for ::FLAC__metadata_object_is_equal()
 #include "FLAC++/decoder.h"
 #include "share/grabbag.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #ifdef _MSC_VER
 // warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
@@ -39,7 +44,7 @@ static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_,
 static ::FLAC__StreamMetadata *expected_metadata_sequence_[8];
 static unsigned num_expected_;
 static const char *flacfilename_ = "metadata.flac";
-static unsigned flacfilesize_;
+static off_t flacfilesize_;
 
 static bool die_(const char *msg)
 {
@@ -221,7 +226,7 @@ bool StreamDecoder::test_respond()
 
        current_metadata_number_ = 0;
 
-       if(::fseek(file_, 0, SEEK_SET) < 0) {
+       if(fseeko(file_, 0, SEEK_SET) < 0) {
                printf("FAILED rewinding input, errno = %d\n", errno);
                return false;
        }
@@ -333,7 +338,7 @@ static bool test_stream_decoder()
        printf("opening FLAC file... ");
        decoder->file_ = ::fopen(flacfilename_, "rb");
        if(0 == decoder->file_) {
-               printf("ERROR\n");
+               printf("ERROR (%s)\n", strerror(errno));
                return false;
        }
        printf("OK\n");
@@ -421,7 +426,7 @@ static bool test_stream_decoder()
        decoder->current_metadata_number_ = 0;
 
        printf("rewinding input... ");
-       if(::fseek(decoder->file_, 0, SEEK_SET) < 0) {
+       if(fseeko(decoder->file_, 0, SEEK_SET) < 0) {
                printf("FAILED, errno = %d\n", errno);
                return false;
        }
@@ -835,7 +840,7 @@ public:
        if(error_occurred_)
                return ::FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
 
-       if(::fseek(file_, (long)absolute_byte_offset, SEEK_SET) < 0) {
+       if(fseeko(file_, (off_t)absolute_byte_offset, SEEK_SET) < 0) {
                error_occurred_ = true;
                return ::FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
        }
@@ -848,7 +853,7 @@ public:
        if(error_occurred_)
                return ::FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
 
-       long offset = ::ftell(file_);
+       off_t offset = ftello(file_);
        *absolute_byte_offset = (FLAC__uint64)offset;
 
        if(offset < 0) {
@@ -925,7 +930,7 @@ bool SeekableStreamDecoder::test_respond()
 
        current_metadata_number_ = 0;
 
-       if(::fseek(file_, 0, SEEK_SET) < 0) {
+       if(fseeko(file_, 0, SEEK_SET) < 0) {
                printf("FAILED rewinding input, errno = %d\n", errno);
                return false;
        }
@@ -1048,7 +1053,7 @@ static bool test_seekable_stream_decoder()
        printf("opening FLAC file... ");
        decoder->file_ = ::fopen(flacfilename_, "rb");
        if(0 == decoder->file_) {
-               printf("ERROR\n");
+               printf("ERROR (%s)\n", strerror(errno));
                return false;
        }
        printf("OK\n");
@@ -1148,7 +1153,7 @@ static bool test_seekable_stream_decoder()
        decoder->current_metadata_number_ = 0;
 
        printf("rewinding input... ");
-       if(::fseek(decoder->file_, 0, SEEK_SET) < 0) {
+       if(fseeko(decoder->file_, 0, SEEK_SET) < 0) {
                printf("FAILED, errno = %d\n", errno);
                return false;
        }
index 800bbc9..8baf9ea 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "file_utils.h"
 #include "FLAC/assert.h"
 #include "FLAC/stream_encoder.h"
@@ -61,7 +65,7 @@ static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const
        (void)encoder, (void)metadata, (void)client_data;
 }
 
-FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata)
+FLAC__bool file_utils__generate_flacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata)
 {
        FLAC__int32 samples[1024];
        FLAC__StreamEncoder *encoder;
@@ -136,7 +140,7 @@ FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *
                if(stat(output_filename, &filestats) != 0)
                        return false;
                else
-                       *output_filesize = (unsigned)filestats.st_size;
+                       *output_filesize = filestats.st_size;
        }
 
        return true;
index 74b7201..1284616 100644 (file)
 #ifndef FLAC__TEST_LIBFLAC_FILE_UTILS_H
 #define FLAC__TEST_LIBFLAC_FILE_UTILS_H
 
+/* needed because of off_t */
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/format.h"
+#include <stdlib.h> /* for off_t */
+#if defined _MSC_VER || defined __MINGW32__
+#include <sys/types.h> /* for off_t */
+#endif
 
-FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
+FLAC__bool file_utils__generate_flacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
 
 #endif
index 44e2a27..ada4f9e 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-extern "C" {
-#include "file_utils.h"
-}
-#include "FLAC/assert.h"
-#include "FLAC++/decoder.h"
-#include "FLAC++/metadata.h"
-#include "share/grabbag.h"
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for memcpy()/memset() */
-
 #if defined _MSC_VER || defined __MINGW32__
 #include <sys/utime.h> /* for utime() */
 #include <io.h> /* for chmod() */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
 #else
 #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
 #include <utime.h> /* for utime() */
 #include <unistd.h> /* for chown(), unlink() */
 #endif
 #include <sys/stat.h> /* for stat(), maybe chmod() */
+extern "C" {
+#include "file_utils.h"
+}
+#include "FLAC/assert.h"
+#include "FLAC++/decoder.h"
+#include "FLAC++/metadata.h"
+#include "share/grabbag.h"
 
 /******************************************************************************
        The general strategy of these tests (for interface levels 1 and 2) is
@@ -275,14 +277,14 @@ static size_t chain_write_cb_(const void *ptr, size_t size, size_t nmemb, ::FLAC
 
 static int chain_seek_cb_(::FLAC__IOHandle handle, FLAC__int64 offset, int whence)
 {
-       long o = (long)offset;
+       off_t o = (off_t)offset;
        FLAC__ASSERT(offset == o);
-       return fseek((FILE*)handle, o, whence);
+       return fseeko((FILE*)handle, o, whence);
 }
 
 static FLAC__int64 chain_tell_cb_(::FLAC__IOHandle handle)
 {
-       return ftell((FILE*)handle);
+       return ftello((FILE*)handle);
 }
 
 static int chain_eof_cb_(::FLAC__IOHandle handle)
index dcfa765..c866982 100644 (file)
  * These are not tests, just utility functions used by the metadata tests
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "metadata_utils.h"
 #include "FLAC/metadata.h"
 #include <stdio.h>
index 70c9951..52b5eaa 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/assert.h"
 #include "private/bitbuffer.h" /* from the libFLAC private include area */
 #include <stdio.h>
index 8a63ab7..f208a5b 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined _MSC_VER || defined __MINGW32__
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
+#endif
 #include "decoders.h"
 #include "file_utils.h"
 #include "metadata_utils.h"
 #include "FLAC/seekable_stream_decoder.h"
 #include "FLAC/stream_decoder.h"
 #include "share/grabbag.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 typedef struct {
        FILE *file;
@@ -43,7 +52,7 @@ static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, ap
 static FLAC__StreamMetadata *expected_metadata_sequence_[8];
 static unsigned num_expected_;
 static const char *flacfilename_ = "metadata.flac";
-static unsigned flacfilesize_;
+static off_t flacfilesize_;
 
 static FLAC__bool die_(const char *msg)
 {
@@ -265,7 +274,7 @@ static FLAC__bool stream_decoder_test_respond_(FLAC__StreamDecoder *decoder, str
 
        dcd->current_metadata_number = 0;
 
-       if(fseek(dcd->file, 0, SEEK_SET) < 0) {
+       if(fseeko(dcd->file, 0, SEEK_SET) < 0) {
                printf("FAILED rewinding input, errno = %d\n", errno);
                return false;
        }
@@ -371,7 +380,7 @@ static FLAC__bool test_stream_decoder()
        printf("opening FLAC file... ");
        decoder_client_data.file = fopen(flacfilename_, "rb");
        if(0 == decoder_client_data.file) {
-               printf("ERROR\n");
+               printf("ERROR (%s)\n", strerror(errno));
                return false;
        }
        printf("OK\n");
@@ -462,7 +471,7 @@ static FLAC__bool test_stream_decoder()
        decoder_client_data.current_metadata_number = 0;
 
        printf("rewinding input... ");
-       if(fseek(decoder_client_data.file, 0, SEEK_SET) < 0) {
+       if(fseeko(decoder_client_data.file, 0, SEEK_SET) < 0) {
                printf("FAILED, errno = %d\n", errno);
                return false;
        }
@@ -814,7 +823,7 @@ static FLAC__SeekableStreamDecoderSeekStatus seekable_stream_decoder_seek_callba
        if(dcd->error_occurred)
                return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
 
-       if(fseek(dcd->file, (long)absolute_byte_offset, SEEK_SET) < 0) {
+       if(fseeko(dcd->file, (off_t)absolute_byte_offset, SEEK_SET) < 0) {
                dcd->error_occurred = true;
                return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
        }
@@ -825,7 +834,7 @@ static FLAC__SeekableStreamDecoderSeekStatus seekable_stream_decoder_seek_callba
 static FLAC__SeekableStreamDecoderTellStatus seekable_stream_decoder_tell_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
 {
        seekable_stream_decoder_client_data_struct *dcd = (seekable_stream_decoder_client_data_struct*)client_data;
-       long offset;
+       off_t offset;
 
        (void)decoder;
 
@@ -837,7 +846,7 @@ static FLAC__SeekableStreamDecoderTellStatus seekable_stream_decoder_tell_callba
        if(dcd->error_occurred)
                return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
 
-       offset = ftell(dcd->file);
+       offset = ftello(dcd->file);
        *absolute_byte_offset = (FLAC__uint64)offset;
 
        if(offset < 0) {
@@ -940,7 +949,7 @@ static FLAC__bool seekable_stream_decoder_test_respond_(FLAC__SeekableStreamDeco
 
        dcd->current_metadata_number = 0;
 
-       if(fseek(dcd->file, 0, SEEK_SET) < 0) {
+       if(fseeko(dcd->file, 0, SEEK_SET) < 0) {
                printf("FAILED rewinding input, errno = %d\n", errno);
                return false;
        }
@@ -1076,7 +1085,7 @@ static FLAC__bool test_seekable_stream_decoder()
        printf("opening FLAC file... ");
        decoder_client_data.file = fopen(flacfilename_, "rb");
        if(0 == decoder_client_data.file) {
-               printf("ERROR\n");
+               printf("ERROR (%s)\n", strerror(errno));
                return false;
        }
        printf("OK\n");
@@ -1176,7 +1185,7 @@ static FLAC__bool test_seekable_stream_decoder()
        decoder_client_data.current_metadata_number = 0;
 
        printf("rewinding input... ");
-       if(fseek(decoder_client_data.file, 0, SEEK_SET) < 0) {
+       if(fseeko(decoder_client_data.file, 0, SEEK_SET) < 0) {
                printf("FAILED, errno = %d\n", errno);
                return false;
        }
index 25eb943..34ec1ae 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "encoders.h"
 #include "file_utils.h"
 #include "metadata_utils.h"
index 800bbc9..8baf9ea 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "file_utils.h"
 #include "FLAC/assert.h"
 #include "FLAC/stream_encoder.h"
@@ -61,7 +65,7 @@ static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const
        (void)encoder, (void)metadata, (void)client_data;
 }
 
-FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata)
+FLAC__bool file_utils__generate_flacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata)
 {
        FLAC__int32 samples[1024];
        FLAC__StreamEncoder *encoder;
@@ -136,7 +140,7 @@ FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *
                if(stat(output_filename, &filestats) != 0)
                        return false;
                else
-                       *output_filesize = (unsigned)filestats.st_size;
+                       *output_filesize = filestats.st_size;
        }
 
        return true;
index 74b7201..1284616 100644 (file)
 #ifndef FLAC__TEST_LIBFLAC_FILE_UTILS_H
 #define FLAC__TEST_LIBFLAC_FILE_UTILS_H
 
+/* needed because of off_t */
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/format.h"
+#include <stdlib.h> /* for off_t */
+#if defined _MSC_VER || defined __MINGW32__
+#include <sys/types.h> /* for off_t */
+#endif
 
-FLAC__bool file_utils__generate_flacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
+FLAC__bool file_utils__generate_flacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
 
 #endif
index ee44c24..9c55a9a 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/assert.h"
 #include "FLAC/format.h"
 #include <stdio.h>
index 244adb9..0ff40bb 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "bitbuffer.h"
 #include "decoders.h"
 #include "encoders.h"
index ba35d3d..a972d40 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "metadata.h"
 #include <stdio.h>
 
index 26d1a80..55d85ef 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#include "file_utils.h"
-#include "metadata_utils.h"
-#include "FLAC/assert.h"
-#include "FLAC/file_decoder.h"
-#include "FLAC/metadata.h"
-#include "share/grabbag.h"
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h> /* for malloc() */
-
 #if defined _MSC_VER || defined __MINGW32__
 #include <sys/utime.h> /* for utime() */
 #include <io.h> /* for chmod() */
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
 #else
 #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
 #include <utime.h> /* for utime() */
 #include <unistd.h> /* for chown(), unlink() */
 #endif
 #include <sys/stat.h> /* for stat(), maybe chmod() */
+#include "file_utils.h"
+#include "metadata_utils.h"
+#include "FLAC/assert.h"
+#include "FLAC/file_decoder.h"
+#include "FLAC/metadata.h"
+#include "share/grabbag.h"
 
 
 /******************************************************************************
@@ -258,14 +264,14 @@ static size_t chain_write_cb_(const void *ptr, size_t size, size_t nmemb, FLAC__
 
 static int chain_seek_cb_(FLAC__IOHandle handle, FLAC__int64 offset, int whence)
 {
-       long o = (long)offset;
+       off_t o = (off_t)offset;
        FLAC__ASSERT(offset == o);
-       return fseek((FILE*)handle, o, whence);
+       return fseeko((FILE*)handle, o, whence);
 }
 
 static FLAC__int64 chain_tell_cb_(FLAC__IOHandle handle)
 {
-       return ftell((FILE*)handle);
+       return ftello((FILE*)handle);
 }
 
 static int chain_eof_cb_(FLAC__IOHandle handle)
index 6d8b8d4..2805d41 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/assert.h"
 #include "FLAC/metadata.h"
 #include "metadata_utils.h"
index dcfa765..c866982 100644 (file)
  * These are not tests, just utility functions used by the metadata tests
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "metadata_utils.h"
 #include "FLAC/metadata.h"
 #include <stdio.h>
index 5d0a0dc..0222cd9 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined _MSC_VER || defined __MINGW32__
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
+#endif
 #include "decoders.h"
 extern "C" {
 #include "file_utils.h"
@@ -25,10 +34,6 @@ extern "C" {
 #include "FLAC/metadata.h" // for ::FLAC__metadata_object_is_equal()
 #include "OggFLAC++/decoder.h"
 #include "share/grabbag.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #ifdef _MSC_VER
 // warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
@@ -39,7 +44,7 @@ static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_,
 static ::FLAC__StreamMetadata *expected_metadata_sequence_[8];
 static unsigned num_expected_;
 static const char *oggflacfilename_ = "metadata.ogg";
-static unsigned oggflacfilesize_;
+static off_t oggflacfilesize_;
 
 static bool die_(const char *msg)
 {
@@ -223,7 +228,7 @@ bool StreamDecoder::test_respond()
 
        current_metadata_number_ = 0;
 
-       if(::fseek(file_, 0, SEEK_SET) < 0) {
+       if(fseeko(file_, 0, SEEK_SET) < 0) {
                printf("FAILED rewinding input, errno = %d\n", errno);
                return false;
        }
@@ -344,7 +349,7 @@ static bool test_stream_decoder()
        printf("opening Ogg FLAC file... ");
        decoder->file_ = ::fopen(oggflacfilename_, "rb");
        if(0 == decoder->file_) {
-               printf("ERROR\n");
+               printf("ERROR (%s)\n", strerror(errno));
                return false;
        }
        printf("OK\n");
@@ -427,7 +432,7 @@ static bool test_stream_decoder()
        decoder->current_metadata_number_ = 0;
 
        printf("rewinding input... ");
-       if(::fseek(decoder->file_, 0, SEEK_SET) < 0) {
+       if(fseeko(decoder->file_, 0, SEEK_SET) < 0) {
                printf("FAILED, errno = %d\n", errno);
                return false;
        }
@@ -841,7 +846,7 @@ public:
        if(error_occurred_)
                return ::OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
 
-       if(::fseek(file_, (long)absolute_byte_offset, SEEK_SET) < 0) {
+       if(fseeko(file_, (off_t)absolute_byte_offset, SEEK_SET) < 0) {
                error_occurred_ = true;
                return ::OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
        }
@@ -854,7 +859,7 @@ public:
        if(error_occurred_)
                return ::OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
 
-       long offset = ::ftell(file_);
+       off_t offset = ftello(file_);
        *absolute_byte_offset = (FLAC__uint64)offset;
 
        if(offset < 0) {
@@ -935,7 +940,7 @@ bool SeekableStreamDecoder::test_respond()
 
        current_metadata_number_ = 0;
 
-       if(::fseek(file_, 0, SEEK_SET) < 0) {
+       if(fseeko(file_, 0, SEEK_SET) < 0) {
                printf("FAILED rewinding input, errno = %d\n", errno);
                return false;
        }
@@ -1067,7 +1072,7 @@ static bool test_seekable_stream_decoder()
        printf("opening Ogg FLAC file... ");
        decoder->file_ = ::fopen(oggflacfilename_, "rb");
        if(0 == decoder->file_) {
-               printf("ERROR\n");
+               printf("ERROR (%s)\n", strerror(errno));
                return false;
        }
        printf("OK\n");
@@ -1162,7 +1167,7 @@ static bool test_seekable_stream_decoder()
        decoder->current_metadata_number_ = 0;
 
        printf("rewinding input... ");
-       if(::fseek(decoder->file_, 0, SEEK_SET) < 0) {
+       if(fseeko(decoder->file_, 0, SEEK_SET) < 0) {
                printf("FAILED, errno = %d\n", errno);
                return false;
        }
index ea7d4ab..d397b5b 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "file_utils.h"
 #include "FLAC/assert.h"
 #include "OggFLAC/stream_encoder.h"
@@ -63,7 +67,7 @@ static void encoder_metadata_callback_(const OggFLAC__StreamEncoder *encoder, co
        (void)encoder, (void)metadata, (void)client_data;
 }
 
-FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata)
+FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata)
 {
        FLAC__int32 samples[1024];
        OggFLAC__StreamEncoder *encoder;
@@ -139,7 +143,7 @@ FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, unsigne
                if(stat(output_filename, &filestats) != 0)
                        return false;
                else
-                       *output_filesize = (unsigned)filestats.st_size;
+                       *output_filesize = filestats.st_size;
        }
 
        return true;
index 69361e7..736ec92 100644 (file)
 #ifndef OggFLAC__TEST_LIBOGGFLAC_FILE_UTILS_H
 #define OggFLAC__TEST_LIBOGGFLAC_FILE_UTILS_H
 
+/* needed because of off_t */
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/format.h"
+#include <stdlib.h> /* for off_t */
+#if defined _MSC_VER || defined __MINGW32__
+#include <sys/types.h> /* for off_t */
+#endif
 
 extern const long file_utils__serial_number;
 
-FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
+FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
 
 #endif
index dcfa765..c866982 100644 (file)
  * These are not tests, just utility functions used by the metadata tests
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "metadata_utils.h"
 #include "FLAC/metadata.h"
 #include <stdio.h>
index a6f5ca9..2f356be 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined _MSC_VER || defined __MINGW32__
+//@@@ [2G limit] hacks for MSVC6
+#define fseeko fseek
+#define ftello ftell
+#endif
 #include "decoders.h"
 #include "file_utils.h"
 #include "metadata_utils.h"
 #include "OggFLAC/seekable_stream_decoder.h"
 #include "OggFLAC/stream_decoder.h"
 #include "share/grabbag.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 typedef struct {
        FILE *file;
@@ -43,7 +52,7 @@ static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, ap
 static FLAC__StreamMetadata *expected_metadata_sequence_[8];
 static unsigned num_expected_;
 static const char *oggflacfilename_ = "metadata.ogg";
-static unsigned oggflacfilesize_;
+static off_t oggflacfilesize_;
 
 static FLAC__bool die_(const char *msg)
 {
@@ -277,7 +286,7 @@ static FLAC__bool stream_decoder_test_respond_(OggFLAC__StreamDecoder *decoder,
 
        dcd->current_metadata_number = 0;
 
-       if(fseek(dcd->file, 0, SEEK_SET) < 0) {
+       if(fseeko(dcd->file, 0, SEEK_SET) < 0) {
                printf("FAILED rewinding input, errno = %d\n", errno);
                return false;
        }
@@ -393,7 +402,7 @@ static FLAC__bool test_stream_decoder()
        printf("opening Ogg FLAC file... ");
        decoder_client_data.file = fopen(oggflacfilename_, "rb");
        if(0 == decoder_client_data.file) {
-               printf("ERROR\n");
+               printf("ERROR (%s)\n", strerror(errno));
                return false;
        }
        printf("OK\n");
@@ -479,7 +488,7 @@ static FLAC__bool test_stream_decoder()
        decoder_client_data.current_metadata_number = 0;
 
        printf("rewinding input... ");
-       if(fseek(decoder_client_data.file, 0, SEEK_SET) < 0) {
+       if(fseeko(decoder_client_data.file, 0, SEEK_SET) < 0) {
                printf("FAILED, errno = %d\n", errno);
                return false;
        }
@@ -831,7 +840,7 @@ static OggFLAC__SeekableStreamDecoderSeekStatus seekable_stream_decoder_seek_cal
        if(dcd->error_occurred)
                return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
 
-       if(fseek(dcd->file, (long)absolute_byte_offset, SEEK_SET) < 0) {
+       if(fseeko(dcd->file, (off_t)absolute_byte_offset, SEEK_SET) < 0) {
                dcd->error_occurred = true;
                return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
        }
@@ -842,7 +851,7 @@ static OggFLAC__SeekableStreamDecoderSeekStatus seekable_stream_decoder_seek_cal
 static OggFLAC__SeekableStreamDecoderTellStatus seekable_stream_decoder_tell_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
 {
        seekable_stream_decoder_client_data_struct *dcd = (seekable_stream_decoder_client_data_struct*)client_data;
-       long offset;
+       off_t offset;
 
        (void)decoder;
 
@@ -854,7 +863,7 @@ static OggFLAC__SeekableStreamDecoderTellStatus seekable_stream_decoder_tell_cal
        if(dcd->error_occurred)
                return OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR;
 
-       offset = ftell(dcd->file);
+       offset = ftello(dcd->file);
        *absolute_byte_offset = (FLAC__uint64)offset;
 
        if(offset < 0) {
@@ -957,7 +966,7 @@ static FLAC__bool seekable_stream_decoder_test_respond_(OggFLAC__SeekableStreamD
 
        dcd->current_metadata_number = 0;
 
-       if(fseek(dcd->file, 0, SEEK_SET) < 0) {
+       if(fseeko(dcd->file, 0, SEEK_SET) < 0) {
                printf("FAILED rewinding input, errno = %d\n", errno);
                return false;
        }
@@ -1103,7 +1112,7 @@ static FLAC__bool test_seekable_stream_decoder()
        printf("opening Ogg FLAC file... ");
        decoder_client_data.file = fopen(oggflacfilename_, "rb");
        if(0 == decoder_client_data.file) {
-               printf("ERROR\n");
+               printf("ERROR (%s)\n", strerror(errno));
                return false;
        }
        printf("OK\n");
@@ -1198,7 +1207,7 @@ static FLAC__bool test_seekable_stream_decoder()
        decoder_client_data.current_metadata_number = 0;
 
        printf("rewinding input... ");
-       if(fseek(decoder_client_data.file, 0, SEEK_SET) < 0) {
+       if(fseeko(decoder_client_data.file, 0, SEEK_SET) < 0) {
                printf("FAILED, errno = %d\n", errno);
                return false;
        }
index b9bc2d9..cd0f1db 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "encoders.h"
 #include "file_utils.h"
 #include "metadata_utils.h"
index ea7d4ab..d397b5b 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "file_utils.h"
 #include "FLAC/assert.h"
 #include "OggFLAC/stream_encoder.h"
@@ -63,7 +67,7 @@ static void encoder_metadata_callback_(const OggFLAC__StreamEncoder *encoder, co
        (void)encoder, (void)metadata, (void)client_data;
 }
 
-FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata)
+FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata)
 {
        FLAC__int32 samples[1024];
        OggFLAC__StreamEncoder *encoder;
@@ -139,7 +143,7 @@ FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, unsigne
                if(stat(output_filename, &filestats) != 0)
                        return false;
                else
-                       *output_filesize = (unsigned)filestats.st_size;
+                       *output_filesize = filestats.st_size;
        }
 
        return true;
index 69361e7..736ec92 100644 (file)
 #ifndef OggFLAC__TEST_LIBOGGFLAC_FILE_UTILS_H
 #define OggFLAC__TEST_LIBOGGFLAC_FILE_UTILS_H
 
+/* needed because of off_t */
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "FLAC/format.h"
+#include <stdlib.h> /* for off_t */
+#if defined _MSC_VER || defined __MINGW32__
+#include <sys/types.h> /* for off_t */
+#endif
 
 extern const long file_utils__serial_number;
 
-FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, unsigned *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
+FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
 
 #endif
index 5be727f..a8a6511 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "decoders.h"
 #include "encoders.h"
 
index dcfa765..c866982 100644 (file)
  * These are not tests, just utility functions used by the metadata tests
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include "metadata_utils.h"
 #include "FLAC/metadata.h"
 #include <stdio.h>
index 36dbc4f..de9df19 100644 (file)
@@ -16,8 +16,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+#  include <config.h>
 #endif
 
 #include <signal.h>
index fc4e631..1780a58 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>