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

Commit c894071b authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by Android (Google) Code Review
Browse files

Merge "Use memmove for all place src and dest can be same."

parents 6e15af26 3e0777e7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ namespace latinime {
        actualLength0 = i + 1;
    }
    actualLength0 = min(actualLength0, MAX_WORD_LENGTH);
    memcpy(dest, src0, actualLength0 * sizeof(dest[0]));
    memmove(dest, src0, actualLength0 * sizeof(dest[0]));
    if (!src1 || length1 == 0) {
        return actualLength0;
    }
@@ -130,7 +130,7 @@ namespace latinime {
        actualLength1 = i + 1;
    }
    actualLength1 = min(actualLength1, MAX_WORD_LENGTH - actualLength0);
    memcpy(&dest[actualLength0], src1, actualLength1 * sizeof(dest[0]));
    memmove(&dest[actualLength0], src1, actualLength1 * sizeof(dest[0]));
    return actualLength0 + actualLength1;
}
} // namespace latinime
+3 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#ifndef LATINIME_DIC_NODE_STATE_OUTPUT_H
#define LATINIME_DIC_NODE_STATE_OUTPUT_H

#include <cstring> // for memcpy()
#include <cstring> // for memmove()
#include <stdint.h>

#include "defines.h"
@@ -38,7 +38,7 @@ class DicNodeStateOutput {
    }

    void init(const DicNodeStateOutput *const stateOutput) {
        memcpy(mCodePointsBuf, stateOutput->mCodePointsBuf,
        memmove(mCodePointsBuf, stateOutput->mCodePointsBuf,
                stateOutput->mOutputtedCodePointCount * sizeof(mCodePointsBuf[0]));
        mOutputtedCodePointCount = stateOutput->mOutputtedCodePointCount;
        if (mOutputtedCodePointCount < MAX_WORD_LENGTH) {
@@ -51,7 +51,7 @@ class DicNodeStateOutput {
        if (mergedNodeCodePoints) {
            const int additionalCodePointCount = min(static_cast<int>(mergedNodeCodePointCount),
                    MAX_WORD_LENGTH - mOutputtedCodePointCount);
            memcpy(&mCodePointsBuf[mOutputtedCodePointCount], mergedNodeCodePoints,
            memmove(&mCodePointsBuf[mOutputtedCodePointCount], mergedNodeCodePoints,
                    additionalCodePointCount * sizeof(mCodePointsBuf[0]));
            mOutputtedCodePointCount = static_cast<uint16_t>(
                    mOutputtedCodePointCount + mergedNodeCodePointCount);
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#ifndef LATINIME_DIC_NODE_STATE_PREVWORD_H
#define LATINIME_DIC_NODE_STATE_PREVWORD_H

#include <cstring> // for memset()
#include <cstring> // for memset() and memmove()
#include <stdint.h>

#include "defines.h"
@@ -62,7 +62,7 @@ class DicNodeStatePrevWord {
        mPrevWordProbability = prevWord->mPrevWordProbability;
        mPrevWordPtNodePos = prevWord->mPrevWordPtNodePos;
        mSecondWordFirstInputIndex = prevWord->mSecondWordFirstInputIndex;
        memcpy(mPrevWord, prevWord->mPrevWord, prevWord->mPrevWordLength * sizeof(mPrevWord[0]));
        memmove(mPrevWord, prevWord->mPrevWord, prevWord->mPrevWordLength * sizeof(mPrevWord[0]));
    }

    void init(const int16_t prevWordCount, const int16_t prevWordProbability,
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

#include "suggest/core/layout/proximity_info_state.h"

#include <cstring> // for memset() and memcpy()
#include <cstring> // for memset() and memmove()
#include <sstream> // for debug prints
#include <vector>

@@ -285,7 +285,7 @@ float ProximityInfoState::getDirection(const int index0, const int index1) const
}

float ProximityInfoState::getMostProbableString(int *const codePointBuf) const {
    memcpy(codePointBuf, mMostProbableString, sizeof(mMostProbableString));
    memmove(codePointBuf, mMostProbableString, sizeof(mMostProbableString));
    return mMostProbableStringProbability;
}