Load main dic in native

Follow up to Id57dce51

bug: 3219819
Change-Id: I00e11ef21d0252ffa88c12dffb9c55b0f2e19a66
diff --git a/native/src/dictionary.cpp b/native/src/dictionary.cpp
index 8d32909..fe33757 100644
--- a/native/src/dictionary.cpp
+++ b/native/src/dictionary.cpp
@@ -23,21 +23,23 @@
 
 namespace latinime {
 
-Dictionary::Dictionary(void *dict, int typedLetterMultiplier, int fullWordMultiplier,
+Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust,
+        int typedLetterMultiplier, int fullWordMultiplier,
         int maxWordLength, int maxWords, int maxAlternatives)
-    : DICT((unsigned char*) dict),
+    : mDict((unsigned char*) dict), mDictSize(dictSize),
+    mMmapFd(mmapFd), mDictBufAdjust(dictBufAdjust),
     // Checks whether it has the latest dictionary or the old dictionary
     IS_LATEST_DICT_VERSION((((unsigned char*) dict)[0] & 0xFF) >= DICTIONARY_VERSION_MIN) {
     if (DEBUG_DICT) {
         if (MAX_WORD_LENGTH_INTERNAL < maxWordLength) {
             LOGI("Max word length (%d) is greater than %d",
                     maxWordLength, MAX_WORD_LENGTH_INTERNAL);
-            LOGI("IN NATIVE SUGGEST Version: %d \n", (DICT[0] & 0xFF));
+            LOGI("IN NATIVE SUGGEST Version: %d", (mDict[0] & 0xFF));
         }
     }
-    mUnigramDictionary = new UnigramDictionary(DICT, typedLetterMultiplier, fullWordMultiplier,
+    mUnigramDictionary = new UnigramDictionary(mDict, typedLetterMultiplier, fullWordMultiplier,
             maxWordLength, maxWords, maxAlternatives, IS_LATEST_DICT_VERSION);
-    mBigramDictionary = new BigramDictionary(DICT, maxWordLength, maxAlternatives,
+    mBigramDictionary = new BigramDictionary(mDict, maxWordLength, maxAlternatives,
             IS_LATEST_DICT_VERSION, hasBigram(), this);
 }
 
@@ -47,7 +49,7 @@
 }
 
 bool Dictionary::hasBigram() {
-    return ((DICT[1] & 0xFF) == 1);
+    return ((mDict[1] & 0xFF) == 1);
 }
 
 // TODO: use uint16_t instead of unsigned short
@@ -64,12 +66,12 @@
     // returns address of bigram data of that word
     // return -99 if not found
 
-    int count = Dictionary::getCount(DICT, &pos);
+    int count = Dictionary::getCount(mDict, &pos);
     unsigned short currentChar = (unsigned short) word[offset];
     for (int j = 0; j < count; j++) {
-        unsigned short c = Dictionary::getChar(DICT, &pos);
-        int terminal = Dictionary::getTerminal(DICT, &pos);
-        int childPos = Dictionary::getAddress(DICT, &pos);
+        unsigned short c = Dictionary::getChar(mDict, &pos);
+        int terminal = Dictionary::getTerminal(mDict, &pos);
+        int childPos = Dictionary::getAddress(mDict, &pos);
         if (c == currentChar) {
             if (offset == length - 1) {
                 if (terminal) {
@@ -85,7 +87,7 @@
             }
         }
         if (terminal) {
-            Dictionary::getFreq(DICT, IS_LATEST_DICT_VERSION, &pos);
+            Dictionary::getFreq(mDict, IS_LATEST_DICT_VERSION, &pos);
         }
         // There could be two instances of each alphabet - upper and lower case. So continue
         // looking ...