Merge "Fix mingw build."

This commit is contained in:
Tom Finegan 2014-01-24 11:13:56 -08:00 committed by Gerrit Code Review
commit 4600f5b4a2
3 changed files with 18 additions and 8 deletions

View File

@ -14,7 +14,7 @@
#include <cmath>
#include <cstdio>
#ifdef _WIN32
#ifdef _MSC_VER
#define _CRT_RAND_S
#endif
#include <cstdlib>
@ -669,11 +669,16 @@ void GetVersion(int32* major, int32* minor, int32* build, int32* revision) {
mkvmuxer::uint64 mkvmuxer::MakeUID(unsigned int* seed) {
uint64 uid = 0;
#ifdef __MINGW32__
srand(*seed);
#endif
for (int i = 0; i < 7; ++i) { // avoid problems with 8-byte values
uid <<= 8;
// TODO(fgalligan): Move random number generation to platform specific code.
#ifdef _WIN32
#ifdef _MSC_VER
(void)seed;
unsigned int random_value;
const errno_t e = rand_s(&random_value);
@ -687,6 +692,8 @@ mkvmuxer::uint64 mkvmuxer::MakeUID(unsigned int* seed) {
close(fd);
}
const int32 nn = temp_num;
#elif defined __MINGW32__
const int32 nn = rand();
#else
const int32 nn = rand_r(seed);
#endif

View File

@ -5512,14 +5512,17 @@ long Track::Create(
}
Track::Info::Info():
uid(0),
defaultDuration(0),
codecDelay(0),
seekPreRoll(0),
nameAsUTF8(NULL),
language(NULL),
codecId(NULL),
codecNameAsUTF8(NULL),
codecPrivate(NULL),
codecPrivateSize(0),
codecDelay(0),
seekPreRoll(0)
lacing(false)
{
}

View File

@ -31,7 +31,7 @@ int MkvReader::Open(const char* fileName)
if (m_file)
return -1;
#ifdef WIN32
#ifdef _MSC_VER
const errno_t e = fopen_s(&m_file, fileName, "rb");
if (e)
@ -43,7 +43,7 @@ int MkvReader::Open(const char* fileName)
return -1;
#endif
#ifdef WIN32
#ifdef _MSC_VER
int status = _fseeki64(m_file, 0L, SEEK_END);
if (status)
@ -56,7 +56,7 @@ int MkvReader::Open(const char* fileName)
#endif
assert(m_length >= 0);
#ifdef WIN32
#ifdef _MSC_VER
status = _fseeki64(m_file, 0L, SEEK_SET);
if (status)
@ -108,7 +108,7 @@ int MkvReader::Read(long long offset, long len, unsigned char* buffer)
if (offset >= m_length)
return -1;
#ifdef WIN32
#ifdef _MSC_VER
const int status = _fseeki64(m_file, offset, SEEK_SET);
if (status)