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

Commit 816e8010 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents e7bf377d 5bed83be
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ static const InputEventLabel KEYCODES[] = {
    DEFINE_KEYCODE(ALL_APPS),
    DEFINE_KEYCODE(REFRESH),

    { NULL, 0 }
    { nullptr, 0 }
};

static const InputEventLabel AXES[] = {
@@ -375,7 +375,7 @@ static const InputEventLabel AXES[] = {

    // NOTE: If you add a new axis here you must also add it to several other files.
    //       Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.
    { NULL, 0 }
    { nullptr, 0 }
};

static const InputEventLabel LEDS[] = {
@@ -396,7 +396,7 @@ static const InputEventLabel LEDS[] = {
    DEFINE_LED(CONTROLLER_4),

    // NOTE: If you add new LEDs here, you must also add them to Input.h
    { NULL, 0 }
    { nullptr, 0 }
};

static const InputEventLabel FLAGS[] = {
@@ -404,7 +404,7 @@ static const InputEventLabel FLAGS[] = {
    DEFINE_FLAG(FUNCTION),
    DEFINE_FLAG(GESTURE),

    { NULL, 0 }
    { nullptr, 0 }
};

static int lookupValueByLabel(const char* literal, const InputEventLabel *list) {
@@ -424,7 +424,7 @@ static const char* lookupLabelByValue(int value, const InputEventLabel* list) {
        }
        list++;
    }
    return NULL;
    return nullptr;
}

static inline int32_t getKeyCodeByLabel(const char* label) {
@@ -435,7 +435,7 @@ static inline const char* getLabelByKeyCode(int32_t keyCode) {
    if (keyCode >= 0 && keyCode < static_cast<int32_t>(size(KEYCODES))) {
        return KEYCODES[keyCode].literal;
    }
    return NULL;
    return nullptr;
}

static inline uint32_t getKeyFlagByLabel(const char* label) {
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public:

    // Creates a velocity tracker using the specified strategy.
    // If strategy is NULL, uses the default strategy for the platform.
    VelocityTracker(const char* strategy = NULL);
    VelocityTracker(const char* strategy = nullptr);

    ~VelocityTracker();

+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ const InputDeviceInfo::MotionRange* InputDeviceInfo::getMotionRange(
            return &range;
        }
    }
    return NULL;
    return nullptr;
}

void InputDeviceInfo::addSource(uint32_t source) {
+4 −4
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ status_t InputChannel::receiveMessage(InputMessage* msg) {

sp<InputChannel> InputChannel::dup() const {
    int fd = ::dup(getFd());
    return fd >= 0 ? new InputChannel(getName(), fd) : NULL;
    return fd >= 0 ? new InputChannel(getName(), fd) : nullptr;
}


@@ -388,7 +388,7 @@ InputConsumer::~InputConsumer() {

bool InputConsumer::isTouchResamplingEnabled() {
    char value[PROPERTY_VALUE_MAX];
    int length = property_get("ro.input.noresample", value, NULL);
    int length = property_get("ro.input.noresample", value, nullptr);
    if (length > 0) {
        if (!strcmp("1", value)) {
            return false;
@@ -409,7 +409,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory,
#endif

    *outSeq = 0;
    *outEvent = NULL;
    *outEvent = nullptr;

    // Fetch the next input message.
    // Loop until an event can be returned or no additional events are received.
@@ -544,7 +544,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory,
        const InputMessage* next;
        if (batch.samples.isEmpty()) {
            mBatches.removeAt(i);
            next = NULL;
            next = nullptr;
        } else {
            next = &batch.samples.itemAt(0);
        }
+14 −14
Original line number Diff line number Diff line
@@ -164,10 +164,10 @@ status_t KeyCharacterMap::load(Tokenizer* tokenizer,

sp<KeyCharacterMap> KeyCharacterMap::combine(const sp<KeyCharacterMap>& base,
        const sp<KeyCharacterMap>& overlay) {
    if (overlay == NULL) {
    if (overlay == nullptr) {
        return base;
    }
    if (base == NULL) {
    if (base == nullptr) {
        return overlay;
    }

@@ -468,7 +468,7 @@ bool KeyCharacterMap::findKey(char16_t ch, int32_t* outKeyCode, int32_t* outMeta

        // Try to find the most general behavior that maps to this character.
        // For example, the base key behavior will usually be last in the list.
        const Behavior* found = NULL;
        const Behavior* found = nullptr;
        for (const Behavior* behavior = key->firstBehavior; behavior; behavior = behavior->next) {
            if (behavior->character == ch) {
                found = behavior;
@@ -605,11 +605,11 @@ sp<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) {
    map->mType = parcel->readInt32();
    size_t numKeys = parcel->readInt32();
    if (parcel->errorCheck()) {
        return NULL;
        return nullptr;
    }
    if (numKeys > MAX_KEYS) {
        ALOGE("Too many keys in KeyCharacterMap (%zu > %d)", numKeys, MAX_KEYS);
        return NULL;
        return nullptr;
    }

    for (size_t i = 0; i < numKeys; i++) {
@@ -617,7 +617,7 @@ sp<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) {
        char16_t label = parcel->readInt32();
        char16_t number = parcel->readInt32();
        if (parcel->errorCheck()) {
            return NULL;
            return nullptr;
        }

        Key* key = new Key();
@@ -625,14 +625,14 @@ sp<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) {
        key->number = number;
        map->mKeys.add(keyCode, key);

        Behavior* lastBehavior = NULL;
        Behavior* lastBehavior = nullptr;
        while (parcel->readInt32()) {
            int32_t metaState = parcel->readInt32();
            char16_t character = parcel->readInt32();
            int32_t fallbackKeyCode = parcel->readInt32();
            int32_t replacementKeyCode = parcel->readInt32();
            if (parcel->errorCheck()) {
                return NULL;
                return nullptr;
            }

            Behavior* behavior = new Behavior();
@@ -649,7 +649,7 @@ sp<KeyCharacterMap> KeyCharacterMap::readFromParcel(Parcel* parcel) {
        }

        if (parcel->errorCheck()) {
            return NULL;
            return nullptr;
        }
    }
    return map;
@@ -666,7 +666,7 @@ void KeyCharacterMap::writeToParcel(Parcel* parcel) const {
        parcel->writeInt32(keyCode);
        parcel->writeInt32(key->label);
        parcel->writeInt32(key->number);
        for (const Behavior* behavior = key->firstBehavior; behavior != NULL;
        for (const Behavior* behavior = key->firstBehavior; behavior != nullptr;
                behavior = behavior->next) {
            parcel->writeInt32(1);
            parcel->writeInt32(behavior->metaState);
@@ -683,12 +683,12 @@ void KeyCharacterMap::writeToParcel(Parcel* parcel) const {
// --- KeyCharacterMap::Key ---

KeyCharacterMap::Key::Key() :
        label(0), number(0), firstBehavior(NULL) {
        label(0), number(0), firstBehavior(nullptr) {
}

KeyCharacterMap::Key::Key(const Key& other) :
        label(other.label), number(other.number),
        firstBehavior(other.firstBehavior ? new Behavior(*other.firstBehavior) : NULL) {
        firstBehavior(other.firstBehavior ? new Behavior(*other.firstBehavior) : nullptr) {
}

KeyCharacterMap::Key::~Key() {
@@ -704,11 +704,11 @@ KeyCharacterMap::Key::~Key() {
// --- KeyCharacterMap::Behavior ---

KeyCharacterMap::Behavior::Behavior() :
        next(NULL), metaState(0), character(0), fallbackKeyCode(0), replacementKeyCode(0) {
        next(nullptr), metaState(0), character(0), fallbackKeyCode(0), replacementKeyCode(0) {
}

KeyCharacterMap::Behavior::Behavior(const Behavior& other) :
        next(other.next ? new Behavior(*other.next) : NULL),
        next(other.next ? new Behavior(*other.next) : nullptr),
        metaState(other.metaState), character(other.character),
        fallbackKeyCode(other.fallbackKeyCode),
        replacementKeyCode(other.replacementKeyCode) {
Loading