From 8ed15267a5300c9bae30a5500e4d3a77429bb36b Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 25 Mar 2024 10:50:11 -0400 Subject: [PATCH] Fix signed/unsigned warnings with explicit casts. --- cwLex.cpp | 2 +- cwScoreFollower.cpp | 2 +- cwSvgScoreFollow.cpp | 2 +- cwTime.cpp | 6 +++--- cwVelTableTuner.cpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cwLex.cpp b/cwLex.cpp index 1245e00..5eca99b 100644 --- a/cwLex.cpp +++ b/cwLex.cpp @@ -723,7 +723,7 @@ unsigned cw::lex::getNextToken( handle_t h ) } // update the lexer state - p->curTokenId = maxIdx==kInvalidIdx ? kUnknownLexTId : p->mfp[ maxIdx ].typeId; + p->curTokenId = maxIdx==kInvalidIdx ? (unsigned)kUnknownLexTId : p->mfp[ maxIdx ].typeId; p->curTokenCharIdx = p->ci; p->curTokenCharCnt = maxCharCnt; diff --git a/cwScoreFollower.cpp b/cwScoreFollower.cpp index 2f27677..7412a8e 100644 --- a/cwScoreFollower.cpp +++ b/cwScoreFollower.cpp @@ -670,7 +670,7 @@ cw::rc_t cw::score_follower::write_sync_perf_csv( handle_t h, const char* out_fn sectionLabel = e->section != nullptr ? e->section->label : ""; curBarNumb = std::max(bar,curBarNumb); dlevel = e->dynLevel; - loc = resultA[i].oLocId == kInvalidId ? score_parse::kInvalidLocId : resultA[i].oLocId; + loc = resultA[i].oLocId == kInvalidId ? (unsigned)score_parse::kInvalidLocId : resultA[i].oLocId; break; } } diff --git a/cwSvgScoreFollow.cpp b/cwSvgScoreFollow.cpp index cbfd257..880ea7d 100644 --- a/cwSvgScoreFollow.cpp +++ b/cwSvgScoreFollow.cpp @@ -218,7 +218,7 @@ namespace cw // write the ref-note for(ssf_ref_note_t* rn=r->refNoteL; rn!=nullptr; rn = rn->link) { - unsigned pitch = rn->evt == nullptr ? midi::kInvalidMidiPitch : rn->evt->pitch; + unsigned pitch = rn->evt == nullptr ? (unsigned)midi::kInvalidMidiPitch : rn->evt->pitch; unsigned cnt = rn->cnt > 1 ? rn->cnt : kInvalidCnt; bool noMatchFl = rn->cnt == 0; if((rc = _write_rect_pitch( p, r->left-offset_x, rn->top, "ref_note", pitch, noMatchFl, cnt, rn->cwLocId )) != kOkRC ) diff --git a/cwTime.cpp b/cwTime.cpp index 5ffb647..ef7f211 100644 --- a/cwTime.cpp +++ b/cwTime.cpp @@ -57,14 +57,14 @@ cw::time::spec_t cw::time::current_time() #endif unsigned long long cw::time::elapsedMicros( const spec_t& t0, const spec_t& t1 ) -{ +{ const unsigned long long ns_per_sec = 1000000000; const unsigned long long us_per_sec = 1000000; const unsigned long long ns_per_us = 1000; // we assume that the time is normalized - assert( t0.tv_nsec < (const long long)ns_per_sec ); - assert( t1.tv_nsec < (const long long)ns_per_sec ); + assert( t0.tv_nsec < (long long)ns_per_sec ); + assert( t1.tv_nsec < (long long)ns_per_sec ); if( t0.tv_sec > t1.tv_sec ) { diff --git a/cwVelTableTuner.cpp b/cwVelTableTuner.cpp index 05f3f24..6df6938 100644 --- a/cwVelTableTuner.cpp +++ b/cwVelTableTuner.cpp @@ -705,7 +705,7 @@ namespace cw cw::rc_t _set_pitch( vtbl_t* p, unsigned vseqPitch ) { rc_t rc = kOkRC; - if( 0<= vseqPitch && vseqPitch < 128) + if( vseqPitch < 128) p->vseqPitch = vseqPitch; else { @@ -716,7 +716,7 @@ namespace cw cw::rc_t _validate_midi_value( vtbl_t* p, unsigned midiValue ) { - if( 0 <= midiValue && midiValue < 128 ) + if( midiValue < 128 ) return kOkRC; return _set_status(p,kInvalidArgRC,"%i is an invalid 8 bit MIDI value.",midiValue);