From 41bba159735d61fc4614f0803c803b3b39999ecd Mon Sep 17 00:00:00 2001 From: evpobr Date: Thu, 20 Aug 2020 11:41:32 +0500 Subject: [PATCH] Fix compiler warnings Fix GCC 10.2.0 with -Wall -Wextra warnings. src/ogg.c: Fix compiler warning -Wsign-compare in ogg_stream_seek_page_search(). src/misc_test.c: Fix compiler warnings -Wunused-parameter, -Wunused-variable in filesystem_full_test(). Windows platforms only. src/ms_adpcm.c: Fix compiler warnings -Wmaybe-uninitialized in msadpcm_encode_block(). src/ogg.c: Fix compiler warning Comparison of distinct pointer types lacks a cast in ogg_read_first_page(). --- src/ms_adpcm.c | 3 ++- src/ogg.c | 4 ++-- tests/misc_test.c | 13 +++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ms_adpcm.c b/src/ms_adpcm.c index 062b8381..22b9b477 100644 --- a/src/ms_adpcm.c +++ b/src/ms_adpcm.c @@ -520,7 +520,8 @@ static int msadpcm_encode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms) { unsigned int blockindx ; unsigned char byte ; - int chan, k, predict, bpred [2], idelta [2], errordelta, newsamp ; + int chan, k, predict, bpred [2] = { 0 }, idelta [2] = { 0 }, + errordelta, newsamp ; choose_predictor (pms->channels, pms->samples, bpred, idelta) ; diff --git a/src/ogg.c b/src/ogg.c index 1cdcbb49..7a4a167f 100644 --- a/src/ogg.c +++ b/src/ogg.c @@ -168,7 +168,7 @@ ogg_read_first_page (SF_PRIVATE *psf, OGG_PRIVATE *odata) memcpy (buffer, psf->header.ptr, psf->header.indx) ; ogg_sync_wrote (&odata->osync, psf->header.indx) ; - ret = ogg_sync_next_page (psf, &odata->opage, SF_MAX (0l, 4096 - psf->header.indx), NULL) ; + ret = ogg_sync_next_page (psf, &odata->opage, SF_MAX ((sf_count_t) 0, 4096 - psf->header.indx), NULL) ; /* Have we simply run out of data? If so, we're done. */ if (ret == 0) @@ -570,7 +570,7 @@ ogg_stream_seek_page_search (SF_PRIVATE *psf, OGG_PRIVATE *odata, uint64_t targe next_boundary = SF_MIN (page_offset, next_boundary) ; /* If not from our stream, continue. */ - if (odata->ostream.serialno != (uint32_t) ogg_page_serialno (&page)) + if (odata->ostream.serialno != ogg_page_serialno (&page)) continue ; /* diff --git a/tests/misc_test.c b/tests/misc_test.c index d406cdd0..e65db583 100644 --- a/tests/misc_test.c +++ b/tests/misc_test.c @@ -260,17 +260,18 @@ zero_data_test (const char *filename, int format) static void filesystem_full_test (int format) -{ SNDFILE *file ; +{ +#if (defined (WIN32) || defined (_WIN32)) + (void) format ; + /* Can't run this test on Win32 so return. */ + return ; +#else + SNDFILE *file ; SF_INFO sfinfo ; struct stat buf ; const char *filename = "/dev/full", *errorstr ; -#if (defined (WIN32) || defined (_WIN32)) - /* Can't run this test on Win32 so return. */ - return ; -#else - /* Make sure errno is zero before doing anything else. */ errno = 0 ;