summaryrefslogtreecommitdiffstats
path: root/minadbd
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-10 22:59:19 +0200
committerElliott Hughes <enh@google.com>2015-04-10 22:59:19 +0200
commit20531ef60524e6205b1d9a6c12a8335c5d97e311 (patch)
tree194576dea44fa1489e187e0c681401f96cad8a2d /minadbd
parentMerge "Switch minui over to C++." (diff)
downloadandroid_bootable_recovery-20531ef60524e6205b1d9a6c12a8335c5d97e311.tar
android_bootable_recovery-20531ef60524e6205b1d9a6c12a8335c5d97e311.tar.gz
android_bootable_recovery-20531ef60524e6205b1d9a6c12a8335c5d97e311.tar.bz2
android_bootable_recovery-20531ef60524e6205b1d9a6c12a8335c5d97e311.tar.lz
android_bootable_recovery-20531ef60524e6205b1d9a6c12a8335c5d97e311.tar.xz
android_bootable_recovery-20531ef60524e6205b1d9a6c12a8335c5d97e311.tar.zst
android_bootable_recovery-20531ef60524e6205b1d9a6c12a8335c5d97e311.zip
Diffstat (limited to 'minadbd')
-rw-r--r--minadbd/Android.mk6
-rw-r--r--minadbd/adb_main.cpp (renamed from minadbd/adb_main.c)0
-rw-r--r--minadbd/fuse_adb_provider.cpp (renamed from minadbd/fuse_adb_provider.c)0
-rw-r--r--minadbd/fuse_adb_provider.h11
-rw-r--r--minadbd/services.cpp (renamed from minadbd/services.c)22
5 files changed, 12 insertions, 27 deletions
diff --git a/minadbd/Android.mk b/minadbd/Android.mk
index 52d3fa4e4..cbfd76e4e 100644
--- a/minadbd/Android.mk
+++ b/minadbd/Android.mk
@@ -11,9 +11,9 @@ minadbd_cflags := \
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- adb_main.c \
- fuse_adb_provider.c \
- services.c \
+ adb_main.cpp \
+ fuse_adb_provider.cpp \
+ services.cpp \
LOCAL_MODULE := libminadbd
LOCAL_CFLAGS := $(minadbd_cflags)
diff --git a/minadbd/adb_main.c b/minadbd/adb_main.cpp
index f6e240108..f6e240108 100644
--- a/minadbd/adb_main.c
+++ b/minadbd/adb_main.cpp
diff --git a/minadbd/fuse_adb_provider.c b/minadbd/fuse_adb_provider.cpp
index 5da7fd76c..5da7fd76c 100644
--- a/minadbd/fuse_adb_provider.c
+++ b/minadbd/fuse_adb_provider.cpp
diff --git a/minadbd/fuse_adb_provider.h b/minadbd/fuse_adb_provider.h
index b88ce497b..9941709b9 100644
--- a/minadbd/fuse_adb_provider.h
+++ b/minadbd/fuse_adb_provider.h
@@ -19,10 +19,6 @@
#include <stdint.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
struct adb_data {
int sfd; // file descriptor for the adb channel
@@ -30,12 +26,7 @@ struct adb_data {
uint32_t block_size;
};
-int read_block_adb(void* cookie, uint32_t block, uint8_t* buffer,
- uint32_t fetch_size);
+int read_block_adb(void* cookie, uint32_t block, uint8_t* buffer, uint32_t fetch_size);
int run_adb_fuse(int sfd, uint64_t file_size, uint32_t block_size);
-#ifdef __cplusplus
-}
-#endif
-
#endif
diff --git a/minadbd/services.c b/minadbd/services.cpp
index 581d847fc..a83256796 100644
--- a/minadbd/services.c
+++ b/minadbd/services.cpp
@@ -36,19 +36,16 @@ struct stinfo {
void *cookie;
};
-
-void *service_bootstrap_func(void *x)
-{
- stinfo *sti = x;
+void* service_bootstrap_func(void* x) {
+ stinfo* sti = reinterpret_cast<stinfo*>(x);
sti->func(sti->fd, sti->cookie);
free(sti);
return 0;
}
-static void sideload_host_service(int sfd, void* cookie)
-{
+static void sideload_host_service(int sfd, void* cookie) {
char* saveptr;
- const char* s = adb_strtok_r(cookie, ":", &saveptr);
+ const char* s = adb_strtok_r(reinterpret_cast<char*>(cookie), ":", &saveptr);
uint64_t file_size = strtoull(s, NULL, 10);
s = adb_strtok_r(NULL, ":", &saveptr);
uint32_t block_size = strtoul(s, NULL, 10);
@@ -65,22 +62,20 @@ static void sideload_host_service(int sfd, void* cookie)
static int create_service_thread(void (*func)(int, void *), void *cookie)
{
- stinfo *sti;
- adb_thread_t t;
int s[2];
-
if(adb_socketpair(s)) {
printf("cannot create service socket pair\n");
return -1;
}
- sti = malloc(sizeof(stinfo));
+ stinfo* sti = reinterpret_cast<stinfo*>(malloc(sizeof(stinfo)));
if(sti == 0) fatal("cannot allocate stinfo");
sti->func = func;
sti->cookie = cookie;
sti->fd = s[1];
- if(adb_thread_create( &t, service_bootstrap_func, sti)){
+ adb_thread_t t;
+ if (adb_thread_create( &t, service_bootstrap_func, sti)){
free(sti);
adb_close(s[0]);
adb_close(s[1]);
@@ -92,8 +87,7 @@ static int create_service_thread(void (*func)(int, void *), void *cookie)
return s[0];
}
-int service_to_fd(const char *name)
-{
+int service_to_fd(const char* name) {
int ret = -1;
if (!strncmp(name, "sideload:", 9)) {