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:
parent
f18c3cee6f
commit
f09f441607
@ -1251,10 +1251,11 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
strncpyt(where, magic->where, sizeof(where));
|
strncpyt(where, magic->where, sizeof(where));
|
||||||
if (magic->max_count > 0)
|
if (magic->max_count > 0)
|
||||||
{
|
{
|
||||||
|
int limit = MAX(magic->max_count - StartingIndex, 0);
|
||||||
ret = get_child_count(ObjectID, magic);
|
ret = get_child_count(ObjectID, magic);
|
||||||
totalMatches = ret > magic->max_count ? magic->max_count : ret;
|
totalMatches = MIN(ret, limit);
|
||||||
if (RequestedCount > magic->max_count || RequestedCount < 0)
|
if (RequestedCount > limit || RequestedCount < 0)
|
||||||
RequestedCount = magic->max_count;
|
RequestedCount = limit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!where[0])
|
if (!where[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user