diff --git a/cwAudioDeviceFile.cpp b/cwAudioDeviceFile.cpp index 001496b..c64f7d4 100644 --- a/cwAudioDeviceFile.cpp +++ b/cwAudioDeviceFile.cpp @@ -1102,14 +1102,14 @@ cw::rc_t cw::audio::device::file::test( const object_t* cfg) rc_t rc2 = kOkRC; const char* ifname = nullptr; const char* ofname = nullptr; - struct driver_str driver = {0}; + struct driver_str driver = {}; struct driver_str* driver_ptr = &driver; unsigned bitsPerSample = 0; // zero indicates floating point sample format for output audio file unsigned sleepMicrosec = 0; const char* devLabel = "dev_file"; unsigned devIdx = 0; unsigned framesPerCycle = 0; - cb_object_t obj = { 0 }; + cb_object_t obj = {}; void* cbArg = &obj; audiofile::info_t info; handle_t h; diff --git a/cwAudioFileProc.cpp b/cwAudioFileProc.cpp index 51c1518..13c9c1b 100644 --- a/cwAudioFileProc.cpp +++ b/cwAudioFileProc.cpp @@ -302,7 +302,7 @@ cw::rc_t cw::afop::file_processor( const char* srcFn, const char* dstFn, proc_fu audiofile::handle_t srcAfH; audiofile::handle_t dstAfH; audiofile::info_t info; - proc_ctx_t proc_ctx = {0}; + proc_ctx_t proc_ctx = {}; if( hopSmpN > wndSmpN ) return cwLogError(kInvalidArgRC,"The hop sample count (%i) cannot exceed the window sample count (%i).", hopSmpN, wndSmpN ); diff --git a/cwCommonImpl.h b/cwCommonImpl.h index 438e948..7b59c59 100644 --- a/cwCommonImpl.h +++ b/cwCommonImpl.h @@ -138,7 +138,7 @@ namespace cw { -#define cwAssert(cond) while(1){ if(!(cond)){ cwLogFatal(kAssertFailRC,"Assert failed on condition:%s",#cond ); } break; } +#define cwAssert(C) while(1){ if(!(C)){ cwLogFatal(kAssertFailRC,"Assert failed on condition:%s",#C ); } break; } diff --git a/cwCsv.cpp b/cwCsv.cpp index c6aa024..3db4498 100644 --- a/cwCsv.cpp +++ b/cwCsv.cpp @@ -113,6 +113,7 @@ namespace cw continue; state = c==dquote ? kInQuotedField : kInField; + [[fallthrough]]; case kInField: if(c == field_seperator_char ) diff --git a/cwDataSets.cpp b/cwDataSets.cpp index e453aa8..127327b 100644 --- a/cwDataSets.cpp +++ b/cwDataSets.cpp @@ -2647,7 +2647,7 @@ cw::rc_t cw::dataset::test( const object_t* cfg ) printf("%3i : ",j); // print the first 5 images from each batch to an SVG file - for(unsigned i=0; i<0; ++i,++imageN) + for(unsigned i=0; i<5; ++i,++imageN) { printf("%i ", numbV[i] ); diff --git a/cwFlow.cpp b/cwFlow.cpp index 55ce23d..09a1e6e 100644 --- a/cwFlow.cpp +++ b/cwFlow.cpp @@ -23,7 +23,7 @@ namespace cw class_members_t* members; } library_t; - library_t library[] = { + library_t g_library[] = { { "audio_in", &audio_in::members }, { "audio_out", &audio_out::members }, { "audioFileIn", &audioFileIn::members }, @@ -49,7 +49,7 @@ namespace cw class_members_t* _find_library_record( const char* label ) { - for(library_t* l = library; l->label != nullptr; ++l) + for(library_t* l = g_library; l->label != nullptr; ++l) if( textCompare(l->label,label) == 0) return l->members; @@ -86,7 +86,7 @@ namespace cw return rc; } - rc_t _parse_class_cfg(flow_t* p, const library_t* library, const object_t* classCfg) + rc_t _parse_class_cfg(flow_t* p, const object_t* classCfg) { rc_t rc = kOkRC; @@ -1012,7 +1012,7 @@ namespace cw rc_t _create_instance( flow_t* p, const object_t* inst_cfg ) { rc_t rc = kOkRC; - inst_parse_vars_t pvars = {0}; + inst_parse_vars_t pvars = {}; instance_t* inst = nullptr; class_desc_t* class_desc = nullptr; @@ -1576,7 +1576,7 @@ cw::rc_t cw::flow::create( handle_t& hRef, p->deviceN = deviceN; // parse the class description array - if((rc = _parse_class_cfg(p,library,&classCfg)) != kOkRC ) + if((rc = _parse_class_cfg(p,&classCfg)) != kOkRC ) { rc = cwLogError(kSyntaxErrorRC,"Error parsing the class description list."); goto errLabel; diff --git a/cwIo.cpp b/cwIo.cpp index 9d23d5d..9e551f3 100644 --- a/cwIo.cpp +++ b/cwIo.cpp @@ -3882,10 +3882,10 @@ void cw::io::latency_measure_setup(handle_t h) p->latency_meas_enable_fl = true; p->latency_meas_thresh_db = -50; p->latency_meas_thresh_lin = pow(10.0,p->latency_meas_thresh_db/20.0); - p->latency_meas_result.note_on_input_ts = {0}; - p->latency_meas_result.note_on_output_ts = {0}; - p->latency_meas_result.audio_in_ts = {0}; - p->latency_meas_result.audio_out_ts = {0}; + p->latency_meas_result.note_on_input_ts = {}; + p->latency_meas_result.note_on_output_ts = {}; + p->latency_meas_result.audio_in_ts = {}; + p->latency_meas_result.audio_out_ts = {}; p->latency_meas_result.audio_in_rms_max = 0; p->latency_meas_result.audio_out_rms_max = 0; diff --git a/cwIoMidiRecordPlay.cpp b/cwIoMidiRecordPlay.cpp index bdaa225..161e2ff 100644 --- a/cwIoMidiRecordPlay.cpp +++ b/cwIoMidiRecordPlay.cpp @@ -648,14 +648,14 @@ namespace cw rc_t _transmit_note( midi_record_play_t* p, unsigned ch, unsigned pitch, unsigned vel, unsigned microsecs ) { - time::spec_t ts = {0}; + time::spec_t ts = {}; time::microsecondsToSpec( ts, microsecs ); return _event_callback( p, kInvalidId, ts, kInvalidId, nullptr, ch, midi::kNoteOnMdId, pitch, vel, 0 ); } rc_t _transmit_ctl( midi_record_play_t* p, unsigned ch, unsigned ctlId, unsigned ctlVal, unsigned microsecs ) { - time::spec_t ts = {0}; + time::spec_t ts = {}; time::microsecondsToSpec( ts, microsecs ); return _event_callback( p, kInvalidId, ts, kInvalidId, nullptr, ch, midi::kCtlMdId, ctlId, ctlVal, 0 ); } @@ -1826,7 +1826,7 @@ unsigned cw::midi_record_play::label_to_device_index( handle_t h, const char* de const char* cw::midi_record_play::device_index_to_label( handle_t h, unsigned devIdx ) { midi_record_play_t* p = _handleToPtr(h); - return 0 <= devIdx && devIdx < p->midiDevN ? p->midiDevA[devIdx].label : nullptr; + return devIdx < p->midiDevN ? p->midiDevA[devIdx].label : nullptr; } cw::rc_t cw::midi_record_play::seek( handle_t h, time::spec_t seek_timestamp ) @@ -1897,7 +1897,7 @@ unsigned cw::midi_record_play::event_loc( handle_t h ) { midi_record_play_t* p = _handleToPtr(h); - if( !p->recordFl && 0 <= p->msgArrayOutIdx && p->msgArrayOutIdx < p->msgArrayN ) + if( !p->recordFl && p->msgArrayOutIdx < p->msgArrayN ) return p->msgArray[ p->msgArrayOutIdx ].loc; return kInvalidId; diff --git a/cwIoPresetSelApp.cpp b/cwIoPresetSelApp.cpp index 701dd87..54c9e7a 100644 --- a/cwIoPresetSelApp.cpp +++ b/cwIoPresetSelApp.cpp @@ -445,7 +445,7 @@ namespace cw "crossFadeCount", app->crossFadeCnt, "beg_play_loc", app->beg_play_loc, "end_play_loc", app->end_play_loc, - "dflt_perf_label", app->dflt_perf_label, + "dflt_perf_label", app->dflt_perf_label, "live_mode_fl", app->useLiveMidiFl, "enable_recording_fl", app->enableRecordFl, "midi_record_dir", midi_record_dir, @@ -3564,20 +3564,21 @@ cw::rc_t cw::preset_sel_app::main( const object_t* cfg, int argc, const char* ar { rc_t rc; - app_t app = { .trackMidiFl = true, - .pvWndSmpCnt = 512, - .sdBypassFl = false, - .sdInGain = 1.0, - .sdCeiling = 20.0, - .sdExpo = 2.0, - .sdThresh = 60.0, - .sdUpr = -1.1, - .sdLwr = 2.0, - .sdMix = 0.0, - .cmpBypassFl = false, - .dflt_perf_app_id = kInvalidId - - }; + app_t app = {}; + app.trackMidiFl = true; + app.pvWndSmpCnt = 512; + app.sdBypassFl = false; + app.sdInGain = 1.0; + app.sdCeiling = 20.0; + app.sdExpo = 2.0; + app.sdThresh = 60.0; + app.sdUpr = -1.1; + app.sdLwr = 2.0; + app.sdMix = 0.0; + app.cmpBypassFl = false; + app.dflt_perf_app_id = kInvalidId; + + const object_t* params_cfg = nullptr; unsigned vtMapN = vtbl::get_ui_id_map_count(); 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/cwMidiAlsa.cpp b/cwMidiAlsa.cpp index b59bc59..cc969a7 100644 --- a/cwMidiAlsa.cpp +++ b/cwMidiAlsa.cpp @@ -75,7 +75,8 @@ namespace cw } alsa_device_t; #define _cmMpErrMsg( rc, alsaRc, str ) cwLogError(kOpFailRC,"%s : ALSA Error:%i %s",(str),(alsaRc),snd_strerror(alsaRc)) -#define _cmMpErrMsg1( rc, alsaRc, fmt, arg ) cwLogError(kOpFailRC, fmt"%s : ALSA Error:%i %s",(arg),(alsaRc),snd_strerror(alsaRc)) +#define _cmMpErrMsg1( rc, alsaRc, fmt, arg ) cwLogError(kOpFailRC, fmt" : ALSA Error:%i %s",(arg),(alsaRc),snd_strerror(alsaRc)) +#define _cmMpWarnMsg2( alsaRc, fmt, arg0, arg1 ) cwLogWarning(fmt" : ALSA Error:%i %s",(arg0),(arg1),(alsaRc),snd_strerror(alsaRc)) alsa_device_t* _handleToPtr( handle_t h ){ return handleToPtr(h); } @@ -301,8 +302,9 @@ namespace cw snd_seq_client_info_t* cip = NULL; snd_seq_port_info_t* pip = NULL; snd_seq_port_subscribe_t *subs = NULL; - unsigned i,j,k,arc; - + unsigned i,j,k; + int arc; + for(i=0; iclientIdToDevIdxMap[i] = kInvalidIdx; @@ -354,11 +356,16 @@ namespace cw snd_seq_port_info_set_timestamp_queue(pip, p->alsa_queue); // create the client port - if((p->alsa_addr.port = snd_seq_create_port(p->h,pip)) < 0 ) + //if((p->alsa_addr.port = snd_seq_create_port(p->h,pip)) < 0 ) + if((arc = snd_seq_create_port(p->h,pip)) < 0 ) { - rc = _cmMpErrMsg(kOpFailRC,p->alsa_addr.port,"ALSA client port creation failed."); + rc = _cmMpErrMsg(kOpFailRC,arc,"ALSA client port creation failed."); goto errLabel; } + else + { + p->alsa_addr.port = arc; + } p->devCnt = 0; @@ -426,7 +433,9 @@ namespace cw unsigned caps = snd_seq_port_info_get_capability(pip); snd_seq_addr_t addr = *snd_seq_port_info_get_addr(pip); - if( cwIsFlag(caps,SND_SEQ_PORT_CAP_READ) ) + //printf("0x%x 0x%x %s %s\n",type,caps,name,port); + + if( cwIsFlag(caps,SND_SEQ_PORT_CAP_READ) && cwIsFlag(caps,SND_SEQ_PORT_CAP_SUBS_READ) ) { assert(jdevArray[i].iPortCnt); p->devArray[i].iPortArray[j].inputFl = true; @@ -443,12 +452,12 @@ namespace cw snd_seq_port_subscribe_set_time_update(subs, 1); snd_seq_port_subscribe_set_time_real(subs, 1); if((arc = snd_seq_subscribe_port(p->h, subs)) < 0) - rc = _cmMpErrMsg1(kOpFailRC,arc,"Input port to app. subscription failed on port '%s'.",cwStringNullGuard(port)); + _cmMpWarnMsg2(arc,"Input port to app. subscription failed on device:%s port '%s'.",cwStringNullGuard(name),cwStringNullGuard(port)); ++j; } - if( cwIsFlag(caps,SND_SEQ_PORT_CAP_WRITE) ) + if( cwIsFlag(caps,SND_SEQ_PORT_CAP_WRITE) && cwIsFlag(caps,SND_SEQ_PORT_CAP_SUBS_WRITE) && cwIsNotFlag(type,SND_SEQ_PORT_TYPE_APPLICATION) ) { assert(kdevArray[i].oPortCnt); p->devArray[i].oPortArray[k].inputFl = false; @@ -461,7 +470,7 @@ namespace cw snd_seq_port_subscribe_set_sender(subs, &p->alsa_addr); snd_seq_port_subscribe_set_dest( subs, &addr); if((arc = snd_seq_subscribe_port(p->h, subs)) < 0 ) - rc = _cmMpErrMsg1(kOpFailRC,arc,"App to output port subscription failed on port '%s'.",cwStringNullGuard(port)); + _cmMpWarnMsg2(arc,"App to output port subscription failed on device:%s port '%s'.",cwStringNullGuard(name), cwStringNullGuard(port)); ++k; } diff --git a/cwMidiDevice.h b/cwMidiDevice.h index 7461356..6c8b16d 100644 --- a/cwMidiDevice.h +++ b/cwMidiDevice.h @@ -1,5 +1,5 @@ -#ifndef cwMidiPort_H -#define cwMidiPort_H +#ifndef cwMidiDevice_H +#define cwMidiDevice_H namespace cw diff --git a/cwMidiFile.cpp b/cwMidiFile.cpp index 4c8237a..9731650 100644 --- a/cwMidiFile.cpp +++ b/cwMidiFile.cpp @@ -1832,11 +1832,11 @@ void cw::midi::file::calcNoteDurations( handle_t h, unsigned flags ) { unsigned k = ch*kMidiNoteCnt + d0; - // there should be no existing sounding note instance for this pitch + // if the note gate is not activated (i.e. key is up) but the note is still sounding (e.g. held by pedal) if( noteGateM[k] == 0 && noteM[k] != NULL ) { - if( warningFl ) - cwLogWarning("%i : Missing note-off instance for note on:%s",m->uid,midi::midiToSciPitch(d0,NULL,0)); + //if( warningFl ) + // cwLogWarning("%i : Missing note-off instance for note on:%s",m->uid,midi::midiToSciPitch(d0,NULL,0)); if( cwIsFlag(flags,kDropReattacksMfFl) ) { diff --git a/cwMidiFileDev.cpp b/cwMidiFileDev.cpp index 44947cb..ba4a064 100644 --- a/cwMidiFileDev.cpp +++ b/cwMidiFileDev.cpp @@ -427,14 +427,13 @@ namespace cw { if( p->cbFunc != nullptr ) { - packet_t pkt = { - .cbArg = p->cbArg, - .devIdx = p->base_dev_idx, - .portIdx = file_idx, - .msgArray = msgA, - .msgCnt = msgN - }; - + packet_t pkt = {}; + pkt.cbArg = p->cbArg; + pkt.devIdx = p->base_dev_idx; + pkt.portIdx = file_idx; + pkt.msgArray = msgA; + pkt.msgCnt = msgN; + p->cbFunc( &pkt, 1 ); } } diff --git a/cwPresetSel.cpp b/cwPresetSel.cpp index da022ea..0324269 100644 --- a/cwPresetSel.cpp +++ b/cwPresetSel.cpp @@ -405,10 +405,12 @@ namespace cw rc_t _validate_preset_id( const frag_t* frag, unsigned preset_id ) { - bool fl = (preset_id < frag->presetN) && (frag->presetA[ preset_id ].preset_idx == preset_id); - - return fl ? kOkRC : cwLogError(kInvalidIdRC,"The preset id '%i' is invalid on the fragment at loc:%i.",preset_id,frag->endLoc); - + rc_t rc = kOkRC; + + if( (preset_id >= frag->presetN) || (frag->presetA[ preset_id ].preset_idx != preset_id) ) + rc = cwLogError(kInvalidIdRC,"The preset id '%i' is invalid on the fragment at loc:%i.",preset_id,frag->endLoc); + + return rc; } bool _is_master_var_id( unsigned varId ) diff --git a/cwScoreFollowTest.cpp b/cwScoreFollowTest.cpp index 1b00ed0..da158ca 100644 --- a/cwScoreFollowTest.cpp +++ b/cwScoreFollowTest.cpp @@ -236,7 +236,7 @@ namespace cw if( perfMeasH.isValid() ) { - perf_meas::result_t pmr = {0}; + perf_meas::result_t pmr = {}; // Call performance measurement unit if( perf_meas::exec( perfMeasH, e, pmr ) == kOkRC && pmr.loc != kInvalidIdx && pmr.valueA != nullptr ) @@ -603,7 +603,7 @@ cw::rc_t cw::score_follow_test::test( const object_t* cfg ) perf_meas::handle_t perfMeasH; perf_meas::params_t perf_meas_params; - test_t t = {0}; + test_t t = {}; t.sf_args.enableFl = true; 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/cwSfScore.cpp b/cwSfScore.cpp index 686fde7..bb9119c 100644 --- a/cwSfScore.cpp +++ b/cwSfScore.cpp @@ -606,7 +606,7 @@ namespace cw // Both of these assertions should have been previously verified // by the score validation process. assert( set->locN >= 2 ); - assert( set->evtCnt >= 0 ); + //assert( set->evtCnt >= 0 ); bool printFl = false; //set->evtArray[0]->barNumb == 272; 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/cwUi.cpp b/cwUi.cpp index 5792db7..509fbc7 100644 --- a/cwUi.cpp +++ b/cwUi.cpp @@ -2116,7 +2116,8 @@ cw::rc_t cw::ui::registerAppIdMap( handle_t h, const appIdMap_t* map, unsigned cw::rc_t cw::ui::sendValueBool( handle_t h, unsigned uuId, bool value ) { ui_t* p = _handleToPtr(h); - value_t v = { .tid=kBoolTId }; + value_t v = {}; + v.tid = kBoolTId; v.u.b = value; return _sendValue(p,kInvalidId,uuId,v); @@ -2126,7 +2127,8 @@ cw::rc_t cw::ui::sendValueBool( handle_t h, unsigned uuId, bool value ) cw::rc_t cw::ui::sendValueInt( handle_t h, unsigned uuId, int value ) { ui_t* p = _handleToPtr(h); - value_t v = { .tid=kIntTId }; + value_t v = {}; + v.tid = kIntTId; v.u.i = value; return _sendValue(p,kInvalidId,uuId,v); @@ -2137,7 +2139,8 @@ cw::rc_t cw::ui::sendValueUInt( handle_t h, unsigned uuId, unsigned value ) { ui_t* p = _handleToPtr(h); - value_t v = { .tid=kUIntTId }; + value_t v = {}; + v.tid = kUIntTId; v.u.u = value; return _sendValue(p,kInvalidId,uuId,v); @@ -2147,7 +2150,8 @@ cw::rc_t cw::ui::sendValueUInt( handle_t h, unsigned uuId, unsigned value ) cw::rc_t cw::ui::sendValueFloat( handle_t h, unsigned uuId, float value ) { ui_t* p = _handleToPtr(h); - value_t v = { .tid=kFloatTId }; + value_t v = { }; + v.tid = kFloatTId; v.u.f = value; return _sendValue(p,kInvalidId,uuId,v); @@ -2158,7 +2162,8 @@ cw::rc_t cw::ui::sendValueFloat( handle_t h, unsigned uuId, float value ) cw::rc_t cw::ui::sendValueDouble( handle_t h, unsigned uuId, double value ) { ui_t* p = _handleToPtr(h); - value_t v = { .tid=kDoubleTId }; + value_t v = {}; + v.tid=kDoubleTId; v.u.d = value; return _sendValue(p,kInvalidId,uuId,v); @@ -2168,7 +2173,8 @@ cw::rc_t cw::ui::sendValueDouble( handle_t h, unsigned uuId, double value ) cw::rc_t cw::ui::sendValueString( handle_t h, unsigned uuId, const char* value ) { ui_t* p = _handleToPtr(h); - value_t v = { .tid=kStringTId }; + value_t v = {}; + v.tid = kStringTId; v.u.s = value; return _sendValue(p,kInvalidId,uuId,v); diff --git a/cwUiTest.cpp b/cwUiTest.cpp index 43bdbd1..cefc571 100644 --- a/cwUiTest.cpp +++ b/cwUiTest.cpp @@ -207,7 +207,7 @@ namespace cw case kFloatId: printf("Float: %f\n",v->u.f); p->appFloat = v->u.f; - + break; case kPanelBtn1Id: { diff --git a/cwVariant.cpp b/cwVariant.cpp index 7c9f763..404d67e 100644 --- a/cwVariant.cpp +++ b/cwVariant.cpp @@ -46,7 +46,7 @@ namespace cw { kPtrVFl | kFloatVFl, "float_ptr", "p", sizeof(float) }, { kPtrVFl | kDoubleVFl, "double_ptr", "p", sizeof(double) }, - { 0, nullptr, 0 } + { 0, nullptr, nullptr, 0 } }; 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); diff --git a/cwWebSock.cpp b/cwWebSock.cpp index 156dfca..6382066 100644 --- a/cwWebSock.cpp +++ b/cwWebSock.cpp @@ -180,8 +180,10 @@ namespace cw cwLogInfo("Websocket connection closed.\n"); ws->_connSessionN -= 1; + + cwAssert( protoState->sessionN > 0 ); + protoState->sessionN -= 1; - cwAssert( protoState->sessionN >= 0 ); if( ws->_cbFunc != nullptr) ws->_cbFunc(ws->_cbArg,proto->id,sess->id,kDisconnectTId,nullptr,0); @@ -538,16 +540,16 @@ cw::rc_t cw::websock::create( int logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE; lws_set_log_level(logs, nullptr); - p->_event_loop_ops_custom = { - .name = "custom", - .init_vhost_listen_wsi = _custom_sock_accept, - .init_pt = _custom_init_private, - .wsi_logical_close = _custom_wsi_logical_close, - .sock_accept = _custom_sock_accept, - .io = _custom_io, - .evlib_size_pt = sizeof(struct pt_eventlibs_custom) - }; + p->_event_loop_ops_custom = {}; + p->_event_loop_ops_custom.name = "custom"; + p->_event_loop_ops_custom.init_vhost_listen_wsi = _custom_sock_accept; + p->_event_loop_ops_custom.init_pt = _custom_init_private; + p->_event_loop_ops_custom.wsi_logical_close = _custom_wsi_logical_close; + p->_event_loop_ops_custom.sock_accept = _custom_sock_accept; + p->_event_loop_ops_custom.io = _custom_io; + p->_event_loop_ops_custom.evlib_size_pt = sizeof(struct pt_eventlibs_custom); + p->_evlib_custom = { .hdr = { "custom event loop",