Skip to content

Commit

Permalink
silenced an annoying watcom warning
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Mar 18, 2021
1 parent 1409874 commit df89201
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
19 changes: 2 additions & 17 deletions src/dr_flac.h
Expand Up @@ -3305,7 +3305,6 @@ static drflac_bool32 drflac__seek_subframe(drflac_bs* bs, drflac_frame* frame, i
}
lpcPrecision += 1;


bitsToSeek = (pSubframe->lpcOrder * lpcPrecision) + 5; // +5 for shift.
if (!drflac__seek_bits(bs, bitsToSeek)) {
return DRFLAC_FALSE;
Expand Down Expand Up @@ -3799,7 +3798,6 @@ drflac_bool32 drflac__read_and_decode_metadata(drflac_read_proc onRead, drflac_s
}
runningFilePos += 4;


drflac_metadata metadata;
metadata.type = blockType;
metadata.pRawData = NULL;
Expand Down Expand Up @@ -4350,7 +4348,6 @@ drflac_result drflac_ogg__read_page_header_after_capture_pattern(drflac_read_pro
*pCRC32 = drflac_crc32_byte(*pCRC32, data[i]);
}


if (onRead(pUserData, pHeader->segmentTable, pHeader->segmentCount) != pHeader->segmentCount) {
return DRFLAC_END_OF_STREAM;
}
Expand Down Expand Up @@ -4706,7 +4703,6 @@ drflac_bool32 drflac_ogg__seek_to_sample(drflac* pFlac, drflac_uint64 sampleInde
break; // The sample is somewhere in the previous page.
}


// At this point we know the sample is not in the previous page. It could possibly be in this page. For simplicity we
// disregard any pages that do not begin a fresh packet.
if ((oggbs->currentPageHeader.headerType & 0x01) == 0) { // <-- Is it a fresh page?
Expand All @@ -4724,7 +4720,6 @@ drflac_bool32 drflac_ogg__seek_to_sample(drflac* pFlac, drflac_uint64 sampleInde
}
}


// We found the page that that is closest to the sample, so now we need to find it. The first thing to do is seek to the
// start of that page. In the loop above we checked that it was a fresh page which means this page is also the start of
// a new frame. This property means that after we've seeked to the page we can immediately start looping over frames until
Expand All @@ -4736,7 +4731,6 @@ drflac_bool32 drflac_ogg__seek_to_sample(drflac* pFlac, drflac_uint64 sampleInde
return DRFLAC_FALSE;
}


// At this point we'll be sitting on the first byte of the frame header of the first frame in the page. We just keep
// looping over these frames until we find the one containing the sample we're after.
drflac_uint64 runningSampleCount = runningGranulePosition;
Expand Down Expand Up @@ -4940,15 +4934,13 @@ drflac_bool32 drflac__init_private__ogg(drflac_init_info* pInit, drflac_read_pro

pInit->runningFilePos += pageBodySize;


// Read the header of the next page.
if (drflac_ogg__read_page_header(onRead, pUserData, &header, &bytesRead, &crc32) != DRFLAC_SUCCESS) {
return DRFLAC_FALSE;
}
pInit->runningFilePos += bytesRead;
}


// If we get here it means we found a FLAC audio stream. We should be sitting on the first byte of the header of the next page. The next
// packets in the FLAC logical stream contain the metadata. The only thing left to do in the initialization phase for Ogg is to create the
// Ogg bistream object.
Expand Down Expand Up @@ -5201,8 +5193,6 @@ drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac_seek_p
}
}



// If we get here, but don't have a STREAMINFO block, it means we've opened the stream in relaxed mode and need to decode
// the first frame.
if (!init.hasStreamInfoBlock) {
Expand Down Expand Up @@ -5231,7 +5221,6 @@ drflac* drflac_open_with_metadata_private(drflac_read_proc onRead, drflac_seek_p
}



#ifndef DR_FLAC_NO_STDIO
#include <stdio.h>

Expand Down Expand Up @@ -5643,7 +5632,7 @@ drflac_uint64 drflac_read_s32(drflac* pFlac, drflac_uint64 samplesToRead, drflac
for (drflac_uint64 i = 0; i < alignedSampleCountPerChannel; ++i) {
int mid = pDecodedSamples0[i] << pFlac->currentFrame.subframes[0].wastedBitsPerSample;
int side = pDecodedSamples1[i] << pFlac->currentFrame.subframes[1].wastedBitsPerSample;

mid = (((drflac_uint32)mid) << 1) | (side & 0x01);

bufferOut[i*2+0] = ((mid + side) >> 1) << (unusedBitsPerSample);
Expand Down Expand Up @@ -5824,7 +5813,6 @@ drflac_bool32 drflac_seek_to_sample(drflac* pFlac, drflac_uint64 sampleIndex)
}



//// High Level APIs ////

#if defined(SIZE_MAX)
Expand Down Expand Up @@ -5878,7 +5866,7 @@ static type* drflac__full_decode_and_close_ ## extension (drflac* pFlac, unsigne
drflac_zero_memory(pSampleData + totalSampleCount, (size_t)(sampleDataBufferSize - totalSampleCount*sizeof(type))); \
} else { \
drflac_uint64 dataSize = totalSampleCount * sizeof(type); \
if (dataSize > DRFLAC_SIZE_MAX) { \
if (dataSize > (drflac_uint64)DRFLAC_SIZE_MAX) { \
goto on_error; /* The decoded data is too big. */ \
} \
\
Expand Down Expand Up @@ -6044,7 +6032,6 @@ void drflac_free(void* pSampleDataReturnedByOpenAndDecode)




void drflac_init_vorbis_comment_iterator(drflac_vorbis_comment_iterator* pIter, drflac_uint32 commentCount, const void* pComments)
{
if (pIter == NULL) {
Expand Down Expand Up @@ -6076,8 +6063,6 @@ const char* drflac_next_vorbis_comment(drflac_vorbis_comment_iterator* pIter, dr
}




void drflac_init_cuesheet_track_iterator(drflac_cuesheet_track_iterator* pIter, drflac_uint32 trackCount, const void* pTrackData)
{
if (pIter == NULL) {
Expand Down
14 changes: 4 additions & 10 deletions src/dr_mp3.h
Expand Up @@ -129,7 +129,6 @@ void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, int num_samples);




// Main API (Pull API)
// ===================

Expand Down Expand Up @@ -2087,7 +2086,6 @@ void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, int num_samples)
}



///////////////////////////////////////////////////////////////////////////////
//
// Main Public API
Expand All @@ -2112,7 +2110,6 @@ void drmp3dec_f32_to_s16(const float *in, drmp3_int16 *out, int num_samples)
#define DR_MP3_DEFAULT_SAMPLE_RATE 44100
#endif


// Standard library stuff.
#ifndef DRMP3_ASSERT
#include <assert.h>
Expand Down Expand Up @@ -2198,7 +2195,6 @@ drmp3_uint64 drmp3_src_cache_read_frames(drmp3_src_cache* pCache, drmp3_uint64 f
break;
}


// At this point there are still more frames to read from the client, so we'll need to reload the cache with fresh data.
drmp3_assert(frameCount > 0);
pFramesOut += framesToReadFromMemory * channels;
Expand All @@ -2213,7 +2209,6 @@ drmp3_uint64 drmp3_src_cache_read_frames(drmp3_src_cache* pCache, drmp3_uint64 f

pCache->cachedFrameCount = (drmp3_uint32)pCache->pSRC->onRead(pCache->pSRC, framesToReadFromClient, pCache->pCachedFrames, pCache->pSRC->pUserData);


// Get out of this loop if nothing was able to be retrieved.
if (pCache->cachedFrameCount == 0) {
break;
Expand Down Expand Up @@ -2385,7 +2380,6 @@ drmp3_uint64 drmp3_src_read_frames_linear(drmp3_src* pSRC, drmp3_uint64 frameCou
}



static drmp3_bool32 drmp3_decode_next_frame(drmp3* pMP3)
{
drmp3_assert(pMP3 != NULL);
Expand Down Expand Up @@ -2432,7 +2426,7 @@ static drmp3_bool32 drmp3_decode_next_frame(drmp3* pMP3)
for (size_t i = 0; i < leftoverDataSize; ++i) {
pMP3->pData[i] = pMP3->pData[i + (size_t)info.frame_bytes];
}

pMP3->dataSize = leftoverDataSize;
pMP3->framesConsumed = 0;
pMP3->framesRemaining = samplesRead;
Expand Down Expand Up @@ -2597,7 +2591,7 @@ drmp3_bool32 drmp3_init_internal(drmp3* pMP3, drmp3_read_proc onRead, drmp3_seek
drmp3_uninit(pMP3);
return DRMP3_FALSE;
}

// Decode the first frame to confirm that it is indeed a valid MP3 stream.
if (!drmp3_decode_next_frame(pMP3)) {
drmp3_uninit(pMP3);
Expand Down Expand Up @@ -2720,7 +2714,7 @@ drmp3_bool32 drmp3_init_file(drmp3* pMP3, const char* filePath, const drmp3_conf
void drmp3_uninit(drmp3* pMP3)
{
if (pMP3 == NULL) return;

#ifndef DR_MP3_NO_STDIO
if (pMP3->onRead == drmp3__on_read_stdio) {
fclose((FILE*)pMP3->pUserData);
Expand Down Expand Up @@ -2811,7 +2805,7 @@ float* drmp3__full_decode_and_close_f32(drmp3* pMP3, drmp3_config* pConfig, drmp
}

drmp3_uint64 newFramesBufferSize = framesCapacity*pMP3->channels*sizeof(float);
if (newFramesBufferSize > DRMP3_SIZE_MAX) {
if (newFramesBufferSize > (drmp3_uint64)DRMP3_SIZE_MAX) {
break;
}

Expand Down

0 comments on commit df89201

Please sign in to comment.