8000 added proper includes and updated build script... almost there · boxer/android-database-sqlcipher@64f51ad · GitHub
[go: up one dir, main page]

Skip to content

Commit 64f51ad

Browse files
committed
added proper includes and updated build script... almost there
1 parent aee54fc commit 64f51ad

File tree

4 files changed

+48
-29
lines changed

4 files changed

+48
-29
lines changed

jni/Android.mk

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,22 @@ LOCAL_SRC_FILES:= \
2323
info_guardianproject_database_sqlcipher_SQLiteDatabase.cpp \
2424
info_guardianproject_database_sqlcipher_SQLiteProgram.cpp \
2525
info_guardianproject_database_sqlcipher_SQLiteQuery.cpp \
26-
info_guardianproject_database_sqlcipher_SQLiteStatement.cpp
26+
info_guardianproject_database_sqlcipher_SQLiteStatement.cpp \
27+
info_guardianproject_database_CursorWindow.cpp \
28+
CursorWindow.cpp
2729
# info_guardianproject_database_sqlcipher_SQLiteDebug.cpp
2830

2931
LOCAL_C_INCLUDES += \
3032
$(JNI_H_INCLUDE) \
31-
$(LOCAL_PATH)/include \
3233
$(EXTERNAL_PATH)/sqlcipher \
33-
$(EXTERNAL_PATH)/dalvik/libnativehelper/include \
34-
$(EXTERNAL_PATH)/dalvik/libnativehelper/include/nativehelper \
3534
$(EXTERNAL_PATH)/openssl/include \
3635
$(EXTERNAL_PATH)/platform-frameworks-base/include \
3736
$(EXTERNAL_PATH)/platform-frameworks-base/core/jni \
37+
$(EXTERNAL_PATH)/android-sqlite/android \
38+
$(EXTERNAL_PATH)/dalvik/libnativehelper/include \
39+
$(EXTERNAL_PATH)/dalvik/libnativehelper/include/nativehelper \
3840
$(EXTERNAL_PATH)/platform-system-core/include \
39-
$(EXTERNAL_PATH)/android-sqlite/android
41+
#$(LOCAL_PATH)/include \
4042
4143
LOCAL_SHARED_LIBRARIES := \
4244
libcrypto \

jni/CursorWindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ CursorWindow::CursorWindow(size_t maxSize) :
3838
{
3939
}
4040

41-
bool CursorWindow::setMemory(const sp<IMemory>& memory)
41+
bool CursorWindow::setMemory(const android::sp<android::IMemory>& memory)
4242
{
4343
mMemory = memory;
4444
mData = (uint8_t *) memory->pointer();
@@ -60,10 +60,10 @@ bool CursorWindow::initBuffer(bool localOnly)
6060
{
6161
//TODO Use a non-memory dealer mmap region for localOnly
6262

63-
sp<MemoryHeapBase> heap;
64-
heap = new MemoryHeapBase(mMaxSize, 0, "CursorWindow");
63+
android::sp<android::MemoryHeapBase> heap;
64+
heap = new android::MemoryHeapBase(mMaxSize, 0, "CursorWindow");
6565
if (heap != NULL) {
66-
mMemory = new MemoryBase(heap, 0, mMaxSize);
66+
mMemory = new android::MemoryBase(heap, 0, mMaxSize);
6767
if (mMemory != NULL) {
6868
mData = (uint8_t *) mMemory->pointer();
6969
if (mData) {

jni/include/utils/Log.h

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
1-
/*
2-
* The internal Android code uses LOGV, LOGD, LOGI, LOGW, LOGW, etc for
3-
* logging debug stuff. These are not exposed externally, so we need to define
4-
* them ourselves. This is even how its done in the Android NDK sample apps.
5-
* hans@eds.org
1+
/*
2+
* Copyright (C) 2005 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
615
*/
7-
#ifndef LOG_HACK_H
8-
#define LOG_HACK_H
916

10-
# include <android/log.h>
11-
# define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__)
12-
# define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG ,LOG_TAG,__VA_ARGS__)
13-
# define LOGI(...) __android_log_print(ANDROID_LOG_INFO ,LOG_TAG,__VA_ARGS__)
14-
# define LOGW(...) __android_log_print(ANDROID_LOG_WARN ,LOG_TAG,__VA_ARGS__)
15-
# define LOGE(...) __android_log_print(ANDROID_LOG_ERROR ,LOG_TAG,__VA_ARGS__)
17+
//
18+
// C/C++ logging functions. See the logging documentation for API details.
19+
//
20+
// We'd like these to be available from C code (in case we import some from
21+
// somewhere), so this has a C interface.
22+
//
23+
// The output will be correct when the log file is shared between multiple
24+
// threads and/or multiple processes so long as the operating system
25+
// supports O_APPEND. These calls have mutex-protected data structures
26+
// and so are NOT reentrant. Do not use LOG in a signal handler.
27+
//
28+
#ifndef _LIBS_UTILS_LOG_H
29+
#define _LIBS_UTILS_LOG_H
1630

17-
#endif /* LOG_HACK_H */
31+
#include <cutils/log.h>
32+
33+
#endif // _LIBS_UTILS_LOG_H

jni/info_guardianproject_database_CursorWindow.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ LOG_WINDOW("native_init_empty: window = %p", window);
7373

7474
static void native_init_memory(JNIEnv * env, jobject object, jobject memObj)
7575
{
76-
sp<IMemory> memory = interface_cast<IMemory>(ibinderForJavaObject(env, memObj));
76+
android::sp<android::IMemory> memory = android::interface_cast<android::IMemory>(android::ibinderForJavaObject(env, memObj));
77+
7778
if (memory == NULL) {
7879
jniThrowException(env, "java/lang/IllegalStateException", "Couldn't get native B41A binder");
7980
return;
@@ -98,9 +99,9 @@ static jobject native_getBinder(JNIEnv * env, jobject object)
9899
{
99100
CursorWindow * window = GET_WINDOW(env, object);
100101
if (window) {
101-
sp<IMemory> memory = window->getMemory();
102+
android::sp<android::IMemory> memory = window->getMemory();
102103
if (memory != NULL) {
103-
sp<IBinder> binder = memory->asBinder();
104+
android::sp<android::IBinder> binder = memory->asBinder();
104105
return javaObjectForIBinder(env, binder);
105106
}
106107
}
@@ -307,7 +308,7 @@ LOG_WINDOW("Getting string for %d,%d from %p", row, column, window);
307308
if (size > 0) {
308309
#if WINDOW_STORAGE_UTF8
309310
// Pass size - 1 since the UTF8 is null terminated and we don't want a null terminator on the UTF16 string
310-
String16 utf16((char const *)window->offsetToPtr(field.data.buffer.offset), size - 1);
311+
android::String16 utf16((char const *)window->offsetToPtr(field.data.buffer.offset), size - 1);
311312
return env->NewString((jchar const *)utf16.string(), utf16.size());
312313
#else
313314
return env->NewString((jchar const *)window->offsetToPtr(field.data.buffer.offset), size / 2);
@@ -388,7 +389,7 @@ LOG_WINDOW("Copying string for %d,%d from %p", row, column, window);
388389
if (size > 0) {
389390
#if WINDOW_STORAGE_UTF8
390391
// Pass size - 1 since the UTF8 is null terminated and we don't want a null terminator on the UTF16 string
391-
String16 utf16((char const *)window->offsetToPtr(field.data.buffer.offset), size - 1);
392+
android::String16 utf16((char const *)window->offsetToPtr(field.data.buffer.offset), size - 1);
392393
int32_t strSize = utf16.size();
393394
if (strSize > bufferSize || dst == NULL) {
394395
newArray = env->NewCharArray(strSize);
@@ -717,7 +718,7 @@ int register_android_database_CursorWindow(JNIEnv * env)
717718
return -1;
718719
}
719720

720-
return AndroidRuntime::registerNativeMethods(env, "info/guardianproject/database/CursorWindow",
721+
return android::AndroidRuntime::registerNativeMethods(env, "info/guardianproject/database/CursorWindow",
721722
sMethods, NELEM(sMethods));
722723
}
723724

0 commit comments

Comments
 (0)
0