song_save: check for colon and space when loading a tag

matchesAnMpdTagItemKey() broke when two tag items had the same prefix,
because it did not check if the tag name ended after the prefix.  Add
a check for the colon and the space after the tag name.
This commit is contained in:
Max Kellermann 2009-01-13 23:43:16 +01:00
parent 45598d50e3
commit 1452717459

View File

@ -91,8 +91,10 @@ static int matchesAnMpdTagItemKey(char *buffer, int *itemType)
int i;
for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
if (0 == strncmp(mpdTagItemKeys[i], buffer,
strlen(mpdTagItemKeys[i]))) {
size_t len = strlen(mpdTagItemKeys[i]);
if (0 == strncmp(mpdTagItemKeys[i], buffer, len) &&
buffer[len] == ':' && buffer[len + 1] == ' ') {
*itemType = i;
return 1;
}