Replace use of {0} with {}, or replace partial initialization cases with complete initialization.

This commit is contained in:
kevin 2024-03-25 10:46:45 -04:00
parent 6f2444b8d7
commit 36826a3b66
9 changed files with 53 additions and 47 deletions

View File

@ -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;

View File

@ -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 );

View File

@ -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;

View File

@ -3880,10 +3880,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;

View File

@ -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;

View File

@ -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();

View File

@ -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 );
}
}

View File

@ -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;

View File

@ -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);