Fix signed/unsigned warnings with explicit casts.

This commit is contained in:
kevin 2024-03-25 10:50:11 -04:00
parent 36826a3b66
commit 8ed15267a5
5 changed files with 8 additions and 8 deletions

View File

@ -723,7 +723,7 @@ unsigned cw::lex::getNextToken( handle_t h )
} }
// update the lexer state // 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->curTokenCharIdx = p->ci;
p->curTokenCharCnt = maxCharCnt; p->curTokenCharCnt = maxCharCnt;

View File

@ -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 : ""; sectionLabel = e->section != nullptr ? e->section->label : "";
curBarNumb = std::max(bar,curBarNumb); curBarNumb = std::max(bar,curBarNumb);
dlevel = e->dynLevel; 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; break;
} }
} }

View File

@ -218,7 +218,7 @@ namespace cw
// write the ref-note // write the ref-note
for(ssf_ref_note_t* rn=r->refNoteL; rn!=nullptr; rn = rn->link) 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; unsigned cnt = rn->cnt > 1 ? rn->cnt : kInvalidCnt;
bool noMatchFl = rn->cnt == 0; 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 ) if((rc = _write_rect_pitch( p, r->left-offset_x, rn->top, "ref_note", pitch, noMatchFl, cnt, rn->cwLocId )) != kOkRC )

View File

@ -63,8 +63,8 @@ unsigned long long cw::time::elapsedMicros( const spec_t& t0, const spec_t& t1 )
const unsigned long long ns_per_us = 1000; const unsigned long long ns_per_us = 1000;
// we assume that the time is normalized // we assume that the time is normalized
assert( t0.tv_nsec < (const long long)ns_per_sec ); assert( t0.tv_nsec < (long long)ns_per_sec );
assert( t1.tv_nsec < (const long long)ns_per_sec ); assert( t1.tv_nsec < (long long)ns_per_sec );
if( t0.tv_sec > t1.tv_sec ) if( t0.tv_sec > t1.tv_sec )
{ {

View File

@ -705,7 +705,7 @@ namespace cw
cw::rc_t _set_pitch( vtbl_t* p, unsigned vseqPitch ) cw::rc_t _set_pitch( vtbl_t* p, unsigned vseqPitch )
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
if( 0<= vseqPitch && vseqPitch < 128) if( vseqPitch < 128)
p->vseqPitch = vseqPitch; p->vseqPitch = vseqPitch;
else else
{ {
@ -716,7 +716,7 @@ namespace cw
cw::rc_t _validate_midi_value( vtbl_t* p, unsigned midiValue ) cw::rc_t _validate_midi_value( vtbl_t* p, unsigned midiValue )
{ {
if( 0 <= midiValue && midiValue < 128 ) if( midiValue < 128 )
return kOkRC; return kOkRC;
return _set_status(p,kInvalidArgRC,"%i is an invalid 8 bit MIDI value.",midiValue); return _set_status(p,kInvalidArgRC,"%i is an invalid 8 bit MIDI value.",midiValue);