put out a correct WTP Descriptor, even if no data is available

This commit is contained in:
2022-08-30 22:13:22 +02:00
parent 190c94ded4
commit 2064f7dba1
2 changed files with 8 additions and 17 deletions

View File

@ -17,32 +17,23 @@ int cw_write_descriptor_subelem (uint8_t *dst, cw_Cfg_t ** cfg_list,
sprintf (key, "%s/%s", parent_key, CW_SKEY_VENDOR);
vendor_s = cw_cfg_get_l (cfg_list, key, NULL);
if (vendor_s == NULL) {
cw_log (LOG_ERR, "Can't put subelem %s, no value of type found.", key);
cw_log (LOG_ERR, "Can't put subelem %s, no value found. Setting zero.", key);
vendor_s = "0";
}
vendor = atoi(vendor_s);
sprintf (key, "%s/%s", parent_key, CW_SKEY_VERSION);
// cw_Val_t * val = cw_cfg_get_val_l(cfg_list, key, CW_TYPE_BSTR16);
version = cw_cfg_get_bstr16_l(cfg_list,key,NULL);
//version = cw_cfg_get_bstr16 (cfg, key, NULL);
if (version == NULL) {
cw_log (LOG_ERR, "Can't put subelem %s, no value of type Bstr16 found.", key);
return 0;
cw_log (LOG_ERR, "Can't put subelem %s, no value found. Setting zero.", key);
version = bstr16_create_from_str("0.0.0.0");
}
d = dst;
/* put vendor */
d += cw_put_dword(d, vendor); //->type->put (vendor, d);
d += cw_put_dword(d, vendor);
/* put version */
d += cw_put_dword (d, (subelem_id << 16) | bstr16_len(version));