Prepare for 64-Bit-Android.

This commit is contained in:
B. Petersen
2016-09-19 21:30:52 +02:00
parent 7e8a543c35
commit e8284afbfa
4 changed files with 43 additions and 47 deletions
+1 -1
View File
@@ -1619,7 +1619,7 @@ LOCAL_SRC_FILES += \
../../../messenger-backend/src/mrsimplify.c \
../../../messenger-backend/src/mrsqlite3.c \
../../../messenger-backend/src/mrtools.c \
./mr_wrapper.cpp \
./mr_wrapper.c \
./NativeLoader.cpp
include $(BUILD_SHARED_LIBRARY)
-32
View File
@@ -1,32 +0,0 @@
#include <jni.h>
#include "../../../messenger-backend/src/mrmailbox.h"
JNIEXPORT int Java_org_telegram_messenger_MrMailbox_MrMailboxNew(JNIEnv *env, jclass c)
{
return (int)mrmailbox_new();
}
JNIEXPORT int Java_org_telegram_messenger_MrMailbox_MrMailboxDelete(JNIEnv *env, jclass c, int hMailbox)
{
mrmailbox_delete((mrmailbox_t*)hMailbox);
}
JNIEXPORT int Java_org_telegram_messenger_MrMailbox_MrMailboxOpen(JNIEnv *env, jclass c, int hMailbox, jstring dbfile)
{
const char* dbfilePtr = env->GetStringUTFChars(dbfile, 0);
if( dbfilePtr == NULL ) { return 0; }
int ret = mrmailbox_open((mrmailbox_t*)hMailbox, dbfilePtr);
env->ReleaseStringUTFChars(dbfile, dbfilePtr);
return ret;
}
JNIEXPORT void Java_org_telegram_messenger_MrMailbox_MrMailboxClose(JNIEnv *env, jclass c, int hMailbox)
{
mrmailbox_close((mrmailbox_t*)hMailbox);
}
@@ -1,23 +1,51 @@
/*******************************************************************************
*
* Messenger Android Frontend
* Copyright (C) 2016 Björn Petersen Software Design and Development
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
*******************************************************************************
*
* File: MrMailbox.java
* Authors: Björn Petersen
* Purpose: The Java part of the Java<->C Wrapper, see also mr_wrapper.c
*
******************************************************************************/
package org.telegram.messenger;
/**
* Created by bpetersen on 14.09.16.
*/
public class MrMailbox {
int dummy = 3; // just a counter that can be increased to force recompiling
// work with mailboxes
public native static int MrMailboxNew (); // returns hMailbox (Names as mrmailbox_new don't work due to the additional underscore)
public native static void MrMailboxDelete (int hMailbox);
public native static int MrMailboxOpen (int hMailbox, String dbfile);
public native static void MrMailboxClose (int hMailbox);
public native static int MrMailboxGetChats (int hMailbox); // returns hChatlist
public native static long MrMailboxNew (); // returns hMailbox (Names as mrmailbox_new don't work due to the additional underscore)
public native static void MrMailboxDelete (long hMailbox);
public native static int MrMailboxOpen (long hMailbox, String dbfile);
public native static void MrMailboxClose (long hMailbox);
public native static long MrMailboxGetChats (long hMailbox); // returns hChatlist
// working with chatlists
public native static int MrChatlistGetCnt (int hChatlist);
public native static int MrChatlistGetChat (int hChatlist, int index); // returns hChat
public native static int MrChatlistGetCnt (long hChatlist);
public native static int MrChatlistGetChat (long hChatlist, int index); // returns hChat
// working with chats
public native static int MrChatGetId (int hChat);
public native static int MrChatGetType (int hChat);
public native static String MrChatCetName (int hChat);
public native static int MrChatGetId (long hChat);
public native static int MrChatGetType (long hChat);
public native static String MrChatCetName (long hChat);
}
@@ -1328,7 +1328,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
int code = pInfo.versionCode / 10;
String abi = "";
int testval = MrMailbox.MrMailboxNew();
long testval = MrMailbox.MrMailboxNew ();
switch (pInfo.versionCode % 10) {
case 0:
abi = "arm";