GetInstancesFor must accept a NULL iocount and consider it as 1
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5395 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2607,16 +2607,16 @@ BMediaRoster::GetInstancesFor(media_addon_id addon,
|
|||||||
int32 * io_count)
|
int32 * io_count)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
if (out_id == NULL || io_count == NULL)
|
if (out_id == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
if (*io_count <= 0)
|
if (io_count && *io_count <= 0)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
server_get_instances_for_request request;
|
server_get_instances_for_request request;
|
||||||
server_get_instances_for_reply reply;
|
server_get_instances_for_reply reply;
|
||||||
status_t rv;
|
status_t rv;
|
||||||
|
|
||||||
request.maxcount = *io_count;
|
request.maxcount = (io_count ? *io_count : 1);
|
||||||
request.addon_id = addon;
|
request.addon_id = addon;
|
||||||
request.addon_flavor_id = flavor;
|
request.addon_flavor_id = flavor;
|
||||||
|
|
||||||
@@ -2626,7 +2626,8 @@ BMediaRoster::GetInstancesFor(media_addon_id addon,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
*io_count = reply.count;
|
if(io_count)
|
||||||
|
*io_count = reply.count;
|
||||||
if (reply.count > 0)
|
if (reply.count > 0)
|
||||||
memcpy(out_id, reply.node_id, sizeof(media_node_id) * reply.count);
|
memcpy(out_id, reply.node_id, sizeof(media_node_id) * reply.count);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user