changed use of debugging functions, map, list and stack
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2195 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -40,16 +40,17 @@ AppManager::~AppManager()
|
|||||||
bool AppManager::HasTeam(team_id team)
|
bool AppManager::HasTeam(team_id team)
|
||||||
{
|
{
|
||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
App app;
|
return fAppMap->Has(team);
|
||||||
return fAppMap->Get(team, &app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t AppManager::RegisterTeam(team_id team, BMessenger messenger)
|
status_t AppManager::RegisterTeam(team_id team, BMessenger messenger)
|
||||||
{
|
{
|
||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
TRACE("AppManager::RegisterTeam %ld\n", team);
|
TRACE("AppManager::RegisterTeam %ld\n", team);
|
||||||
if (HasTeam(team))
|
if (HasTeam(team)) {
|
||||||
|
FATAL("Erorr: AppManager::RegisterTeam: team %ld already registered\n", team);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
}
|
||||||
App app;
|
App app;
|
||||||
app.team = team;
|
app.team = team;
|
||||||
app.messenger = messenger;
|
app.messenger = messenger;
|
||||||
@@ -140,7 +141,7 @@ void AppManager::BigBrother()
|
|||||||
do {
|
do {
|
||||||
if (!fLocker->Lock())
|
if (!fLocker->Lock())
|
||||||
break;
|
break;
|
||||||
for (int32 i = 0; fAppMap->GetPointerAt(i, &app); i++) {
|
for (fAppMap->Rewind(); fAppMap->GetNext(&app); ) {
|
||||||
reply.what = 0;
|
reply.what = 0;
|
||||||
status = app->messenger.SendMessage(&msg, &reply, 5000000, 2000000);
|
status = app->messenger.SendMessage(&msg, &reply, 5000000, 2000000);
|
||||||
if (status != B_OK || reply.what != 'PONG') {
|
if (status != B_OK || reply.what != 'PONG') {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ NodeManager::NodeManager() :
|
|||||||
{
|
{
|
||||||
fLocker = new BLocker("node manager locker");
|
fLocker = new BLocker("node manager locker");
|
||||||
fDormantFlavorList = new List<dormant_flavor_info>;
|
fDormantFlavorList = new List<dormant_flavor_info>;
|
||||||
fAddonPathMap = new Map<media_addon_id,entry_ref>;
|
fAddonPathMap = new Map<media_addon_id, entry_ref>;
|
||||||
fRegisteredNodeMap = new Map<media_node_id,registered_node>;
|
fRegisteredNodeMap = new Map<media_node_id, registered_node>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ NodeManager::UnregisterNode(media_addon_id *addon_id, media_node_id nodeid, team
|
|||||||
bool b;
|
bool b;
|
||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
TRACE("NodeManager::UnregisterNode enter: node %ld, team %ld\n", nodeid, team);
|
TRACE("NodeManager::UnregisterNode enter: node %ld, team %ld\n", nodeid, team);
|
||||||
b = fRegisteredNodeMap->GetPointer(nodeid, &rn);
|
b = fRegisteredNodeMap->Get(nodeid, &rn);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FATAL("!!! NodeManager::UnregisterNode: Error: couldn't finde node %ld (team %ld)\n", nodeid, team);
|
FATAL("!!! NodeManager::UnregisterNode: Error: couldn't finde node %ld (team %ld)\n", nodeid, team);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -93,14 +93,14 @@ NodeManager::IncrementGlobalRefCount(media_node_id nodeid, team_id team)
|
|||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
bool b;
|
bool b;
|
||||||
TRACE("NodeManager::IncrementGlobalRefCount enter: node %ld, team %ld\n", nodeid, team);
|
TRACE("NodeManager::IncrementGlobalRefCount enter: node %ld, team %ld\n", nodeid, team);
|
||||||
b = fRegisteredNodeMap->GetPointer(nodeid, &rn);
|
b = fRegisteredNodeMap->Get(nodeid, &rn);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FATAL("!!! NodeManager::IncrementGlobalRefCount: Error: node %ld not found\n", nodeid);
|
FATAL("!!! NodeManager::IncrementGlobalRefCount: Error: node %ld not found\n", nodeid);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
int32 *count;
|
int32 *count;
|
||||||
int32 debug_count;
|
int32 debug_count;
|
||||||
b = rn->teamrefcount.GetPointer(team, &count);
|
b = rn->teamrefcount.Get(team, &count);
|
||||||
if (b) {
|
if (b) {
|
||||||
*count += 1;
|
*count += 1;
|
||||||
debug_count = *count;
|
debug_count = *count;
|
||||||
@@ -122,13 +122,13 @@ NodeManager::DecrementGlobalRefCount(media_node_id nodeid, team_id team)
|
|||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
bool b;
|
bool b;
|
||||||
TRACE("NodeManager::DecrementGlobalRefCount enter: node %ld, team %ld\n", nodeid, team);
|
TRACE("NodeManager::DecrementGlobalRefCount enter: node %ld, team %ld\n", nodeid, team);
|
||||||
b = fRegisteredNodeMap->GetPointer(nodeid, &rn);
|
b = fRegisteredNodeMap->Get(nodeid, &rn);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FATAL("!!! NodeManager::DecrementGlobalRefCount: Error: node %ld not found\n", nodeid);
|
FATAL("!!! NodeManager::DecrementGlobalRefCount: Error: node %ld not found\n", nodeid);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
int32 *count;
|
int32 *count;
|
||||||
b = rn->teamrefcount.GetPointer(team, &count);
|
b = rn->teamrefcount.Get(team, &count);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FATAL("!!! NodeManager::DecrementGlobalRefCount: Error: node %ld has no team %ld references\n", nodeid, team);
|
FATAL("!!! NodeManager::DecrementGlobalRefCount: Error: node %ld has no team %ld references\n", nodeid, team);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -158,7 +158,7 @@ NodeManager::GetCloneForId(media_node *node, media_node_id nodeid, team_id team)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
b = fRegisteredNodeMap->GetPointer(nodeid, &rn);
|
b = fRegisteredNodeMap->Get(nodeid, &rn);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FATAL("!!! NodeManager::GetCloneForId: Error: node %ld not found\n", nodeid);
|
FATAL("!!! NodeManager::GetCloneForId: Error: node %ld not found\n", nodeid);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -202,7 +202,7 @@ NodeManager::PublishInputs(const media_node &node, const media_input *inputs, in
|
|||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
bool b;
|
bool b;
|
||||||
b = fRegisteredNodeMap->GetPointer(node.node, &rn);
|
b = fRegisteredNodeMap->Get(node.node, &rn);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FATAL("!!! NodeManager::PublishInputs: Error: node %ld not found\n", node.node);
|
FATAL("!!! NodeManager::PublishInputs: Error: node %ld not found\n", node.node);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -220,7 +220,7 @@ NodeManager::PublishOutputs(const media_node &node, const media_output *outputs,
|
|||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
bool b;
|
bool b;
|
||||||
b = fRegisteredNodeMap->GetPointer(node.node, &rn);
|
b = fRegisteredNodeMap->Get(node.node, &rn);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FATAL("!!! NodeManager::PublishOutputs: Error: node %ld not found\n", node.node);
|
FATAL("!!! NodeManager::PublishOutputs: Error: node %ld not found\n", node.node);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -237,14 +237,14 @@ NodeManager::FindNodeId(media_node_id *nodeid, port_id port)
|
|||||||
{
|
{
|
||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
for (int32 i = 0; fRegisteredNodeMap->GetPointerAt(i, &rn); i++) {
|
for (fRegisteredNodeMap->Rewind(); fRegisteredNodeMap->GetNext(&rn); ) {
|
||||||
if (rn->port == port) {
|
if (rn->port == port) {
|
||||||
*nodeid = rn->nodeid;
|
*nodeid = rn->nodeid;
|
||||||
TRACE("NodeManager::FindNodeId found port %ld, node %ld\n", port, *nodeid);
|
TRACE("NodeManager::FindNodeId found port %ld, node %ld\n", port, *nodeid);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
media_output *output;
|
media_output *output;
|
||||||
for (int32 j = 0; rn->outputlist.GetPointerAt(j, &output); j++) {
|
for (rn->outputlist.Rewind(); rn->outputlist.GetNext(&output); ) {
|
||||||
if (output->source.port == port || output->destination.port == port) {
|
if (output->source.port == port || output->destination.port == port) {
|
||||||
*nodeid = rn->nodeid;
|
*nodeid = rn->nodeid;
|
||||||
TRACE("NodeManager::FindNodeId found output port %ld, node %ld\n", port, *nodeid);
|
TRACE("NodeManager::FindNodeId found output port %ld, node %ld\n", port, *nodeid);
|
||||||
@@ -252,7 +252,7 @@ NodeManager::FindNodeId(media_node_id *nodeid, port_id port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
media_input *input;
|
media_input *input;
|
||||||
for (int32 j = 0; rn->inputlist.GetPointerAt(j, &input); j++) {
|
for (rn->inputlist.Rewind(); rn->inputlist.GetNext(&input); ) {
|
||||||
if (input->source.port == port || input->destination.port == port) {
|
if (input->source.port == port || input->destination.port == port) {
|
||||||
*nodeid = rn->nodeid;
|
*nodeid = rn->nodeid;
|
||||||
TRACE("NodeManager::FindNodeId found input port %ld, node %ld\n", port, *nodeid);
|
TRACE("NodeManager::FindNodeId found input port %ld, node %ld\n", port, *nodeid);
|
||||||
@@ -270,7 +270,7 @@ NodeManager::GetLiveNodeInfo(live_node_info *live_info, const media_node &node)
|
|||||||
{
|
{
|
||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
for (int32 i = 0; fRegisteredNodeMap->GetPointerAt(i, &rn); i++) {
|
for (fRegisteredNodeMap->Rewind(); fRegisteredNodeMap->GetNext(&rn); ) {
|
||||||
if (rn->nodeid == node.node) {
|
if (rn->nodeid == node.node) {
|
||||||
ASSERT(node.port == rn->port);
|
ASSERT(node.port == rn->port);
|
||||||
ASSERT(node.kind == rn->kinds);
|
ASSERT(node.kind == rn->kinds);
|
||||||
@@ -292,7 +292,7 @@ NodeManager::GetInstances(media_node_id *node_ids, int32* count, int32 maxcount,
|
|||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
*count = 0;
|
*count = 0;
|
||||||
for (int32 i = 0; (maxcount > 0) && fRegisteredNodeMap->GetPointerAt(i, &rn); i++) {
|
for (fRegisteredNodeMap->Rewind(); (maxcount > 0) && fRegisteredNodeMap->GetNext(&rn); ) {
|
||||||
if (rn->addon_id == addon_id && rn->addon_flavor_id == addon_flavor_id) {
|
if (rn->addon_id == addon_id && rn->addon_flavor_id == addon_flavor_id) {
|
||||||
node_ids[*count] = rn->nodeid;
|
node_ids[*count] = rn->nodeid;
|
||||||
*count += 1;
|
*count += 1;
|
||||||
@@ -321,7 +321,7 @@ NodeManager::GetLiveNodes(Stack<live_node_info> *livenodes, int32 maxcount, cons
|
|||||||
} else
|
} else
|
||||||
namelen = 0;
|
namelen = 0;
|
||||||
|
|
||||||
for (int32 index = 0; (maxcount > 0) && fRegisteredNodeMap->GetPointerAt(index, &rn); index++) {
|
for (fRegisteredNodeMap->Rewind(); (maxcount > 0) && fRegisteredNodeMap->GetNext(&rn); ) {
|
||||||
if ((rn->kinds & require_kinds) != require_kinds)
|
if ((rn->kinds & require_kinds) != require_kinds)
|
||||||
continue;
|
continue;
|
||||||
if (namelen) {
|
if (namelen) {
|
||||||
@@ -331,7 +331,7 @@ NodeManager::GetLiveNodes(Stack<live_node_info> *livenodes, int32 maxcount, cons
|
|||||||
if (inputformat) {
|
if (inputformat) {
|
||||||
bool hasit = false;
|
bool hasit = false;
|
||||||
media_input *input;
|
media_input *input;
|
||||||
for (int32 j = 0; rn->inputlist.GetPointerAt(j, &input); j++) {
|
for (rn->inputlist.Rewind(); rn->inputlist.GetNext(&input); ) {
|
||||||
if (format_is_compatible(*inputformat, input->format)) {
|
if (format_is_compatible(*inputformat, input->format)) {
|
||||||
hasit = true;
|
hasit = true;
|
||||||
break;
|
break;
|
||||||
@@ -343,7 +343,7 @@ NodeManager::GetLiveNodes(Stack<live_node_info> *livenodes, int32 maxcount, cons
|
|||||||
if (outputformat) {
|
if (outputformat) {
|
||||||
bool hasit = false;
|
bool hasit = false;
|
||||||
media_output *output;
|
media_output *output;
|
||||||
for (int32 j = 0; rn->outputlist.GetPointerAt(j, &output); j++) {
|
for (rn->outputlist.Rewind(); rn->outputlist.GetNext(&output); ) {
|
||||||
if (format_is_compatible(*outputformat, output->format)) {
|
if (format_is_compatible(*outputformat, output->format)) {
|
||||||
hasit = true;
|
hasit = true;
|
||||||
break;
|
break;
|
||||||
@@ -374,7 +374,7 @@ NodeManager::GetDormantNodeInfo(dormant_node_info *node_info, const media_node &
|
|||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
// XXX not sure if this is correct
|
// XXX not sure if this is correct
|
||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
for (int32 i = 0; fRegisteredNodeMap->GetPointerAt(i, &rn); i++) {
|
for (fRegisteredNodeMap->Rewind(); fRegisteredNodeMap->GetNext(&rn); ) {
|
||||||
if (rn->nodeid == node.node) {
|
if (rn->nodeid == node.node) {
|
||||||
ASSERT(node.port == rn->port);
|
ASSERT(node.port == rn->port);
|
||||||
ASSERT(node.kind == rn->kinds);
|
ASSERT(node.kind == rn->kinds);
|
||||||
@@ -398,8 +398,9 @@ NodeManager::GetLiveNodes(BMessage *msg)
|
|||||||
{
|
{
|
||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
registered_node *rn;
|
registered_node *rn;
|
||||||
for (int32 i = 0; fRegisteredNodeMap->GetPointerAt(i, &rn); i++)
|
for (fRegisteredNodeMap->Rewind(); fRegisteredNodeMap->GetNext(&rn); ) {
|
||||||
msg->AddInt32("media_node_id", rn->nodeid);
|
msg->AddInt32("media_node_id", rn->nodeid);
|
||||||
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +442,14 @@ status_t
|
|||||||
NodeManager::GetAddonRef(entry_ref *ref, media_addon_id id)
|
NodeManager::GetAddonRef(entry_ref *ref, media_addon_id id)
|
||||||
{
|
{
|
||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
return fAddonPathMap->Get(id, ref) ? B_OK : B_ERROR;
|
entry_ref *tempref;
|
||||||
|
|
||||||
|
if (fAddonPathMap->Get(id, &tempref)) {
|
||||||
|
*ref = *tempref;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
@@ -455,8 +463,7 @@ NodeManager::GetDormantNodes(dormant_node_info * out_info,
|
|||||||
{
|
{
|
||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
int32 maxcount;
|
int32 maxcount;
|
||||||
int32 index;
|
dormant_flavor_info *dfi;
|
||||||
dormant_flavor_info dfi;
|
|
||||||
int namelen;
|
int namelen;
|
||||||
|
|
||||||
// determine the count of byte to compare when checking for a name with(out) wildcard
|
// determine the count of byte to compare when checking for a name with(out) wildcard
|
||||||
@@ -471,19 +478,19 @@ NodeManager::GetDormantNodes(dormant_node_info * out_info,
|
|||||||
|
|
||||||
maxcount = *io_count;
|
maxcount = *io_count;
|
||||||
*io_count = 0;
|
*io_count = 0;
|
||||||
for (index = 0; (*io_count < maxcount) && fDormantFlavorList->GetAt(index, &dfi); index++) {
|
for (fDormantFlavorList->Rewind(); (*io_count < maxcount) && fDormantFlavorList->GetNext(&dfi); ) {
|
||||||
if ((dfi.kinds & require_kinds) != require_kinds)
|
if ((dfi->kinds & require_kinds) != require_kinds)
|
||||||
continue;
|
continue;
|
||||||
if ((dfi.kinds & deny_kinds) != 0)
|
if ((dfi->kinds & deny_kinds) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (namelen) {
|
if (namelen) {
|
||||||
if (0 != memcmp(name, dfi.name, namelen))
|
if (0 != memcmp(name, dfi->name, namelen))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (has_input) {
|
if (has_input) {
|
||||||
bool hasit = false;
|
bool hasit = false;
|
||||||
for (int32 i = 0; i < dfi.in_format_count; i++)
|
for (int32 i = 0; i < dfi->in_format_count; i++)
|
||||||
if (format_is_compatible(*has_input, dfi.in_formats[i])) {
|
if (format_is_compatible(*has_input, dfi->in_formats[i])) {
|
||||||
hasit = true;
|
hasit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -492,8 +499,8 @@ NodeManager::GetDormantNodes(dormant_node_info * out_info,
|
|||||||
}
|
}
|
||||||
if (has_output) {
|
if (has_output) {
|
||||||
bool hasit = false;
|
bool hasit = false;
|
||||||
for (int32 i = 0; i < dfi.out_format_count; i++)
|
for (int32 i = 0; i < dfi->out_format_count; i++)
|
||||||
if (format_is_compatible(*has_output, dfi.out_formats[i])) {
|
if (format_is_compatible(*has_output, dfi->out_formats[i])) {
|
||||||
hasit = true;
|
hasit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -501,7 +508,7 @@ NodeManager::GetDormantNodes(dormant_node_info * out_info,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_info[*io_count] = dfi.node_info;
|
out_info[*io_count] = dfi->node_info;
|
||||||
*io_count += 1;
|
*io_count += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,9 +521,12 @@ NodeManager::GetDormantFlavorInfoFor(media_addon_id addon,
|
|||||||
dormant_flavor_info *outFlavor)
|
dormant_flavor_info *outFlavor)
|
||||||
{
|
{
|
||||||
BAutolock lock(fLocker);
|
BAutolock lock(fLocker);
|
||||||
for (int32 index = 0; fDormantFlavorList->GetAt(index, outFlavor); index++) {
|
dormant_flavor_info *flavor;
|
||||||
if (outFlavor->node_info.addon == addon && outFlavor->node_info.flavor_id == flavor_id)
|
for (fDormantFlavorList->Rewind(); fDormantFlavorList->GetNext(&flavor); ) {
|
||||||
|
if (flavor->node_info.addon == addon && flavor->node_info.flavor_id == flavor_id) {
|
||||||
|
*outFlavor = *flavor;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,22 +110,21 @@ NotificationManager::CancelNotifications(BMessage *msg)
|
|||||||
|
|
||||||
fLocker->Lock();
|
fLocker->Lock();
|
||||||
|
|
||||||
Notification n;
|
Notification *n;
|
||||||
for (int32 index = 0; fNotificationList->GetAt(index, &n); index++) {
|
for (fNotificationList->Rewind(); fNotificationList->GetNext(&n); ) {
|
||||||
bool remove;
|
bool remove;
|
||||||
if (what == B_MEDIA_WILDCARD && *node == media_node::null && team == n.team && messenger == n.messenger)
|
if (what == B_MEDIA_WILDCARD && *node == media_node::null && team == n->team && messenger == n->messenger)
|
||||||
remove = true;
|
remove = true;
|
||||||
else if (what != B_MEDIA_WILDCARD && *node == media_node::null && what == n.what && team == n.team && messenger == n.messenger)
|
else if (what != B_MEDIA_WILDCARD && *node == media_node::null && what == n->what && team == n->team && messenger == n->messenger)
|
||||||
remove = true;
|
remove = true;
|
||||||
else if (what == B_MEDIA_WILDCARD && *node != media_node::null && team == n.team && messenger == n.messenger && n.node == *node)
|
else if (what == B_MEDIA_WILDCARD && *node != media_node::null && team == n->team && messenger == n->messenger && n->node == *node)
|
||||||
remove = true;
|
remove = true;
|
||||||
else if (what != B_MEDIA_WILDCARD && *node != media_node::null && what == n.what && team == n.team && messenger == n.messenger && n.node == *node)
|
else if (what != B_MEDIA_WILDCARD && *node != media_node::null && what == n->what && team == n->team && messenger == n->messenger && n->node == *node)
|
||||||
remove = true;
|
remove = true;
|
||||||
else
|
else
|
||||||
remove = false;
|
remove = false;
|
||||||
if (remove) {
|
if (remove) {
|
||||||
if (fNotificationList->Remove(index)) {
|
if (fNotificationList->RemoveCurrent()) {
|
||||||
index--;
|
|
||||||
} else {
|
} else {
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
@@ -152,9 +151,9 @@ NotificationManager::SendNotifications(BMessage *msg)
|
|||||||
|
|
||||||
fLocker->Lock();
|
fLocker->Lock();
|
||||||
|
|
||||||
Notification n;
|
Notification *n;
|
||||||
for (int32 index = 0; fNotificationList->GetAt(index, &n); index++) {
|
for (fNotificationList->Rewind(); fNotificationList->GetNext(&n); ) {
|
||||||
if (n.what != B_MEDIA_WILDCARD && n.what != what)
|
if (n->what != B_MEDIA_WILDCARD && n->what != what)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (what) {
|
switch (what) {
|
||||||
@@ -167,7 +166,7 @@ NotificationManager::SendNotifications(BMessage *msg)
|
|||||||
case B_MEDIA_TRANSPORT_STATE:
|
case B_MEDIA_TRANSPORT_STATE:
|
||||||
case B_MEDIA_DEFAULT_CHANGED:
|
case B_MEDIA_DEFAULT_CHANGED:
|
||||||
case B_MEDIA_FLAVORS_CHANGED:
|
case B_MEDIA_FLAVORS_CHANGED:
|
||||||
if (n.node != media_node::null)
|
if (n->node != media_node::null)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -177,7 +176,7 @@ NotificationManager::SendNotifications(BMessage *msg)
|
|||||||
case B_MEDIA_WEB_CHANGED:
|
case B_MEDIA_WEB_CHANGED:
|
||||||
msg->FindData("node", B_RAW_TYPE, reinterpret_cast<const void **>(&node), &size);
|
msg->FindData("node", B_RAW_TYPE, reinterpret_cast<const void **>(&node), &size);
|
||||||
ASSERT(size == sizeof(media_node));
|
ASSERT(size == sizeof(media_node));
|
||||||
if (n.node != *node)
|
if (n->node != *node)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -186,13 +185,13 @@ NotificationManager::SendNotifications(BMessage *msg)
|
|||||||
ASSERT(size == sizeof(media_source));
|
ASSERT(size == sizeof(media_source));
|
||||||
msg->FindData("destination", B_RAW_TYPE, reinterpret_cast<const void **>(&destination), &size);
|
msg->FindData("destination", B_RAW_TYPE, reinterpret_cast<const void **>(&destination), &size);
|
||||||
ASSERT(size == sizeof(media_destination));
|
ASSERT(size == sizeof(media_destination));
|
||||||
if (n.node.port != source->port && n.node.port != destination->port)
|
if (n->node.port != source->port && n->node.port != destination->port)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("NotificationManager::SendNotifications sending\n");
|
TRACE("NotificationManager::SendNotifications sending\n");
|
||||||
n.messenger.SendMessage(msg, static_cast<BHandler *>(NULL), TIMEOUT);
|
n->messenger.SendMessage(msg, static_cast<BHandler *>(NULL), TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
fLocker->Unlock();
|
fLocker->Unlock();
|
||||||
@@ -205,12 +204,11 @@ NotificationManager::CleanupTeam(team_id team)
|
|||||||
fLocker->Lock();
|
fLocker->Lock();
|
||||||
|
|
||||||
int debugcount = 0;
|
int debugcount = 0;
|
||||||
Notification n;
|
Notification *n;
|
||||||
for (int32 index = 0; fNotificationList->GetAt(index, &n); index++) {
|
for (fNotificationList->Rewind(); fNotificationList->GetNext(&n); ) {
|
||||||
if (n.team == team) {
|
if (n->team == team) {
|
||||||
if (fNotificationList->Remove(index)) {
|
if (fNotificationList->RemoveCurrent()) {
|
||||||
debugcount++;
|
debugcount++;
|
||||||
index--;
|
|
||||||
} else {
|
} else {
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user