From a832ef32fb2a888674659097f40c1f8efb72c1a4 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Fri, 2 Jan 2009 01:12:59 +0000 Subject: [PATCH] fixes for windows builds (SF#1676822: https://sourceforge.net/tracker2/?func=detail&aid=1676822&group_id=13478&atid=113478) --- build/config.mk | 4 ++-- doc/html/changelog.html | 3 ++- src/flac/main.c | 8 +------- src/flac/utils.c | 5 +++++ src/libFLAC/bitreader.c | 11 +++++++---- src/libFLAC/bitwriter.c | 11 +++++++---- src/libFLAC/cpu.c | 2 +- src/libFLAC/stream_encoder.c | 2 ++ 8 files changed, 27 insertions(+), 19 deletions(-) diff --git a/build/config.mk b/build/config.mk index 5ff536bc..7fc7a847 100644 --- a/build/config.mk +++ b/build/config.mk @@ -48,9 +48,9 @@ all default: $(DEFAULT_BUILD) VERSION=\"1.2.1\" ifeq ($(OS),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 -DWORDS_BIGENDIAN +CONFIG_CFLAGS=-DHAVE_STDINT_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFLAC__SYS_DARWIN -DWORDS_BIGENDIAN else -CONFIG_CFLAGS=-DHAVE_INTTYPES_H -DHAVE_ICONV -DHAVE_LANGINFO_CODESET -DHAVE_SOCKLEN_T -DFLAC__HAS_OGG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +CONFIG_CFLAGS=-DHAVE_STDINT_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 diff --git a/doc/html/changelog.html b/doc/html/changelog.html index 91bb60c0..e472adfd 100644 --- a/doc/html/changelog.html +++ b/doc/html/changelog.html @@ -102,7 +102,8 @@
  • build system:
  • diff --git a/src/flac/main.c b/src/flac/main.c index 0be53f1e..790de585 100644 --- a/src/flac/main.c +++ b/src/flac/main.c @@ -524,12 +524,6 @@ int do_it(void) flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", option_values.filenames[i]); return 1; } - if(0 == strcmp(option_values.filenames[i], "-")) { - FLAC__ASSERT(0); - /* double protection */ - flac__utils_printf(stderr, 1, "internal error\n"); - return 2; - } if(0 != (error = grabbag__replaygain_store_to_file_album(outfilename, album_gain, album_peak, option_values.preserve_modtime))) { flac__utils_printf(stderr, 1, "%s: ERROR writing ReplayGain album tags (%s)\n", outfilename, error); retval = 1; @@ -1834,7 +1828,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ } } - if(/*@@@@@@why no stdin?*/encode_infile == stdin || option_values.force_to_stdout) { + if(option_values.force_to_stdout) { if(option_values.replay_gain) { conditional_fclose(encode_infile); return usage_error("ERROR: --replay-gain cannot be used when encoding to stdout\n"); diff --git a/src/flac/utils.c b/src/flac/utils.c index 28b1ebb6..625716dc 100644 --- a/src/flac/utils.c +++ b/src/flac/utils.c @@ -152,6 +152,11 @@ void flac__utils_printf(FILE *stream, int level, const char *format, ...) (void) vfprintf(stream, format, args); va_end(args); + +#ifdef _MSC_VER + if(stream == stderr) + fflush(stream); /* for some reason stderr is buffered in at least some if not all MSC libs */ +#endif } } diff --git a/src/libFLAC/bitreader.c b/src/libFLAC/bitreader.c index 2b98f359..2c53aab7 100644 --- a/src/libFLAC/bitreader.c +++ b/src/libFLAC/bitreader.c @@ -36,13 +36,16 @@ #include /* for malloc() */ #include /* for memcpy(), memset() */ #ifdef _MSC_VER -#include /* for ntohl() */ +# include /* for ntohl() */ +# if _MSC_VER >= 1310 +# include /* for ntohl(), sometimes it is not in winsock.h */ +# endif #elif defined FLAC__SYS_DARWIN -#include /* for ntohl() */ +# include /* for ntohl() */ #elif defined __MINGW32__ -#include /* for ntohl() */ +# include /* for ntohl() */ #else -#include /* for ntohl() */ +# include /* for ntohl() */ #endif #include "private/bitmath.h" #include "private/bitreader.h" diff --git a/src/libFLAC/bitwriter.c b/src/libFLAC/bitwriter.c index 04cd5d9f..6e54833d 100644 --- a/src/libFLAC/bitwriter.c +++ b/src/libFLAC/bitwriter.c @@ -36,13 +36,16 @@ #include /* for malloc() */ #include /* for memcpy(), memset() */ #ifdef _MSC_VER -#include /* for ntohl() */ +# include /* for ntohl() */ +# if _MSC_VER >= 1310 +# include /* for ntohl(), sometimes it is not in winsock.h */ +# endif #elif defined FLAC__SYS_DARWIN -#include /* for ntohl() */ +# include /* for ntohl() */ #elif defined __MINGW32__ -#include /* for ntohl() */ +# include /* for ntohl() */ #else -#include /* for ntohl() */ +# include /* for ntohl() */ #endif #if 0 /* UNUSED */ #include "private/bitmath.h" diff --git a/src/libFLAC/cpu.c b/src/libFLAC/cpu.c index 0f1cc8cc..8a65425e 100644 --- a/src/libFLAC/cpu.c +++ b/src/libFLAC/cpu.c @@ -136,7 +136,7 @@ static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000; # endif # elif defined(_MSC_VER) # include -# undef USE_TRY_CATCH_FLAVOR /* #define this to use the try/catch method for catching illegal opcode exception */ +# define USE_TRY_CATCH_FLAVOR /* sigill_handler flavor resulted in several crash reports on win32 */ # ifdef USE_TRY_CATCH_FLAVOR # else LONG CALLBACK sigill_handler_sse_os(EXCEPTION_POINTERS *ep) diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c index 6f5ce10e..3928833f 100644 --- a/src/libFLAC/stream_encoder.c +++ b/src/libFLAC/stream_encoder.c @@ -2155,6 +2155,8 @@ void set_defaults_(FLAC__StreamEncoder *encoder) #if FLAC__HAS_OGG FLAC__ogg_encoder_aspect_set_defaults(&encoder->protected_->ogg_encoder_aspect); #endif + + FLAC__stream_encoder_set_compression_level(encoder, 5); } void free_(FLAC__StreamEncoder *encoder)