Browse Source

eliminate "use namespace pEp::Adapter" for better readability

JNI-88
heck 6 years ago
parent
commit
cd8fc6eebe
  1. 10
      src/basic_api.cc
  2. 17
      src/foundation_pEp_jniadapter_AbstractEngine.cc
  3. 14
      src/gen_cpp_Engine.ysl2

10
src/basic_api.cc

@ -12,7 +12,7 @@
extern "C" {
using namespace pEp::JNIAdapter;
using namespace pEp::Adapter;
using pEp::Adapter::session;
JNIEXPORT jbyteArray JNICALL Java_foundation_pEp_jniadapter_Engine_trustwords(
JNIEnv *env,
@ -201,7 +201,7 @@ JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine_importKey(
throw_pEp_Exception(env, PEP_OUT_OF_MEMORY);
return;
}
PEP_STATUS status = ::import_key(session(), _key, _size, NULL);
if (status != PEP_STATUS_OK && status != PEP_KEY_IMPORTED) {
throw_pEp_Exception(env, status);
@ -242,7 +242,7 @@ JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine_blacklist_1add(
throw_pEp_Exception(env, PEP_OUT_OF_MEMORY);
return;
}
PEP_STATUS status = ::blacklist_add(session(), _fpr);
if (status != PEP_STATUS_OK) {
throw_pEp_Exception(env, status);
@ -263,7 +263,7 @@ JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine_blacklist_1delete(
throw_pEp_Exception(env, PEP_OUT_OF_MEMORY);
return;
}
PEP_STATUS status = ::blacklist_delete(session(), _fpr);
if (status != PEP_STATUS_OK) {
throw_pEp_Exception(env, status);
@ -285,7 +285,7 @@ JNIEXPORT jboolean JNICALL Java_foundation_pEp_jniadapter_Engine_blacklist_1is_1
throw_pEp_Exception(env, PEP_OUT_OF_MEMORY);
return 0;
}
PEP_STATUS status = ::blacklist_is_listed(session(), _fpr, &_listed);
if (status != PEP_STATUS_OK) {
throw_pEp_Exception(env, status);

17
src/foundation_pEp_jniadapter_AbstractEngine.cc

@ -26,7 +26,6 @@ static struct _debug_log {
namespace pEp {
using namespace pEp::JNIAdapter;
using namespace pEp::Adapter;
using namespace utility;
bool first = true;
@ -191,9 +190,9 @@ extern "C" {
env->GetJavaVM(&jvm);
jni_init();
obj = env->NewGlobalRef(me);
_messageToSend = messageToSend;
Adapter::_messageToSend = messageToSend;
}
session();
Adapter::session();
}
JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_AbstractEngine_release(
@ -201,7 +200,7 @@ extern "C" {
jobject me
)
{
session(pEp::Adapter::release);
Adapter::session(pEp::Adapter::release);
}
JNIEXPORT jstring JNICALL Java_foundation_pEp_jniadapter_AbstractEngine_getVersion(JNIEnv *env, jobject)
@ -279,7 +278,7 @@ extern "C" {
queue = new locked_queue< pEp_identity * >();
env->SetLongField(obj, queue_handle, (jlong) queue);
register_examine_function(session(), examine_identity, (void *) queue);
register_examine_function(Adapter::session(), examine_identity, (void *) queue);
pthread_create(thread, nullptr, keyserver_thread_routine, (void *) queue);
}
@ -313,7 +312,7 @@ extern "C" {
env->SetLongField(obj, queue_handle, (jlong) 0);
env->SetLongField(obj, thread_handle, (jlong) 0);
register_examine_function(session(), nullptr, nullptr);
register_examine_function(Adapter::session(), nullptr, nullptr);
queue->push_front(nullptr);
pthread_join(*thread, nullptr);
@ -327,7 +326,7 @@ extern "C" {
{
debug_log << "######## starting sync\n";
try {
startup<JNISync>(messageToSend, notifyHandshake, &o, &JNISync::onSyncStartup, &JNISync::onSyncShutdown);
Adapter::startup<JNISync>(messageToSend, notifyHandshake, &o, &JNISync::onSyncStartup, &JNISync::onSyncShutdown);
}
catch (RuntimeError& ex) {
throw_pEp_Exception(env, ex.status);
@ -340,13 +339,13 @@ extern "C" {
jobject obj
)
{
shutdown();
Adapter::shutdown();
}
JNIEXPORT jboolean JNICALL Java_foundation_pEp_jniadapter_AbstractEngine_isSyncRunning
(JNIEnv *, jobject)
{
return (jboolean) is_sync_running();
return (jboolean) Adapter::is_sync_running();
}
} // extern "C"

14
src/gen_cpp_Engine.ysl2

@ -19,7 +19,7 @@ tstylesheet {
#include "throw_pEp_exception.hh"
#include "jniutils.hh"
using namespace pEp::Adapter;
using pEp::Adapter::session;
using namespace pEp::JNIAdapter;
extern "C" {
@ -34,12 +34,12 @@ tstylesheet {
const "returning", "count(parm/creates|parm/returns)";
const "CretType" choose {
when "$returning = 0" > void
when "$returning = 1"
when "$returning = 1"
call "jni_type" with "type", "name(parm[returns|creates]/*[2])";
when "$returning > 0" > jobject
}
const "CretDefault" choose {
when "$returning = 0" >
when "$returning = 0" >
when "$returning > 0" > NULL
}
@ -200,7 +200,7 @@ tstylesheet {
||
}
otherwise {
otherwise {
||
jobject «$name»_ = NULL;
if (_«$name») {
@ -255,8 +255,8 @@ tstylesheet {
const "dir", "name(*[1])";
const "type", "name(*[2])";
const "name", "name(*[3])";
> ,
> ,
choose {
when "$dir = 'Cconst'"
@ -269,7 +269,7 @@ tstylesheet {
> (unsigned int *) &_«$name»
when "$dir = 'inout' and $type='stringlist'"
> &_«$name»
otherwise
otherwise
> _«$name»
}
}

Loading…
Cancel
Save