Loading adb/jdwp_service.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -453,7 +453,7 @@ static void jdwp_control_event(int s, unsigned events, void* _control) { **/ struct JdwpSocket : public asocket { bool pass; bool pass = false; }; static void jdwp_socket_close(asocket* s) { Loading @@ -467,7 +467,7 @@ static void jdwp_socket_close(asocket* s) { } remove_socket(s); free(s); delete s; } static int jdwp_socket_enqueue(asocket* s, std::string) { Loading Loading @@ -497,7 +497,7 @@ static void jdwp_socket_ready(asocket* s) { } asocket* create_jdwp_service_socket(void) { JdwpSocket* s = reinterpret_cast<JdwpSocket*>(calloc(sizeof(*s), 1)); JdwpSocket* s = new JdwpSocket(); if (!s) { fatal("failed to allocate JdwpSocket"); Loading adb/socket.h +12 −12 Original line number Diff line number Diff line Loading @@ -36,31 +36,31 @@ class atransport; struct asocket { /* the unique identifier for this asocket */ unsigned id; unsigned id = 0; /* flag: set when the socket's peer has closed * but packets are still queued for delivery */ int closing; int closing = 0; // flag: set when the socket failed to write, so the socket will not wait to // write packets and close directly. bool has_write_error; bool has_write_error = 0; /* flag: quit adbd when both ends close the * local service socket */ int exit_on_close; int exit_on_close = 0; // the asocket we are connected to asocket* peer; asocket* peer = nullptr; /* For local asockets, the fde is used to bind * us to our fd event system. For remote asockets * these fields are not used. */ fdevent fde; int fd; fdevent fde = {0}; int fd = 0; // queue of data waiting to be written std::deque<Range> packet_queue; Loading @@ -73,27 +73,27 @@ struct asocket { * peer->ready() when we once again are ready to * receive data. */ int (*enqueue)(asocket* s, std::string data); int (*enqueue)(asocket* s, std::string data) = nullptr; /* ready is called by the peer when it is ready for * us to send data via enqueue again */ void (*ready)(asocket* s); void (*ready)(asocket* s) = nullptr; /* shutdown is called by the peer before it goes away. * the socket should not do any further calls on its peer. * Always followed by a call to close. Optional, i.e. can be NULL. */ void (*shutdown)(asocket* s); void (*shutdown)(asocket* s) = nullptr; /* close is called by the peer when it has gone away. * we are not allowed to make any further calls on the * peer once our close method is called. */ void (*close)(asocket* s); void (*close)(asocket* s) = nullptr; /* A socket is bound to atransport */ atransport* transport; atransport* transport = nullptr; size_t get_max_payload() const; }; Loading adb/sockets.cpp +6 −14 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ static void local_socket_destroy(asocket* s) { fdevent_remove(&s->fde); remove_socket(s); free(s); delete s; if (exit_on_close) { D("local_socket_destroy: exiting"); Loading Loading @@ -347,10 +347,7 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s) { } asocket* create_local_socket(int fd) { asocket* s = reinterpret_cast<asocket*>(calloc(1, sizeof(asocket))); if (s == NULL) { fatal("cannot allocate socket"); } asocket* s = new asocket(); s->fd = fd; s->enqueue = local_socket_enqueue; s->ready = local_socket_ready; Loading Loading @@ -459,7 +456,7 @@ static void remote_socket_close(asocket* s) { D("entered remote_socket_close RS(%d) CLOSE fd=%d peer->fd=%d", s->id, s->fd, s->peer ? s->peer->fd : -1); D("RS(%d): closed", s->id); free(s); delete s; } // Create a remote socket to exchange packets with a remote service through transport Loading @@ -470,11 +467,7 @@ asocket* create_remote_socket(unsigned id, atransport* t) { if (id == 0) { fatal("invalid remote socket id (0)"); } asocket* s = reinterpret_cast<asocket*>(calloc(1, sizeof(asocket))); if (s == NULL) { fatal("cannot allocate socket"); } asocket* s = new asocket(); s->id = id; s->enqueue = remote_socket_enqueue; s->ready = remote_socket_ready; Loading Loading @@ -811,13 +804,12 @@ static void smart_socket_close(asocket* s) { s->peer->close(s->peer); s->peer = 0; } free(s); delete s; } static asocket* create_smart_socket(void) { D("Creating smart socket"); asocket* s = reinterpret_cast<asocket*>(calloc(1, sizeof(asocket))); if (s == NULL) fatal("cannot allocate socket"); asocket* s = new asocket(); s->enqueue = smart_socket_enqueue; s->ready = smart_socket_ready; s->shutdown = NULL; Loading adb/transport.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -378,9 +378,9 @@ static fdevent transport_registration_fde; */ struct device_tracker { asocket socket; bool update_needed; bool long_output; device_tracker* next; bool update_needed = false; bool long_output = false; device_tracker* next = nullptr; }; /* linked list of all device trackers */ Loading Loading @@ -411,7 +411,7 @@ static void device_tracker_close(asocket* socket) { peer->close(peer); } device_tracker_remove(tracker); free(tracker); delete tracker; } static int device_tracker_enqueue(asocket* socket, std::string) { Loading Loading @@ -446,7 +446,7 @@ static void device_tracker_ready(asocket* socket) { } asocket* create_device_tracker(bool long_output) { device_tracker* tracker = reinterpret_cast<device_tracker*>(calloc(1, sizeof(*tracker))); device_tracker* tracker = new device_tracker(); if (tracker == nullptr) fatal("cannot allocate device tracker"); D("device tracker %p created", tracker); Loading Loading
adb/jdwp_service.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -453,7 +453,7 @@ static void jdwp_control_event(int s, unsigned events, void* _control) { **/ struct JdwpSocket : public asocket { bool pass; bool pass = false; }; static void jdwp_socket_close(asocket* s) { Loading @@ -467,7 +467,7 @@ static void jdwp_socket_close(asocket* s) { } remove_socket(s); free(s); delete s; } static int jdwp_socket_enqueue(asocket* s, std::string) { Loading Loading @@ -497,7 +497,7 @@ static void jdwp_socket_ready(asocket* s) { } asocket* create_jdwp_service_socket(void) { JdwpSocket* s = reinterpret_cast<JdwpSocket*>(calloc(sizeof(*s), 1)); JdwpSocket* s = new JdwpSocket(); if (!s) { fatal("failed to allocate JdwpSocket"); Loading
adb/socket.h +12 −12 Original line number Diff line number Diff line Loading @@ -36,31 +36,31 @@ class atransport; struct asocket { /* the unique identifier for this asocket */ unsigned id; unsigned id = 0; /* flag: set when the socket's peer has closed * but packets are still queued for delivery */ int closing; int closing = 0; // flag: set when the socket failed to write, so the socket will not wait to // write packets and close directly. bool has_write_error; bool has_write_error = 0; /* flag: quit adbd when both ends close the * local service socket */ int exit_on_close; int exit_on_close = 0; // the asocket we are connected to asocket* peer; asocket* peer = nullptr; /* For local asockets, the fde is used to bind * us to our fd event system. For remote asockets * these fields are not used. */ fdevent fde; int fd; fdevent fde = {0}; int fd = 0; // queue of data waiting to be written std::deque<Range> packet_queue; Loading @@ -73,27 +73,27 @@ struct asocket { * peer->ready() when we once again are ready to * receive data. */ int (*enqueue)(asocket* s, std::string data); int (*enqueue)(asocket* s, std::string data) = nullptr; /* ready is called by the peer when it is ready for * us to send data via enqueue again */ void (*ready)(asocket* s); void (*ready)(asocket* s) = nullptr; /* shutdown is called by the peer before it goes away. * the socket should not do any further calls on its peer. * Always followed by a call to close. Optional, i.e. can be NULL. */ void (*shutdown)(asocket* s); void (*shutdown)(asocket* s) = nullptr; /* close is called by the peer when it has gone away. * we are not allowed to make any further calls on the * peer once our close method is called. */ void (*close)(asocket* s); void (*close)(asocket* s) = nullptr; /* A socket is bound to atransport */ atransport* transport; atransport* transport = nullptr; size_t get_max_payload() const; }; Loading
adb/sockets.cpp +6 −14 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ static void local_socket_destroy(asocket* s) { fdevent_remove(&s->fde); remove_socket(s); free(s); delete s; if (exit_on_close) { D("local_socket_destroy: exiting"); Loading Loading @@ -347,10 +347,7 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s) { } asocket* create_local_socket(int fd) { asocket* s = reinterpret_cast<asocket*>(calloc(1, sizeof(asocket))); if (s == NULL) { fatal("cannot allocate socket"); } asocket* s = new asocket(); s->fd = fd; s->enqueue = local_socket_enqueue; s->ready = local_socket_ready; Loading Loading @@ -459,7 +456,7 @@ static void remote_socket_close(asocket* s) { D("entered remote_socket_close RS(%d) CLOSE fd=%d peer->fd=%d", s->id, s->fd, s->peer ? s->peer->fd : -1); D("RS(%d): closed", s->id); free(s); delete s; } // Create a remote socket to exchange packets with a remote service through transport Loading @@ -470,11 +467,7 @@ asocket* create_remote_socket(unsigned id, atransport* t) { if (id == 0) { fatal("invalid remote socket id (0)"); } asocket* s = reinterpret_cast<asocket*>(calloc(1, sizeof(asocket))); if (s == NULL) { fatal("cannot allocate socket"); } asocket* s = new asocket(); s->id = id; s->enqueue = remote_socket_enqueue; s->ready = remote_socket_ready; Loading Loading @@ -811,13 +804,12 @@ static void smart_socket_close(asocket* s) { s->peer->close(s->peer); s->peer = 0; } free(s); delete s; } static asocket* create_smart_socket(void) { D("Creating smart socket"); asocket* s = reinterpret_cast<asocket*>(calloc(1, sizeof(asocket))); if (s == NULL) fatal("cannot allocate socket"); asocket* s = new asocket(); s->enqueue = smart_socket_enqueue; s->ready = smart_socket_ready; s->shutdown = NULL; Loading
adb/transport.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -378,9 +378,9 @@ static fdevent transport_registration_fde; */ struct device_tracker { asocket socket; bool update_needed; bool long_output; device_tracker* next; bool update_needed = false; bool long_output = false; device_tracker* next = nullptr; }; /* linked list of all device trackers */ Loading Loading @@ -411,7 +411,7 @@ static void device_tracker_close(asocket* socket) { peer->close(peer); } device_tracker_remove(tracker); free(tracker); delete tracker; } static int device_tracker_enqueue(asocket* socket, std::string) { Loading Loading @@ -446,7 +446,7 @@ static void device_tracker_ready(asocket* socket) { } asocket* create_device_tracker(bool long_output) { device_tracker* tracker = reinterpret_cast<device_tracker*>(calloc(1, sizeof(*tracker))); device_tracker* tracker = new device_tracker(); if (tracker == nullptr) fatal("cannot allocate device tracker"); D("device tracker %p created", tracker); Loading