Author: axeld Date: 2011-06-09 21:52:49 +0200 (Thu, 09 Jun 2011) New Revision: 42076 Changeset: https://dev.haiku-os.org/changeset/42076 Modified: haiku/trunk/src/kits/app/Messenger.cpp Log: * Minor coding style cleanup. Modified: haiku/trunk/src/kits/app/Messenger.cpp =================================================================== --- haiku/trunk/src/kits/app/Messenger.cpp 2011-06-09 19:39:26 UTC (rev 42075) +++ haiku/trunk/src/kits/app/Messenger.cpp 2011-06-09 19:52:49 UTC (rev 42076) @@ -182,7 +182,7 @@ BMessenger::Target(BLooper** _looper) const { BHandler *handler = NULL; - if (IsTargetLocal() + if (IsTargetLocal() && (fHandlerToken > B_NULL_TOKEN || fHandlerToken == B_PREFERRED_TOKEN)) { gDefaultTokens.GetToken(fHandlerToken, B_HANDLER_TOKEN, @@ -212,13 +212,12 @@ { BLooper *looper = NULL; Target(&looper); - if (looper && looper->Lock()) { + if (looper != NULL && looper->Lock()) { if (looper->fMsgPort == fPort) return true; - else { - looper->Unlock(); - return false; - } + + looper->Unlock(); + return false; } return false; @@ -243,10 +242,11 @@ { BLooper *looper = NULL; Target(&looper); - status_t error = looper ? B_OK : B_BAD_VALUE; - if (error == B_OK) - error = looper->LockWithTimeout(timeout); - + if (looper == NULL) + return B_BAD_VALUE; + + status_t error = looper->LockWithTimeout(timeout); + if (error == B_OK && looper->fMsgPort != fPort) { looper->Unlock(); return B_BAD_PORT_ID; @@ -258,7 +258,7 @@ // #pragma mark - Message sending -// SendMessage + /*! \brief Delivers a BMessage synchronously to the messenger's target, without waiting for a reply. @@ -266,7 +266,7 @@ space becomes available in the port. After delivery the method returns immediately. It does not wait until the target processes the message or even sends a reply. - + \param command The what field of the message to deliver. \param replyTo The handler to which a reply to the message shall be sent. May be \c NULL. @@ -282,7 +282,7 @@ return SendMessage(&message, replyTo); } -// SendMessage + /*! \brief Delivers a BMessage synchronously to the messenger's target, without waiting for a reply. @@ -309,19 +309,19 @@ */ status_t BMessenger::SendMessage(BMessage *message, BHandler *replyTo, - bigtime_t timeout) const + bigtime_t timeout) const { -DBG(OUT("BMessenger::SendMessage2(%.4s)\n", (char*)&message->what)); + DBG(OUT("BMessenger::SendMessage2(%.4s)\n", (char*)&message->what)); status_t error = (message ? B_OK : B_BAD_VALUE); if (error == B_OK) { BMessenger replyMessenger(replyTo); error = SendMessage(message, replyMessenger, timeout); } -DBG(OUT("BMessenger::SendMessage2() done: %lx\n", error)); + DBG(OUT("BMessenger::SendMessage2() done: %lx\n", error)); return error; } -// SendMessage + /*! \brief Delivers a BMessage synchronously to the messenger's target, without waiting for a reply. @@ -347,7 +347,7 @@ */ status_t BMessenger::SendMessage(BMessage *message, BMessenger replyTo, - bigtime_t timeout) const + bigtime_t timeout) const { if (!message) return B_BAD_VALUE; @@ -356,7 +356,7 @@ timeout, false, replyTo); } -// SendMessage + /*! \brief Delivers a BMessage synchronously to the messenger's target and waits for a reply. @@ -380,7 +380,7 @@ return SendMessage(&message, reply); } -// SendMessage + /*! \brief Delivers a BMessage synchronously to the messenger's target and waits for a reply. @@ -606,4 +606,3 @@ { return !(a == b); } -