aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2011-07-08 00:49:20 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-08 00:49:20 -0700
commit10912baf60b66af3459dea13cd8da73c0f7955c0 (patch)
tree2833b4d46b6b804d9f880951a1019589a0c2eed7
parenta9f69513dfc9fa31b517326191f611bb9be5f888 (diff)
parentce9efbff53ba04bd719c3c15d8a5a501ff12714f (diff)
downloadlatinime-10912baf60b66af3459dea13cd8da73c0f7955c0.tar.gz
latinime-10912baf60b66af3459dea13cd8da73c0f7955c0.tar.xz
latinime-10912baf60b66af3459dea13cd8da73c0f7955c0.zip
Merge "Compile code used in logging conditionally so that gcc does not complain about unused-but-set variables."
-rw-r--r--native/src/bigram_dictionary.cpp2
-rw-r--r--native/src/unigram_dictionary.cpp8
2 files changed, 10 insertions, 0 deletions
diff --git a/native/src/bigram_dictionary.cpp b/native/src/bigram_dictionary.cpp
index 11e6dc250..d11aee28e 100644
--- a/native/src/bigram_dictionary.cpp
+++ b/native/src/bigram_dictionary.cpp
@@ -42,8 +42,10 @@ BigramDictionary::~BigramDictionary() {
bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequency) {
word[length] = 0;
if (DEBUG_DICT) {
+#ifdef FLAG_DBG
char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i];
+#endif
LOGI("Bigram: Found word = %s, freq = %d :", s, frequency);
}
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp
index 290e9f997..42951bf7a 100644
--- a/native/src/unigram_dictionary.cpp
+++ b/native/src/unigram_dictionary.cpp
@@ -155,9 +155,11 @@ int UnigramDictionary::getSuggestions(const ProximityInfo *proximityInfo, const
LOGI("Returning %d words", suggestedWordsCount);
/// Print the returned words
for (int j = 0; j < suggestedWordsCount; ++j) {
+#ifdef FLAG_DBG
short unsigned int* w = mOutputChars + j * MAX_WORD_LENGTH;
char s[MAX_WORD_LENGTH];
for (int i = 0; i <= MAX_WORD_LENGTH; i++) s[i] = w[i];
+#endif
LOGI("%s %i", s, mFrequencies[j]);
}
LOGI("Next letters: ");
@@ -283,8 +285,10 @@ static inline void registerNextLetter(unsigned short c, int *nextLetters, int ne
bool UnigramDictionary::addWord(unsigned short *word, int length, int frequency) {
word[length] = 0;
if (DEBUG_DICT && DEBUG_SHOW_FOUND_WORD) {
+#ifdef FLAG_DBG
char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i];
+#endif
LOGI("Found word = %s, freq = %d", s, frequency);
}
if (length > MAX_WORD_LENGTH) {
@@ -305,8 +309,10 @@ bool UnigramDictionary::addWord(unsigned short *word, int length, int frequency)
}
if (insertAt < MAX_WORDS) {
if (DEBUG_DICT) {
+#ifdef FLAG_DBG
char s[length + 1];
for (int i = 0; i <= length; i++) s[i] = word[i];
+#endif
LOGI("Added word = %s, freq = %d, %d", s, frequency, S_INT_MAX);
}
memmove((char*) mFrequencies + (insertAt + 1) * sizeof(mFrequencies[0]),
@@ -788,9 +794,11 @@ inline int UnigramDictionary::getMostFrequentWordLike(const int startInputIndex,
if (newFreq > maxFreq) {
for (int i = 0; i < inputLength; ++i) word[i] = newWord[i];
if (DEBUG_DICT && DEBUG_NODE) {
+#ifdef FLAG_DBG
char s[inputLength + 1];
for (int i = 0; i < inputLength; ++i) s[i] = word[i];
s[inputLength] = 0;
+#endif
LOGI("New missing space word found: %d > %d (%s), %d, %d",
newFreq, maxFreq, s, inputLength, depth);
}