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

Commit 2549ce27 authored by Ken Wakasa's avatar Ken Wakasa Committed by Android Git Automerger
Browse files

am df2fed2b: Merge "Fix a bug that would end up in memory corruption" into ics-mr0

* commit 'df2fed2b':
  Fix a bug that would end up in memory corruption
parents 9beab79b df2fed2b
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -49,14 +49,17 @@ ProximityInfo::ProximityInfo(const int maxProximityCharsSize, const int keyboard
                  && sweetSpotCenterYs && sweetSpotRadii),
          mInputXCoordinates(NULL), mInputYCoordinates(NULL),
          mTouchPositionCorrectionEnabled(false) {
    const int len = GRID_WIDTH * GRID_HEIGHT * MAX_PROXIMITY_CHARS_SIZE;
    mProximityCharsArray = new uint32_t[len];
    mNormalizedSquaredDistances = new int[len];
    const int proximityGridLength = GRID_WIDTH * GRID_HEIGHT * MAX_PROXIMITY_CHARS_SIZE;
    mProximityCharsArray = new uint32_t[proximityGridLength];
    if (DEBUG_PROXIMITY_INFO) {
        LOGI("Create proximity info array %d", len);
    }
    memcpy(mProximityCharsArray, proximityCharsArray, len * sizeof(mProximityCharsArray[0]));
    for (int i = 0; i < len; ++i) {
        LOGI("Create proximity info array %d", proximityGridLength);
    }
    memcpy(mProximityCharsArray, proximityCharsArray,
            proximityGridLength * sizeof(mProximityCharsArray[0]));
    const int normalizedSquaredDistancesLength =
            MAX_PROXIMITY_CHARS_SIZE * MAX_WORD_LENGTH_INTERNAL;
    mNormalizedSquaredDistances = new int[normalizedSquaredDistancesLength];
    for (int i = 0; i < normalizedSquaredDistancesLength; ++i) {
        mNormalizedSquaredDistances[i] = NOT_A_DISTANCE;
    }