fixes for windows builds (SF#1676822: https://sourceforge.net/tracker2/?func=detail...
authorJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 2 Jan 2009 01:12:59 +0000 (01:12 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 2 Jan 2009 01:12:59 +0000 (01:12 +0000)
build/config.mk
doc/html/changelog.html
src/flac/main.c
src/flac/utils.c
src/libFLAC/bitreader.c
src/libFLAC/bitwriter.c
src/libFLAC/cpu.c
src/libFLAC/stream_encoder.c

index 5ff536b..7fc7a84 100644 (file)
@@ -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
index 91bb60c..e472adf 100644 (file)
                        <li>
                                build system:
                                <ul>
-                                       <li>Fix #includes for gcc 4.3 (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1834168&group_id=13478&atid=313478">SF #1834168</a>).</li>
+                                       <li>Fix #includes for gcc 4.3 (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1834168&group_id=13478&atid=113478">SF #1834168</a>).</li>
+                                       <li>Fixes for windows builds (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1676822&group_id=13478&atid=113478">SF #1676822</a>).</li>
                                </ul>
                        </li>
                        <li>
index 0be53f1..790de58 100644 (file)
@@ -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");
index 28b1ebb..625716d 100644 (file)
@@ -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
        }
 }
 
index 2b98f35..2c53aab 100644 (file)
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for memcpy(), memset() */
 #ifdef _MSC_VER
-#include <winsock.h> /* for ntohl() */
+# include <winsock.h> /* for ntohl() */
+# if _MSC_VER >= 1310
+#  include <winsock2.h> /* for ntohl(), sometimes it is not in winsock.h */
+# endif
 #elif defined FLAC__SYS_DARWIN
-#include <machine/endian.h> /* for ntohl() */
+# include <machine/endian.h> /* for ntohl() */
 #elif defined __MINGW32__
-#include <winsock.h> /* for ntohl() */
+# include <winsock.h> /* for ntohl() */
 #else
-#include <netinet/in.h> /* for ntohl() */
+# include <netinet/in.h> /* for ntohl() */
 #endif
 #include "private/bitmath.h"
 #include "private/bitreader.h"
index 04cd5d9..6e54833 100644 (file)
 #include <stdlib.h> /* for malloc() */
 #include <string.h> /* for memcpy(), memset() */
 #ifdef _MSC_VER
-#include <winsock.h> /* for ntohl() */
+# include <winsock.h> /* for ntohl() */
+# if _MSC_VER >= 1310
+#  include <winsock2.h> /* for ntohl(), sometimes it is not in winsock.h */
+# endif
 #elif defined FLAC__SYS_DARWIN
-#include <machine/endian.h> /* for ntohl() */
+# include <machine/endian.h> /* for ntohl() */
 #elif defined __MINGW32__
-#include <winsock.h> /* for ntohl() */
+# include <winsock.h> /* for ntohl() */
 #else
-#include <netinet/in.h> /* for ntohl() */
+# include <netinet/in.h> /* for ntohl() */
 #endif
 #if 0 /* UNUSED */
 #include "private/bitmath.h"
index 0f1cc8c..8a65425 100644 (file)
@@ -136,7 +136,7 @@ static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000;
 #  endif
 # elif defined(_MSC_VER)
 #  include <windows.h>
-#  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)
index 6f5ce10..3928833 100644 (file)
@@ -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)