Author: mmlr Date: 2011-06-05 21:09:04 +0200 (Sun, 05 Jun 2011) New Revision: 41945 Changeset: https://dev.haiku-os.org/changeset/41945 Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp Log: Small cleanup. Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2011-06-05 19:06:49 UTC (rev 41944) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2011-06-05 19:09:04 UTC (rev 41945) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010, Haiku. + * Copyright 2004-2011, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -218,7 +218,7 @@ kMouseThreadPriority, (void*)this); status_t status; - if (fThread < B_OK) + if (fThread < 0) status = fThread; else { fActive = true; @@ -228,7 +228,7 @@ if (status < B_OK) { LOG_ERR("%s: can't spawn/resume watching thread: %s\n", fDeviceRef.name, strerror(status)); - if (fDevice >= B_OK) + if (fDevice >= 0) close(fDevice); return status; @@ -249,7 +249,7 @@ close(fDevice); fDevice = -1; - if (fThread >= B_OK) { + if (fThread >= 0) { // unblock the thread, which might wait on a semaphore. suspend_thread(fThread); resume_thread(fThread); @@ -290,6 +290,8 @@ delete fTouchpadSettingsMessage; fTouchpadSettingsMessage = new BMessage(*message); + if (fTouchpadSettingsMessage == NULL) + return B_NO_MEMORY; return B_OK; } @@ -457,7 +459,7 @@ fTarget.EnqueueMessage(message); } - if ((movements.wheel_ydelta != 0) || (movements.wheel_xdelta != 0)) { + if (movements.wheel_ydelta != 0 || movements.wheel_xdelta != 0) { BMessage* message = new BMessage(B_MOUSE_WHEEL_CHANGED); if (message == NULL) continue; @@ -491,7 +493,7 @@ } else { // In case active is already false, another thread // waits for this thread to quit, and may already hold - // locks that _RemoveDevice() wants to acquire. In another + // locks that _RemoveDevice() wants to acquire. In other // words, the device is already being removed, so we simply // quit here. } @@ -820,7 +822,7 @@ _RemoveDevice(path); MouseDevice* device = new(std::nothrow) MouseDevice(*this, path); - if (!device) { + if (device == NULL) { TRACE("No memory\n"); return B_NO_MEMORY; }