diff --git a/mkvmuxer.cpp b/mkvmuxer.cpp index 81246fb..cd3aecd 100644 --- a/mkvmuxer.cpp +++ b/mkvmuxer.cpp @@ -1831,6 +1831,9 @@ Segment::Segment() writer_header_(NULL) { const time_t curr_time = time(NULL); seed_ = static_cast(curr_time); +#ifdef _WIN32 + srand(seed_); +#endif } Segment::~Segment() { diff --git a/mkvmuxerutil.cpp b/mkvmuxerutil.cpp index a71a7ca..11cd346 100644 --- a/mkvmuxerutil.cpp +++ b/mkvmuxerutil.cpp @@ -10,6 +10,9 @@ #include #include +#ifdef _WIN32 +#define _CRT_RAND_S +#endif #include #include #include @@ -81,12 +84,12 @@ uint64 EbmlElementSize(uint64 type, uint64 value) { return ebml_size; } -uint64 EbmlElementSize(uint64 type, float value) { +uint64 EbmlElementSize(uint64 type, float /* value */ ) { // Size of EBML ID uint64 ebml_size = GetUIntSize(type); // Datasize - ebml_size += sizeof(value); + ebml_size += sizeof(float); // Size of Datasize ebml_size++; @@ -508,7 +511,15 @@ mkvmuxer::uint64 mkvmuxer::MakeUID(unsigned int* seed) { for (int i = 0; i < 7; ++i) { // avoid problems with 8-byte values uid <<= 8; +#ifdef _WIN32 + (void)seed; + unsigned int random_value; + const errno_t e = rand_s(&random_value); + (void)e; + const int32 nn = random_value; +#elif const int32 nn = rand_r(seed); +#endif const int32 n = 0xFF & (nn >> 4); // throw away low-order bits uid |= n; diff --git a/sample_muxer_2010.vcxproj b/sample_muxer_2010.vcxproj index 9f36982..2d51134 100644 --- a/sample_muxer_2010.vcxproj +++ b/sample_muxer_2010.vcxproj @@ -164,6 +164,9 @@ + + + @@ -171,6 +174,11 @@ false + + + + + diff --git a/sample_muxer_2010.vcxproj.filters b/sample_muxer_2010.vcxproj.filters index d0067c4..4363ab8 100644 --- a/sample_muxer_2010.vcxproj.filters +++ b/sample_muxer_2010.vcxproj.filters @@ -2,5 +2,13 @@ + + + + + + + + \ No newline at end of file