diff options
author | Jay Shrauner <shrauner@google.com> | 2013-02-15 16:13:29 -0800 |
---|---|---|
committer | Jay Shrauner <shrauner@google.com> | 2013-02-25 11:09:02 -0800 |
commit | db9ae4b068589d2157c1c2d4c45c3873d9203ef0 (patch) | |
tree | 229f263a437d368adea9c40bac2c8c831d79c222 /android/sqlite3_android.cpp | |
parent | 090e844bce774c78ca80d396a12f9bbd140642f6 (diff) |
Remove GET_PHONEBOOK_INDEX callback
Remove sqlite GET_PHONEBOOK_INDEX callback.
Bug:
Change-Id: I751bb4fdff89af1eccc4b21b67fddd0b802eeb61
Diffstat (limited to 'android/sqlite3_android.cpp')
-rw-r--r-- | android/sqlite3_android.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/android/sqlite3_android.cpp b/android/sqlite3_android.cpp index fe826fd..de8bb22 100644 --- a/android/sqlite3_android.cpp +++ b/android/sqlite3_android.cpp @@ -29,7 +29,6 @@ #include "sqlite3_android.h" #include "PhoneNumberUtils.h" -#include "PhonebookIndex.h" #define ENABLE_ANDROID_LOG 0 #define SMALL_BUFFER_SIZE 10 @@ -74,53 +73,6 @@ static int collate8(void *p, int n1, const void *v1, int n2, const void *v2) } } -/** - * Obtains the first UNICODE letter from the supplied string, normalizes and returns it. - */ -static void get_phonebook_index( - sqlite3_context * context, int argc, sqlite3_value ** argv) -{ - if (argc != 2) { - sqlite3_result_null(context); - return; - } - - char const * src = (char const *)sqlite3_value_text(argv[0]); - char const * locale = (char const *)sqlite3_value_text(argv[1]); - if (src == NULL || src[0] == 0 || locale == NULL) { - sqlite3_result_null(context); - return; - } - - UCharIterator iter; - uiter_setUTF8(&iter, src, -1); - - UBool isError = FALSE; - UChar index[SMALL_BUFFER_SIZE]; - uint32_t len = android::GetPhonebookIndex(&iter, locale, index, sizeof(index), &isError); - if (isError) { - sqlite3_result_null(context); - return; - } - - uint32_t outlen = 0; - uint8_t out[SMALL_BUFFER_SIZE]; - for (uint32_t i = 0; i < len; i++) { - U8_APPEND(out, outlen, sizeof(out), index[i], isError); - if (isError) { - sqlite3_result_null(context); - return; - } - } - - if (outlen == 0) { - sqlite3_result_null(context); - return; - } - - sqlite3_result_text(context, (const char*)out, outlen, SQLITE_TRANSIENT); -} - static void phone_numbers_equal(sqlite3_context * context, int argc, sqlite3_value ** argv) { if (argc != 2 && argc != 3) { @@ -599,16 +551,6 @@ extern "C" int register_android_functions(sqlite3 * handle, int utf16Storage) } #endif - // Register the GET_PHONEBOOK_INDEX function - err = sqlite3_create_function(handle, - "GET_PHONEBOOK_INDEX", - 2, SQLITE_UTF8, NULL, - get_phonebook_index, - NULL, NULL); - if (err != SQLITE_OK) { - return err; - } - // Register the _PHONE_NUMBER_STRIPPED_REVERSED function, which imitates // PhoneNumberUtils.getStrippedReversed. This function is not public API, // it is only used for compatibility with Android 1.6 and earlier. |