* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdlib.h>
+#include <string.h>
#include "sigrok-cli.h"
#include "config.h"
#include <glib.h>
static GHashTable *pd_channel_maps = NULL;
extern struct srd_session *srd_sess;
-extern gint opt_loglevel;
-
static int opts_to_gvar(struct srd_decoder *dec, GHashTable *hash,
GHashTable **options)
ret = 1;
break;
}
- dec = srd_decoder_get_by_id(pd_name);
+ if (!(dec = srd_decoder_get_by_id(pd_name))) {
+ g_critical("Failed to get decoder %s by id.", pd_name);
+ ret = 1;
+ break;
+ }
/* Convert decoder option and channel values to GVariant. */
if (!opts_to_gvar(dec, pd_opthash, &options)) {
show = FALSE;
for (l = ann_list; l; l = l->next) {
if (GPOINTER_TO_INT(l->data) == -1
- || GPOINTER_TO_INT(l->data) == pda->ann_format) {
+ || GPOINTER_TO_INT(l->data) == pda->ann_class) {
show = TRUE;
break;
}
} else {
/* Protocol decoder id, annotation class,
* all annotation strings. */
- ann_descr = g_slist_nth_data(dec->annotations, pda->ann_format);
+ ann_descr = g_slist_nth_data(dec->annotations, pda->ann_class);
printf(" %s: %s:", pdata->pdo->proto_id, ann_descr[0]);
for (i = 0; pda->ann_text[i]; i++)
printf(" \"%s\"", pda->ann_text[i]);