summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-04-17 04:37:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-17 04:37:47 +0000
commita4802ca08bfcbf0124f5e9b959ed4e3a198d5f46 (patch)
treebe2e6f2712512af4a4c76451e3c0829df8004087 /adb
parentc4f8fa7b36a8ba397f1c0ad3c7fb5a5c09520272 (diff)
parent7447dd05bdc12b87687c49ee7ecf0fe50d8ab17a (diff)
downloadcore-a4802ca08bfcbf0124f5e9b959ed4e3a198d5f46.tar.gz
core-a4802ca08bfcbf0124f5e9b959ed4e3a198d5f46.tar.bz2
core-a4802ca08bfcbf0124f5e9b959ed4e3a198d5f46.zip
Merge "Move usb_osx to C++."
Diffstat (limited to 'adb')
-rw-r--r--adb/Android.mk2
-rw-r--r--adb/usb_osx.cpp (renamed from adb/usb_osx.c)19
2 files changed, 11 insertions, 10 deletions
diff --git a/adb/Android.mk b/adb/Android.mk
index 96612e6f2..7d3978b1c 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -35,7 +35,7 @@ LIBADB_CFLAGS := \
LIBADB_darwin_SRC_FILES := \
fdevent.cpp \
get_my_path_darwin.cpp \
- usb_osx.c \
+ usb_osx.cpp \
LIBADB_linux_SRC_FILES := \
fdevent.cpp \
diff --git a/adb/usb_osx.c b/adb/usb_osx.cpp
index 94c8cfe7e..303ae4575 100644
--- a/adb/usb_osx.c
+++ b/adb/usb_osx.cpp
@@ -26,6 +26,7 @@
#include <IOKit/IOMessage.h>
#include <mach/mach_port.h>
+#include <inttypes.h>
#include <stdio.h>
#include "adb.h"
@@ -111,7 +112,7 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator)
HRESULT result;
SInt32 score;
UInt32 locationId;
- UInt8 class, subclass, protocol;
+ UInt8 if_class, subclass, protocol;
UInt16 vendor;
UInt16 product;
UInt8 serialIndex;
@@ -132,9 +133,9 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator)
}
//* This gets us the interface object
- result = (*plugInInterface)->QueryInterface(plugInInterface,
- CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID), (LPVOID)
- &iface);
+ result = (*plugInInterface)->QueryInterface(
+ plugInInterface,
+ CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID), (LPVOID*)&iface);
//* We only needed the plugin to get the interface, so discard it
(*plugInInterface)->Release(plugInInterface);
if (result || !iface) {
@@ -142,12 +143,12 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator)
continue;
}
- kr = (*iface)->GetInterfaceClass(iface, &class);
+ kr = (*iface)->GetInterfaceClass(iface, &if_class);
kr = (*iface)->GetInterfaceSubClass(iface, &subclass);
kr = (*iface)->GetInterfaceProtocol(iface, &protocol);
- if(class != ADB_CLASS || subclass != ADB_SUBCLASS || protocol != ADB_PROTOCOL) {
+ if(if_class != ADB_CLASS || subclass != ADB_SUBCLASS || protocol != ADB_PROTOCOL) {
// Ignore non-ADB devices.
- DBG("Ignoring interface with incorrect class/subclass/protocol - %d, %d, %d\n", class, subclass, protocol);
+ DBG("Ignoring interface with incorrect class/subclass/protocol - %d, %d, %d\n", if_class, subclass, protocol);
(*iface)->Release(iface);
continue;
}
@@ -177,7 +178,7 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator)
}
result = (*plugInInterface)->QueryInterface(plugInInterface,
- CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID) &dev);
+ CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID*)&dev);
//* only needed this to query the plugin
(*plugInInterface)->Release(plugInInterface);
if (result || !dev) {
@@ -334,7 +335,7 @@ CheckInterface(IOUSBInterfaceInterface **interface, UInt16 vendor, UInt16 produc
interfaceSubClass, interfaceProtocol))
goto err_bad_adb_interface;
- handle = calloc(1, sizeof(usb_handle));
+ handle = reinterpret_cast<usb_handle*>(calloc(1, sizeof(usb_handle)));
//* Iterate over the endpoints for this interface and find the first
//* bulk in/out pipes available. These will be our read/write pipes.