* Improve line breaks in BMediaNode::WaitForMessage() for 80 char width

according to coding style guide.
* Print the error string for read_port_etc() instead of the error code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24501 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-03-21 12:40:46 +00:00
parent 8056f0db19
commit 6b8545a4fe
+41 -20
View File
@@ -364,16 +364,17 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
char data[B_MEDIA_MESSAGE_SIZE]; // about 16 KByte stack used char data[B_MEDIA_MESSAGE_SIZE]; // about 16 KByte stack used
int32 message; int32 message;
ssize_t size; ssize_t size = read_port_etc(ControlPort(), &message, data, sizeof(data),
B_ABSOLUTE_TIMEOUT, waitUntil);
size = read_port_etc(ControlPort(), &message, data, sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil);
if (size < 0) { if (size < 0) {
if (size != B_TIMED_OUT) if ((status_t)size != B_TIMED_OUT)
ERROR("BMediaNode::WaitForMessage: read_port_etc error 0x%08lx\n",size); ERROR("BMediaNode::WaitForMessage: read_port_etc error: %s\n",
return size; // return the error code strerror((status_t)size));
return (status_t)size;
} }
TRACE("BMediaNode::WaitForMessage request is: %#lx, node %ld, this %p\n", message, fNodeID, this); TRACE("BMediaNode::WaitForMessage request is: %#lx, node %ld, this %p\n",
message, fNodeID, this);
if (message > NODE_MESSAGE_START && message < NODE_MESSAGE_END) { if (message > NODE_MESSAGE_START && message < NODE_MESSAGE_END) {
TRACE("BMediaNode::WaitForMessage calling BMediaNode\n"); TRACE("BMediaNode::WaitForMessage calling BMediaNode\n");
@@ -384,41 +385,61 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) { if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) {
if (!fProducerThis) if (!fProducerThis)
fProducerThis = dynamic_cast<BBufferProducer *>(this); fProducerThis = dynamic_cast<BBufferProducer *>(this);
TRACE("BMediaNode::WaitForMessage calling BBufferProducer %p\n", fProducerThis); TRACE("BMediaNode::WaitForMessage calling BBufferProducer %p\n",
if (fProducerThis && B_OK == fProducerThis->BBufferProducer::HandleMessage(message, data, size)) fProducerThis);
if (fProducerThis && fProducerThis->BBufferProducer::HandleMessage(
message, data, size) == B_OK) {
return B_OK; return B_OK;
}
} }
if (message > CONSUMER_MESSAGE_START && message < CONSUMER_MESSAGE_END) { if (message > CONSUMER_MESSAGE_START && message < CONSUMER_MESSAGE_END) {
if (!fConsumerThis) if (!fConsumerThis)
fConsumerThis = dynamic_cast<BBufferConsumer *>(this); fConsumerThis = dynamic_cast<BBufferConsumer *>(this);
TRACE("BMediaNode::WaitForMessage calling BBufferConsumer %p\n", fConsumerThis); TRACE("BMediaNode::WaitForMessage calling BBufferConsumer %p\n",
if (fConsumerThis && B_OK == fConsumerThis->BBufferConsumer::HandleMessage(message, data, size)) fConsumerThis);
if (fConsumerThis && fConsumerThis->BBufferConsumer::HandleMessage(
message, data, size) == B_OK) {
return B_OK; return B_OK;
}
} }
if (message > FILEINTERFACE_MESSAGE_START && message < FILEINTERFACE_MESSAGE_END) { if (message > FILEINTERFACE_MESSAGE_START
&& message < FILEINTERFACE_MESSAGE_END) {
if (!fFileInterfaceThis) if (!fFileInterfaceThis)
fFileInterfaceThis = dynamic_cast<BFileInterface *>(this); fFileInterfaceThis = dynamic_cast<BFileInterface *>(this);
TRACE("BMediaNode::WaitForMessage calling BFileInterface %p\n", fFileInterfaceThis); TRACE("BMediaNode::WaitForMessage calling BFileInterface %p\n",
if (fFileInterfaceThis && B_OK == fFileInterfaceThis->BFileInterface::HandleMessage(message, data, size)) fFileInterfaceThis);
if (fFileInterfaceThis
&& fFileInterfaceThis->BFileInterface::HandleMessage(
message, data, size) == B_OK) {
return B_OK; return B_OK;
}
} }
if (message > CONTROLLABLE_MESSAGE_START && message < CONTROLLABLE_MESSAGE_END) { if (message > CONTROLLABLE_MESSAGE_START
&& message < CONTROLLABLE_MESSAGE_END) {
if (!fControllableThis) if (!fControllableThis)
fControllableThis = dynamic_cast<BControllable *>(this); fControllableThis = dynamic_cast<BControllable *>(this);
TRACE("BMediaNode::WaitForMessage calling BControllable %p\n", fControllableThis); TRACE("BMediaNode::WaitForMessage calling BControllable %p\n",
if (fControllableThis && B_OK == fControllableThis->BControllable::HandleMessage(message, data, size)) fControllableThis);
if (fControllableThis
&& fControllableThis->BControllable::HandleMessage(
message, data, size) == B_OK) {
return B_OK; return B_OK;
}
} }
if (message > TIMESOURCE_MESSAGE_START && message < TIMESOURCE_MESSAGE_END) { if (message > TIMESOURCE_MESSAGE_START
&& message < TIMESOURCE_MESSAGE_END) {
if (!fTimeSourceThis) if (!fTimeSourceThis)
fTimeSourceThis = dynamic_cast<BTimeSource *>(this); fTimeSourceThis = dynamic_cast<BTimeSource *>(this);
TRACE("BMediaNode::WaitForMessage calling BTimeSource %p\n", fTimeSourceThis); TRACE("BMediaNode::WaitForMessage calling BTimeSource %p\n",
if (fTimeSourceThis && B_OK == fTimeSourceThis->BTimeSource::HandleMessage(message, data, size)) fTimeSourceThis);
if (fTimeSourceThis && fTimeSourceThis->BTimeSource::HandleMessage(
message, data, size) == B_OK) {
return B_OK; return B_OK;
}
} }
TRACE("BMediaNode::WaitForMessage calling default HandleMessage\n"); TRACE("BMediaNode::WaitForMessage calling default HandleMessage\n");