Clean up constructors

And, use C++ style casts and use float math functions rather than double ones to save memory space.

Also, stop using FloatMath and NativeUtils as standard Math methods are faster now.
See http://code.google.com/p/android/issues/detail?id=36199 and https://android-review.googlesource.com/40700

multi-project commit with I4259fb5ab8a15ac5760a7f04fc8f4c860529f04a

Change-Id: I0b81cff8c91769f7559a59b9528c75a5aabb4211
diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h
index b550ba4..3b55e5d 100644
--- a/native/jni/src/dictionary.h
+++ b/native/jni/src/dictionary.h
@@ -55,8 +55,12 @@
 
     int getFrequency(const int32_t *word, int length) const;
     bool isValidBigram(const int32_t *word1, int length1, const int32_t *word2, int length2) const;
-    void *getDict() const { return (void *)mDict; } // required to release dictionary buffer
-    void *getOffsetDict() const { return (void *)mOffsetDict; }
+    void *getDict() const { // required to release dictionary buffer
+        return reinterpret_cast<void *>(const_cast<unsigned char *>(mDict));
+    }
+    void *getOffsetDict() const {
+        return reinterpret_cast<void *>(const_cast<unsigned char *>(mOffsetDict));
+    }
     int getDictSize() const { return mDictSize; }
     int getMmapFd() const { return mMmapFd; }
     int getDictBufAdjust() const { return mDictBufAdjust; }
@@ -87,8 +91,9 @@
 inline int Dictionary::wideStrLen(unsigned short *str) {
     if (!str) return 0;
     unsigned short *end = str;
-    while (*end)
+    while (*end) {
         end++;
+    }
     return end - str;
 }
 } // namespace latinime