return die_f_("FLAC__file_decoder_process_until_end_of_metadata() FAILED", decoder);
printf("file's total_samples is %llu\n", decoder_client_data.total_samples);
+#if !defined _MSC_VER && !defined __MINGW32__
if (decoder_client_data.total_samples > (FLAC__uint64)RAND_MAX) {
printf("ERROR: must be total_samples < %u\n", (unsigned)RAND_MAX);
return false;
}
+#endif
n = (long int)decoder_client_data.total_samples;
/* if we don't have a total samples count, just guess based on the file size */
if(n == 0) {
/* 8 would imply no compression, 9 guarantees that we will get some samples off the end of the stream to test that case */
n = 9 * filesize / (decoder_client_data.channels * decoder_client_data.bits_per_sample);
+#if !defined _MSC_VER && !defined __MINGW32__
if(n > RAND_MAX)
n = RAND_MAX;
+#endif
}
printf("Begin seek barrage, count=%u\n", count);
}
else {
#if !defined _MSC_VER && !defined __MINGW32__
- pos = (FLAC__uint64)(random() % n);
-#else
pos = (FLAC__uint64)(rand() % n);
+#else
+ /* RAND_MAX is only 32767 in my MSVC */
+ pos = (FLAC__uint64)((random()<<15|random()) % n);
#endif
}
return die_of_("OggFLAC__file_decoder_process_until_end_of_metadata() FAILED", decoder);
printf("file's total_samples is %llu\n", decoder_client_data.total_samples);
+#if !defined _MSC_VER && !defined __MINGW32__
if (decoder_client_data.total_samples > (FLAC__uint64)RAND_MAX) {
printf("ERROR: must be total_samples < %u\n", (unsigned)RAND_MAX);
return false;
}
+#endif
n = (long int)decoder_client_data.total_samples;
/* if we don't have a total samples count, just guess based on the file size */
if(n == 0) {
/* 8 would imply no compression, 9 guarantees that we will get some samples off the end of the stream to test that case */
n = 9 * filesize / (decoder_client_data.channels * decoder_client_data.bits_per_sample);
+#if !defined _MSC_VER && !defined __MINGW32__
if(n > RAND_MAX)
n = RAND_MAX;
+#endif
}
printf("Begin seek barrage, count=%u\n", count);
}
else {
#if !defined _MSC_VER && !defined __MINGW32__
- pos = (FLAC__uint64)(random() % n);
-#else
pos = (FLAC__uint64)(rand() % n);
+#else
+ /* RAND_MAX is only 32767 in my MSVC */
+ pos = (FLAC__uint64)((random()<<15|random()) % n);
#endif
}