Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83ebd8da authored by Josh Gao's avatar Josh Gao
Browse files

adb: fix windows test build.

The switch over to soong unintentionally turned off building the
Windows tests (and there's a bug preventing them from being turned on).
Preemptively fix the build breakages that'll happen when we turn them
back on.

Bug: http://b/74616284
Test: mma with Android.bp 's/cc_test_host/cc_binary_host' hacks
Change-Id: I6582cfc61b96052537d50d8ba90533dbb66e3e1d
(cherry picked from commit 2e1e789e)
parent abb63430
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ ADB_COMMON_darwin_CFLAGS := \
#   CreateFileW(path_wide.c_str());
ADB_COMMON_windows_CFLAGS := \
    -DUNICODE=1 -D_UNICODE=1 \
    -D_POSIX_SOURCE

# libadb
# =========================================================
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

#include "adb_io.h"
#include "fdevent_test.h"
#include "sysdeps/memory.h"

class FdHandler {
  public:
+10 −14
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ extern int adb_creat(const char* path, int mode);
extern int adb_read(int fd, void* buf, int len);
extern int adb_write(int fd, const void* buf, int len);
extern int adb_lseek(int fd, int pos, int where);
extern int  adb_shutdown(int  fd);
extern int adb_shutdown(int fd, int direction = SHUT_RDWR);
extern int adb_close(int fd);
extern int adb_register_socket(SOCKET s);

@@ -419,14 +419,10 @@ static __inline__ int adb_open( const char* pathname, int options )
#undef   open
#define  open    ___xxx_open

static __inline__ int  adb_shutdown(int fd)
{
    return shutdown(fd, SHUT_RDWR);
}
static __inline__ int  adb_shutdown(int fd, int direction)
{
static __inline__ int adb_shutdown(int fd, int direction = SHUT_RDWR) {
    return shutdown(fd, direction);
}

#undef   shutdown
#define  shutdown   ____xxx_shutdown

+4 −5
Original line number Diff line number Diff line
@@ -1011,8 +1011,7 @@ int adb_socket_get_local_port(int fd) {
    return ntohs(reinterpret_cast<sockaddr_in*>(&addr_storage)->sin_port);
}

int  adb_shutdown(int  fd)
{
int adb_shutdown(int fd, int direction) {
    FH f = _fh_from_int(fd, __func__);

    if (!f || f->clazz != &_fh_socket_class) {
@@ -1022,7 +1021,7 @@ int adb_shutdown(int fd)
    }

    D("adb_shutdown: %s", f->name);
    if (shutdown(f->fh_socket, SD_BOTH) == SOCKET_ERROR) {
    if (shutdown(f->fh_socket, direction) == SOCKET_ERROR) {
        const DWORD err = WSAGetLastError();
        D("socket shutdown fd %d failed: %s", fd,
          android::base::SystemErrorCodeToString(err).c_str());