Merge branch 'edge-preview' of https://github.com/synthetos/g2 into edge-preview

This commit is contained in:
Rob Giseburt
2020-03-12 14:05:18 -05:00
2 changed files with 12 additions and 13 deletions

View File

@@ -407,8 +407,6 @@ static stat_t _get_nv_pair(nvObj_t *nv, char **pstr, int8_t *depth)
* - Allow self-referential elements that would otherwise cause a recursive loop
* - Skip over empty objects (TYPE_EMPTY)
* - If a JSON object is empty represent it as {}
* --- OR ---
* - If a JSON object is empty omit the object altogether (no curlies)
*/
uint16_t json_serialize(nvObj_t *nv, char *out_buf, uint16_t size)
@@ -437,6 +435,7 @@ uint16_t json_serialize(nvObj_t *nv, char *out_buf, uint16_t size)
}
case (TYPE_PARENT): { *str++ = '{';
need_a_comma = false;
prev_depth++; // make sure empty objects are closed
break;
}
case (TYPE_FLOAT): { convert_outgoing_float(nv);

View File

@@ -251,23 +251,23 @@ stat_t sr_set_status_report(nvObj_t *nv)
}
// Note: valuetype may have been coerced from boolean to something else, so just treat value_int as a bool
if (nv->value_int) {
auto &cfgTmp = cfgArray[nv->value_int];
auto &cfgTmp = cfgArray[nv->index];
sr.status_report_list[i].index = nv->index;
sr.status_report_list[i].get = cfgTmp.get;
// sr.status_report_list[i].flags = cfgTmp.flags;
sr.status_report_list[i].precision = cfgTmp.precision;
strcpy(sr.status_report_list[i].group, cfgTmp.group);
strcpy(sr.status_report_list[i].token, cfgTmp.token);
status_report_list[i].index = nv->index;
status_report_list[i].get = cfgTmp.get;
// status_report_list[i].flags = cfgTmp.flags;
status_report_list[i].precision = cfgTmp.precision;
strcpy(status_report_list[i].group, cfgTmp.group);
strcpy(status_report_list[i].token, cfgTmp.token);
// special processing for system groups and stripping tokens for groups
if (cfgTmp.group[0] != NUL) {
if (cfgArray[nv->index].flags & F_NOSTRIP) {
sr.status_report_list[i].group[0] = NUL;
strcpy(sr.status_report_list[i].token, cfgTmp.token);
status_report_list[i].group[0] = NUL;
strcpy(status_report_list[i].token, cfgTmp.token);
} else {
strcpy(sr.status_report_list[i].group, cfgTmp.group);
strcpy(sr.status_report_list[i].token, &cfgTmp.token[strlen(cfgTmp.group)]); // strip group from the token
strcpy(status_report_list[i].group, cfgTmp.group);
strcpy(status_report_list[i].token, &cfgTmp.token[strlen(cfgTmp.group)]); // strip group from the token
}
}
nv->value_int = nv->index; // persist the index as the value