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

Commit 54b603ee authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge changes Iea2a3055,I6582cfc6

am: 45562bfb

Change-Id: Ic1e986c5554bcb191b025afec41fc051f9714574
parents b526c2f7 45562bfb
Loading
Loading
Loading
Loading
+17 −6
Original line number Original line Diff line number Diff line
@@ -72,8 +72,17 @@ cc_defaults {
                "-DUNICODE=1",
                "-DUNICODE=1",
                "-D_UNICODE=1",
                "-D_UNICODE=1",


                // -std=gnu++14 doesn't set _GNU_SOURCE on Windows.
                // -std=gnu++11 doesn't set _GNU_SOURCE on Windows.
                "-D_GNU_SOURCE",
                "-D_GNU_SOURCE",

                // MinGW hides some things behind _POSIX_SOURCE.
                "-D_POSIX_SOURCE",
            ],

            host_ldlibs: [
                "-lws2_32",
                "-lgdi32",
                "-luserenv",
            ],
            ],
        },
        },
    },
    },
@@ -173,6 +182,13 @@ cc_test_host {
        "libdiagnose_usb",
        "libdiagnose_usb",
        "libusb",
        "libusb",
    ],
    ],

    target: {
        windows: {
            enabled: true,
            shared_libs: ["AdbWinApi"],
        },
    },
}
}


cc_binary_host {
cc_binary_host {
@@ -220,11 +236,6 @@ cc_binary_host {
        windows: {
        windows: {
            enabled: true,
            enabled: true,
            ldflags: ["-municode"],
            ldflags: ["-municode"],
            host_ldlibs: [
                "-lws2_32",
                "-lgdi32",
            ],

            shared_libs: ["AdbWinApi"],
            shared_libs: ["AdbWinApi"],
            required: [
            required: [
                "AdbWinUsbApi",
                "AdbWinUsbApi",
+1 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@


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


class FdHandler {
class FdHandler {
  public:
  public:
+10 −14
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ extern int adb_creat(const char* path, int mode);
extern int adb_read(int fd, void* buf, int len);
extern int adb_read(int fd, void* buf, int len);
extern int adb_write(int fd, const 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_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_close(int fd);
extern int adb_register_socket(SOCKET s);
extern int adb_register_socket(SOCKET s);


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


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

#undef   shutdown
#undef   shutdown
#define  shutdown   ____xxx_shutdown
#define  shutdown   ____xxx_shutdown


+4 −5
Original line number Original line 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);
    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__);
    FH f = _fh_from_int(fd, __func__);


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


    D("adb_shutdown: %s", f->name);
    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();
        const DWORD err = WSAGetLastError();
        D("socket shutdown fd %d failed: %s", fd,
        D("socket shutdown fd %d failed: %s", fd,
          android::base::SystemErrorCodeToString(err).c_str());
          android::base::SystemErrorCodeToString(err).c_str());