upnpsoap: Handle StartingIndex on magic containers

We need to subtract StartingIndex when we limit SQL query
results based on the max number of items in a magic container.
This commit is contained in:
Justin Maggard 2015-04-08 01:21:21 -07:00
parent f18c3cee6f
commit f09f441607

View File

@ -1251,10 +1251,11 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
strncpyt(where, magic->where, sizeof(where));
if (magic->max_count > 0)
{
int limit = MAX(magic->max_count - StartingIndex, 0);
ret = get_child_count(ObjectID, magic);
totalMatches = ret > magic->max_count ? magic->max_count : ret;
if (RequestedCount > magic->max_count || RequestedCount < 0)
RequestedCount = magic->max_count;
totalMatches = MIN(ret, limit);
if (RequestedCount > limit || RequestedCount < 0)
RequestedCount = limit;
}
}
if (!where[0])