From fd8fdfcacd49a3b5470c53b5717caaf2cd9fd19a Mon Sep 17 00:00:00 2001 From: Micke Prag Date: Thu, 8 Nov 2012 10:13:59 +0100 Subject: [PATCH] Remove variables never used --- .../service/ConnectionListener_unix.cpp | 2 -- .../service/ControllerListener_mac.cpp | 23 ++++++++----------- telldus-core/service/Timer.cpp | 3 ++- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/telldus-core/service/ConnectionListener_unix.cpp b/telldus-core/service/ConnectionListener_unix.cpp index 78d3911a..3ea0a55e 100644 --- a/telldus-core/service/ConnectionListener_unix.cpp +++ b/telldus-core/service/ConnectionListener_unix.cpp @@ -47,7 +47,6 @@ void ConnectionListener::run() { SOCKET_T serverSocket; struct sockaddr_un name; - socklen_t len; serverSocket = socket(PF_LOCAL, SOCK_STREAM, 0); if (serverSocket < 0) { return; @@ -62,7 +61,6 @@ void ConnectionListener::run() { // Change permissions to allow everyone chmod(d->name.c_str(), S_IRWXU | S_IRWXG | S_IRWXO); - len = sizeof(struct sockaddr_un); fd_set infds; FD_ZERO(&infds); diff --git a/telldus-core/service/ControllerListener_mac.cpp b/telldus-core/service/ControllerListener_mac.cpp index 1843474c..b309343d 100644 --- a/telldus-core/service/ControllerListener_mac.cpp +++ b/telldus-core/service/ControllerListener_mac.cpp @@ -74,7 +74,6 @@ void ControllerListener::run() { void ControllerListener::PrivateData::addUsbFilter(int vid, int pid) { CFNumberRef numberRef; - kern_return_t kr; CFMutableDictionaryRef matchingDict; matchingDict = IOServiceMatching(kIOUSBDeviceClassName); // Interested in instances of class @@ -94,19 +93,18 @@ void ControllerListener::PrivateData::addUsbFilter(int vid, int pid) { CFRelease(numberRef); // Now set up a notification to be called when a device is first matched by I/O Kit. - kr = IOServiceAddMatchingNotification(gNotifyPort, // notifyPort - kIOFirstMatchNotification, // notificationType - matchingDict, // matching - PrivateData::DeviceAdded, // callback - this, // refCon - &gAddedIter // notification - ); + IOServiceAddMatchingNotification(gNotifyPort, // notifyPort + kIOFirstMatchNotification, // notificationType + matchingDict, // matching + PrivateData::DeviceAdded, // callback + this, // refCon + &gAddedIter // notification + ); // Iterate once to get already-present devices and arm the notification PrivateData::DeviceAdded(this, gAddedIter); } void ControllerListener::PrivateData::DeviceNotification(void *refCon, io_service_t service, natural_t messageType, void *messageArgument) { - kern_return_t kr; if (messageType != kIOMessageServiceIsTerminated) { return; @@ -132,14 +130,13 @@ void ControllerListener::PrivateData::DeviceNotification(void *refCon, io_servic // Free the data we're no longer using now that the device is going away CFRelease(tsd->serialNumber); - kr = IOObjectRelease(tsd->notification); + IOObjectRelease(tsd->notification); delete tsd; } void ControllerListener::PrivateData::DeviceAdded(void *refCon, io_iterator_t iterator) { io_service_t usbDevice; - kern_return_t kr; PrivateData *pd = reinterpret_cast (refCon); @@ -172,7 +169,7 @@ void ControllerListener::PrivateData::DeviceAdded(void *refCon, io_iterator_t it // Register for an interest notification of this device being removed. Use a reference to our // private data as the refCon which will be passed to the notification callback. - kr = IOServiceAddInterestNotification(pd->gNotifyPort, usbDevice, kIOGeneralInterest, DeviceNotification, tsd, &(tsd->notification)); + IOServiceAddInterestNotification(pd->gNotifyPort, usbDevice, kIOGeneralInterest, DeviceNotification, tsd, &(tsd->notification)); CFIndex size = CFStringGetLength(serialNumberAsCFString); char *s = new char[size+1]; @@ -180,7 +177,7 @@ void ControllerListener::PrivateData::DeviceAdded(void *refCon, io_iterator_t it std::string serial(s); // Copy the string to the stack delete[] s; - kr = IOObjectRelease(usbDevice); + IOObjectRelease(usbDevice); ControllerChangeEventData *data = new ControllerChangeEventData; data->vid = tsd->vid; diff --git a/telldus-core/service/Timer.cpp b/telldus-core/service/Timer.cpp index 758881e3..bcce9b17 100644 --- a/telldus-core/service/Timer.cpp +++ b/telldus-core/service/Timer.cpp @@ -97,7 +97,8 @@ void Timer::run() { pthread_mutex_unlock(&d->waitMutex); while(1) { - int rc = gettimeofday(&tp, NULL); + int rc = 0; + gettimeofday(&tp, NULL); ts.tv_sec = tp.tv_sec; ts.tv_nsec = tp.tv_usec * 1000;