Skip to content

Commit

Permalink
Merge pull request #14 from PDXostc/fix_float_vs_double
Browse files Browse the repository at this point in the history
Fixed double vs. float typo.
  • Loading branch information
magnusfeuer authored Apr 29, 2019
2 parents 6a4d61e + 31867be commit 0a85da9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ static int encode_signal(vsd_signal_t* sig, uint8_t* buf, int buf_sz, int* len)
{
vsd_signal_leaf_t* l_signal = 0;

*len = 0;
if (sig->elem_type == vsd_branch) {
int rec_res = 0;
vsd_signal_branch_t* br_signal = (vsd_signal_branch_t*) sig;
Expand Down Expand Up @@ -1050,8 +1051,10 @@ static int _find_and_validate_by_signal(vsd_context_t* context,
}

if (type != vsd_na && sig->data_type != type) {
RMC_LOG_WARNING("Signal ID %u is %s, not boolean.",
sig->id, vsd_data_type_to_string(sig->data_type));
RMC_LOG_WARNING("Signal ID %u is %s, not the requested %s.",
sig->id,
vsd_data_type_to_string(sig->data_type),
vsd_data_type_to_string(type));
return EINVAL;
}

Expand Down Expand Up @@ -1383,12 +1386,12 @@ int vsd_set_value_by_id_float(vsd_context_t* context, vsd_id_t id, float val)

int vsd_set_value_by_signal_double(vsd_context_t* context, vsd_signal_t* sig, double val)
{
int res = _find_and_validate_by_signal(context, sig, vsd_float);
int res = _find_and_validate_by_signal(context, sig, vsd_double);

if (res)
return res;

((vsd_signal_leaf_t*) sig)->val.f = val;
((vsd_signal_leaf_t*) sig)->val.d = val;
return 0;
}

Expand Down

0 comments on commit 0a85da9

Please sign in to comment.