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

Commit a63b3309 authored by Yi Kong's avatar Yi Kong Committed by Gerrit Code Review
Browse files

Merge "[adb] Modernize codebase by replacing NULL with nullptr"

parents ab3203f3 aed415cc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -415,7 +415,7 @@ void handle_packet(apacket *p, atransport *t)
        if (t->online && p->msg.arg0 != 0 && p->msg.arg1 != 0) {
            asocket* s = find_local_socket(p->msg.arg1, 0);
            if (s) {
                if(s->peer == 0) {
                if(s->peer == nullptr) {
                    /* On first READY message, create the connection. */
                    s->peer = create_remote_socket(p->msg.arg0, t);
                    s->peer->peer = s;
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ bool ReadProtocolString(int fd, std::string* s, std::string* error) {
    }
    buf[4] = 0;

    unsigned long len = strtoul(buf, 0, 16);
    unsigned long len = strtoul(buf, nullptr, 16);
    s->resize(len, '\0');
    if (!ReadFdExactly(fd, &(*s)[0], len)) {
        *error = perror_str("protocol fault (couldn't read status message)");
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
#include "sysdeps/chrono.h"

static TransportType __adb_transport = kTransportAny;
static const char* __adb_serial = NULL;
static const char* __adb_serial = nullptr;
static TransportId __adb_transport_id = 0;

static const char* __adb_server_socket_spec;
+4 −4
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ static int generate_key(const std::string& file) {
    LOG(INFO) << "generate_key(" << file << ")...";

    mode_t old_mask;
    FILE *f = NULL;
    FILE *f = nullptr;
    int ret = 0;

    EVP_PKEY* pkey = EVP_PKEY_new();
@@ -121,7 +121,7 @@ static int generate_key(const std::string& file) {
    }

    BN_set_word(exponent, RSA_F4);
    RSA_generate_key_ex(rsa, 2048, exponent, NULL);
    RSA_generate_key_ex(rsa, 2048, exponent, nullptr);
    EVP_PKEY_set1_RSA(pkey, rsa);

    old_mask = umask(077);
@@ -135,7 +135,7 @@ static int generate_key(const std::string& file) {

    umask(old_mask);

    if (!PEM_write_PrivateKey(f, pkey, NULL, NULL, 0, NULL, NULL)) {
    if (!PEM_write_PrivateKey(f, pkey, nullptr, nullptr, 0, nullptr, nullptr)) {
        D("Failed to write key");
        goto out;
    }
@@ -302,7 +302,7 @@ std::deque<std::shared_ptr<RSA>> adb_auth_get_private_keys() {
static std::string adb_auth_sign(RSA* key, const char* token, size_t token_size) {
    if (token_size != TOKEN_SIZE) {
        D("Unexpected token size %zd", token_size);
        return 0;
        return nullptr;
    }

    std::string result;
+4 −4
Original line number Diff line number Diff line
@@ -885,7 +885,7 @@ static int adb_sideload_host(const char* filename) {
            return 0;
        }

        int block = strtol(buf, NULL, 10);
        int block = strtol(buf, nullptr, 10);

        size_t offset = block * SIDELOAD_HOST_BLOCK_SIZE;
        if (offset >= static_cast<size_t>(sb.st_size)) {
@@ -968,7 +968,7 @@ static int ppp(int argc, const char** argv) {
            //argv[2] and beyond become ppp_args[1] and beyond
            ppp_args[i - 1] = argv[i];
        }
        ppp_args[i-1] = NULL;
        ppp_args[i-1] = nullptr;

        // child side

@@ -1174,7 +1174,7 @@ static int backup(int argc, const char** argv) {
                argv[i++] = argv[j++];
            }
            argc -= 2;
            argv[argc] = NULL;
            argv[argc] = nullptr;
        }
    }

@@ -1969,7 +1969,7 @@ static int install_multiple_app(int argc, const char** argv) {
        char* end = strrchr(buf, ']');
        if (start && end) {
            *end = '\0';
            session_id = strtol(start + 1, NULL, 10);
            session_id = strtol(start + 1, nullptr, 10);
        }
    }
    if (session_id < 0) {
Loading