diff options
author | Elliott Hughes <enh@google.com> | 2015-04-10 23:41:15 +0200 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-04-10 23:41:15 +0200 |
commit | a90ba39beb8762f5a1f21b03f2734acda4fb03b1 (patch) | |
tree | 194576dea44fa1489e187e0c681401f96cad8a2d /minadbd/services.cpp | |
parent | am 23017c5d: Merge "Switch minui over to C++." (diff) | |
parent | Merge "Switch minadb over to C++." (diff) | |
download | android_bootable_recovery-a90ba39beb8762f5a1f21b03f2734acda4fb03b1.tar android_bootable_recovery-a90ba39beb8762f5a1f21b03f2734acda4fb03b1.tar.gz android_bootable_recovery-a90ba39beb8762f5a1f21b03f2734acda4fb03b1.tar.bz2 android_bootable_recovery-a90ba39beb8762f5a1f21b03f2734acda4fb03b1.tar.lz android_bootable_recovery-a90ba39beb8762f5a1f21b03f2734acda4fb03b1.tar.xz android_bootable_recovery-a90ba39beb8762f5a1f21b03f2734acda4fb03b1.tar.zst android_bootable_recovery-a90ba39beb8762f5a1f21b03f2734acda4fb03b1.zip |
Diffstat (limited to '')
-rw-r--r-- | minadbd/services.cpp (renamed from minadbd/services.c) | 22 |
1 files changed, 8 insertions, 14 deletions
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)) { |