Commit 94406c3c authored by David Reid's avatar David Reid

Update dr_flac and dr_wav.

parent 8a680049
This diff is collapsed.
/* /*
WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file. WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_wav - v0.9.1 - 2019-05-05 dr_wav - v0.9.2 - 2019-05-21
David Reid - mackron@gmail.com David Reid - mackron@gmail.com
*/ */
...@@ -2040,7 +2040,7 @@ drwav_bool32 drwav_init_ex(drwav* pWav, drwav_read_proc onRead, drwav_seek_proc ...@@ -2040,7 +2040,7 @@ drwav_bool32 drwav_init_ex(drwav* pWav, drwav_read_proc onRead, drwav_seek_proc
drwav_uint32 drwav_riff_chunk_size_riff(drwav_uint64 dataChunkSize) drwav_uint32 drwav_riff_chunk_size_riff(drwav_uint64 dataChunkSize)
{ {
if (dataChunkSize <= (0xFFFFFFFF - 36)) { if (dataChunkSize <= (0xFFFFFFFFUL - 36)) {
return 36 + (drwav_uint32)dataChunkSize; return 36 + (drwav_uint32)dataChunkSize;
} else { } else {
return 0xFFFFFFFF; return 0xFFFFFFFF;
...@@ -2049,10 +2049,10 @@ drwav_uint32 drwav_riff_chunk_size_riff(drwav_uint64 dataChunkSize) ...@@ -2049,10 +2049,10 @@ drwav_uint32 drwav_riff_chunk_size_riff(drwav_uint64 dataChunkSize)
drwav_uint32 drwav_data_chunk_size_riff(drwav_uint64 dataChunkSize) drwav_uint32 drwav_data_chunk_size_riff(drwav_uint64 dataChunkSize)
{ {
if (dataChunkSize <= 0xFFFFFFFF) { if (dataChunkSize <= 0xFFFFFFFFUL) {
return (drwav_uint32)dataChunkSize; return (drwav_uint32)dataChunkSize;
} else { } else {
return 0xFFFFFFFF; return 0xFFFFFFFFUL;
} }
} }
...@@ -2121,7 +2121,7 @@ drwav_bool32 drwav_init_write__internal(drwav* pWav, const drwav_data_format* pF ...@@ -2121,7 +2121,7 @@ drwav_bool32 drwav_init_write__internal(drwav* pWav, const drwav_data_format* pF
so for the sake of simplicity I'm not doing any validation for that. so for the sake of simplicity I'm not doing any validation for that.
*/ */
if (pFormat->container == drwav_container_riff) { if (pFormat->container == drwav_container_riff) {
if (initialDataChunkSize > (0xFFFFFFFF - 36)) { if (initialDataChunkSize > (0xFFFFFFFFUL - 36)) {
return DRWAV_FALSE; /* Not enough room to store every sample. */ return DRWAV_FALSE; /* Not enough room to store every sample. */
} }
} }
...@@ -3195,8 +3195,8 @@ void drwav_u8_to_s16(drwav_int16* pOut, const drwav_uint8* pIn, size_t sampleCou ...@@ -3195,8 +3195,8 @@ void drwav_u8_to_s16(drwav_int16* pOut, const drwav_uint8* pIn, size_t sampleCou
size_t i; size_t i;
for (i = 0; i < sampleCount; ++i) { for (i = 0; i < sampleCount; ++i) {
int x = pIn[i]; int x = pIn[i];
r = x - 128; r = x << 8;
r = r << 8; r = r - 32768;
pOut[i] = (short)r; pOut[i] = (short)r;
} }
} }
...@@ -4675,6 +4675,9 @@ void drwav_free(void* pDataReturnedByOpenAndRead) ...@@ -4675,6 +4675,9 @@ void drwav_free(void* pDataReturnedByOpenAndRead)
/* /*
REVISION HISTORY REVISION HISTORY
================ ================
v0.9.2 - 2019-05-21
- Fix warnings.
v0.9.1 - 2019-05-05 v0.9.1 - 2019-05-05
- Add support for C89. - Add support for C89.
- Change license to choice of public domain or MIT-0. - Change license to choice of public domain or MIT-0.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment