Remove variables never used

This commit is contained in:
Micke Prag 2012-11-08 10:13:59 +01:00
parent c3bcd64246
commit fd8fdfcacd
3 changed files with 12 additions and 16 deletions

View file

@ -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);

View file

@ -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<PrivateData*> (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;

View file

@ -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;