Large patch from Ben Allison fixing the MSVC build.

Patch tweaked a little to fix Linux build and clean up minor problems.
This commit is contained in:
Erik de Castro Lopo
2013-03-06 22:17:46 +11:00
parent 91790ef965
commit a4c321e492
10 changed files with 59 additions and 10 deletions

View File

@@ -25,10 +25,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "FLAC/all.h"
#include "analyze.h"
#include "share/compat.h"
typedef struct {
FLAC__int32 residual;
unsigned count;

View File

@@ -36,6 +36,7 @@
/* for CHAR_BIT */
#include <limits.h>
#include "share/compat.h"
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#include <intrin.h> /* for _BitScanReverse* */

View File

@@ -34,9 +34,10 @@
#endif
#include <math.h>
#include <inttypes.h>
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "share/compat.h"
#include "private/bitmath.h"
#include "private/lpc.h"
#include "private/macros.h"

View File

@@ -55,7 +55,11 @@
/* technically this should be in an "export.c" but this is convenient enough */
#ifdef FLAC_API_SUPPORTS_OGG_FLAC
FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC = FLAC__HAS_OGG ;
#else
FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC = 0 ;
#endif
/***********************************************************************

View File

@@ -24,8 +24,14 @@
#include <stdlib.h> /* for malloc() */
#include <string.h> /* for memcpy()/memset() */
#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
#ifdef _MSC_VER
#include <sys/utime.h>
#else
#include <utime.h> /* for utime() */
#endif
#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
#include <unistd.h> /* for chown(), unlink() */
#endif
#include <sys/stat.h> /* for stat(), maybe chmod() */
#include "FLAC/assert.h"
#include "FLAC++/decoder.h"

View File

@@ -902,8 +902,11 @@ static FLAC__bool generate_noisy_sine(void)
sample += sin (2.0 * k * M_PI * 1.0 / 32.0);
sample *= 0.4;
#if !defined _MSC_VER
write_little_endian_int16(f, lrintf(sample * 32700.0));
#else
write_little_endian_int16(f, (FLAC__int16)(sample * 32700.0));
#endif
};
fclose(f);