From eb48d0b9d2accc2afc4c217ec11b4939779f46ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Tue, 3 Mar 2009 11:46:28 +0100 Subject: [PATCH] add get_message_id stub --- gdigi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gdigi.c b/gdigi.c index 08ae825..f1ea1e6 100644 --- a/gdigi.c +++ b/gdigi.c @@ -195,6 +195,14 @@ static void send_message(gint procedure, gchar *data, gint len) g_string_free(msg, TRUE); } +static gint get_message_id(GString *msg) +{ + if (msg->len > 7) { + return (u_char)msg->str[7]; + } + return -1; +} + /* id - ID as found in preset file position - Position as found in preset file @@ -372,7 +380,11 @@ GStrv query_preset_names(guint bank) send_data(command, sizeof(command)); /* read reply */ - data = read_data(); + do { + if (data) + g_string_free(data, TRUE); + data = read_data(); + } while (get_message_id(data) != RECEIVE_PRESET_NAMES); if (data != NULL) { char preset_reply_magic[] = {0xF0, 0x00, 0x00, 0x10, 0x00, 0x5E, 0x02, 0x22, 0x00, 0x01};