diff options
author | Max Kellermann <max@duempel.org> | 2014-07-12 17:22:39 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-07-12 17:22:39 +0200 |
commit | 41a7203c28d2cc7550f1bb05f767950d388326cd (patch) | |
tree | 0b0970bbaf06b66ec0c0b3a50d90b3f6ef65dd20 /src/output/plugins/RoarOutputPlugin.cxx | |
parent | 543a58bb874be8a510d54e91a37797b0c71b1160 (diff) | |
download | mpd-41a7203c28d2cc7550f1bb05f767950d388326cd.tar.gz mpd-41a7203c28d2cc7550f1bb05f767950d388326cd.tar.xz mpd-41a7203c28d2cc7550f1bb05f767950d388326cd.zip |
Tag: add class const_iterator and methods begin(), end()
Enables using range-based "for".
Diffstat (limited to '')
-rw-r--r-- | src/output/plugins/RoarOutputPlugin.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/output/plugins/RoarOutputPlugin.cxx b/src/output/plugins/RoarOutputPlugin.cxx index ac4dd8a4e..ae6bdf1b1 100644 --- a/src/output/plugins/RoarOutputPlugin.cxx +++ b/src/output/plugins/RoarOutputPlugin.cxx @@ -374,20 +374,22 @@ RoarOutput::SendTag(const Tag &tag) vals[0].key = const_cast<char *>("LENGTH"); vals[0].value = timebuf; - for (unsigned i = 0; i < tag.num_items && cnt < 32; i++) - { + for (const auto &item : tag) { + if (cnt >= 32) + break; + bool is_uuid = false; - const char *key = roar_tag_convert(tag.items[i]->type, + const char *key = roar_tag_convert(item.type, &is_uuid); if (key != nullptr) { vals[cnt].key = const_cast<char *>(key); if (is_uuid) { snprintf(uuid_buf[cnt], sizeof(uuid_buf[0]), "{UUID}%s", - tag.items[i]->value); + item.value); vals[cnt].value = uuid_buf[cnt]; } else { - vals[cnt].value = tag.items[i]->value; + vals[cnt].value = const_cast<char *>(item.value); } cnt++; |