Bug 1306327 part A - NS_EXPORT macro in APKOpen.h can conflict with nscore.h: rename it to APKOPEN_EXPORT to avoid build issues, r?glandium
MozReview-Commit-ID: 5Y08hwtc7s2
--- a/mozglue/android/APKOpen.cpp
+++ b/mozglue/android/APKOpen.cpp
@@ -64,34 +64,34 @@ extern "C" {
* depending on the android platform and ndk versions used, it may or may
* not be defined in libc.so. In the latter case, we fail to link. Defining
* it here as weak makes us provide the symbol when it's not provided by
* the crt objects, making the change transparent for future NDKs that
* would fix the original problem. On older NDKs, it is not a problem
* either because the way __dso_handle was used was already broken (and
* the custom linker works around it).
*/
- NS_EXPORT __attribute__((weak)) void *__dso_handle;
+ APKOPEN_EXPORT __attribute__((weak)) void *__dso_handle;
}
typedef int mozglueresult;
enum StartupEvent {
#define mozilla_StartupTimeline_Event(ev, z) ev,
#include "StartupTimeline.h"
#undef mozilla_StartupTimeline_Event
MAX_STARTUP_EVENT_ID
};
using namespace mozilla;
static const int MAX_MAPPING_INFO = 32;
static mapping_info lib_mapping[MAX_MAPPING_INFO];
-NS_EXPORT const struct mapping_info *
+APKOPEN_EXPORT const struct mapping_info *
getLibraryMapping()
{
return lib_mapping;
}
void
JNI_Throw(JNIEnv* jenv, const char* classname, const char* msg)
{
@@ -149,23 +149,23 @@ abortThroughJava(const char* msg)
if (method && str) {
env->CallStaticVoidMethod(loader, method, str);
}
env->PopLocalFrame(nullptr);
}
-NS_EXPORT pthread_t
+APKOPEN_EXPORT pthread_t
getJavaUiThread()
{
return sJavaUiThread;
}
-extern "C" NS_EXPORT void MOZ_JNICALL
+extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_GeckoThread_registerUiThread(JNIEnv*, jclass)
{
sJavaUiThread = pthread_self();
}
static void * xul_handle = nullptr;
#ifndef MOZ_FOLD_LIBS
static void * sqlite_handle = nullptr;
@@ -320,17 +320,17 @@ loadNSSLibs(const char *apkName)
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't get a handle to libplc4!");
return FAILURE;
}
#endif
return setup_nss_functions(nss_handle, nspr_handle, plc_handle);
}
-extern "C" NS_EXPORT void MOZ_JNICALL
+extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_extractGeckoLibsNative(
JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName)
{
MOZ_ALWAYS_TRUE(!jenv->GetJavaVM(&sJavaVM));
const char* apkName = jenv->GetStringUTFChars(jApkName, nullptr);
if (apkName == nullptr) {
return;
@@ -345,17 +345,17 @@ Java_org_mozilla_gecko_mozglue_GeckoLoad
__wrap_dlclose(handle);
} else {
JNI_Throw(jenv, "java/lang/Exception", "Error extracting gecko libraries");
}
jenv->ReleaseStringUTFChars(jApkName, apkName);
}
-extern "C" NS_EXPORT void MOZ_JNICALL
+extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_loadGeckoLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName)
{
jenv->GetJavaVM(&sJavaVM);
const char* str;
// XXX: java doesn't give us true UTF8, we should figure out something
// better to do here
str = jenv->GetStringUTFChars(jApkName, nullptr);
@@ -364,17 +364,17 @@ Java_org_mozilla_gecko_mozglue_GeckoLoad
int res = loadGeckoLibs(str);
if (res != SUCCESS) {
JNI_Throw(jenv, "java/lang/Exception", "Error loading gecko libraries");
}
jenv->ReleaseStringUTFChars(jApkName, str);
}
-extern "C" NS_EXPORT void MOZ_JNICALL
+extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_loadSQLiteLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName) {
const char* str;
// XXX: java doesn't give us true UTF8, we should figure out something
// better to do here
str = jenv->GetStringUTFChars(jApkName, nullptr);
if (str == nullptr)
return;
@@ -382,17 +382,17 @@ Java_org_mozilla_gecko_mozglue_GeckoLoad
mozglueresult rv = loadSQLiteLibs(str);
if (rv != SUCCESS) {
JNI_Throw(jenv, "java/lang/Exception", "Error loading sqlite libraries");
}
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Load sqlite done\n");
jenv->ReleaseStringUTFChars(jApkName, str);
}
-extern "C" NS_EXPORT void MOZ_JNICALL
+extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_loadNSSLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName) {
const char* str;
// XXX: java doesn't give us true UTF8, we should figure out something
// better to do here
str = jenv->GetStringUTFChars(jApkName, nullptr);
if (str == nullptr)
return;
@@ -442,17 +442,17 @@ FreeArgv(char** argv, int argc)
free(argv[ix]);
}
delete[](argv);
}
typedef void (*GeckoStart_t)(JNIEnv*, char**, int, const StaticXREAppData&);
typedef int GeckoProcessType;
-extern "C" NS_EXPORT void MOZ_JNICALL
+extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_nativeRun(JNIEnv *jenv, jclass jc, jobjectArray jargs, int crashFd, int ipcFd)
{
int argc = 0;
char** argv = CreateArgvFromObjectArray(jenv, jargs, &argc);
if (ipcFd < 0) {
GeckoStart_t GeckoStart;
xul_dlsym("GeckoStart", &GeckoStart);
@@ -480,17 +480,17 @@ Java_org_mozilla_gecko_mozglue_GeckoLoad
XREChildData childData;
fXRE_InitChildProcess(argc - 1, argv, &childData);
}
FreeArgv(argv, argc);
}
-extern "C" NS_EXPORT mozglueresult
+extern "C" APKOPEN_EXPORT mozglueresult
ChildProcessInit(int argc, char* argv[])
{
int i;
for (i = 0; i < (argc - 1); i++) {
if (strcmp(argv[i], "-greomni"))
continue;
i = i + 1;
--- a/mozglue/android/APKOpen.h
+++ b/mozglue/android/APKOpen.h
@@ -3,30 +3,30 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef APKOpen_h
#define APKOpen_h
#include <jni.h>
#include <pthread.h>
-#ifndef NS_EXPORT
-#define NS_EXPORT __attribute__ ((visibility("default")))
+#ifndef APKOPEN_EXPORT
+#define APKOPEN_EXPORT __attribute__ ((visibility("default")))
#endif
struct mapping_info {
char * name;
uintptr_t base;
size_t len;
size_t offset;
};
-NS_EXPORT const struct mapping_info * getLibraryMapping();
-NS_EXPORT void abortThroughJava(const char* msg);
-NS_EXPORT pthread_t getJavaUiThread();
+APKOPEN_EXPORT const struct mapping_info * getLibraryMapping();
+APKOPEN_EXPORT void abortThroughJava(const char* msg);
+APKOPEN_EXPORT pthread_t getJavaUiThread();
static const int SUCCESS = 0;
static const int FAILURE = 1;
void JNI_Throw(JNIEnv* jenv, const char* classname, const char* msg);
// Bug 1207642 - Work around Dalvik bug by realigning stack on JNI entry
#ifndef MOZ_JNICALL
# ifdef __i386__
--- a/mozglue/android/NSSBridge.cpp
+++ b/mozglue/android/NSSBridge.cpp
@@ -83,17 +83,17 @@ throwError(JNIEnv* jenv, const char * fu
asprintf(&msg, "%s returned error %d: %s\n", funcString, perr, errString);
LOG("Throwing error: %s\n", msg);
JNI_Throw(jenv, "java/lang/Exception", msg);
free(msg);
LOG("Error thrown\n");
}
-extern "C" NS_EXPORT jstring MOZ_JNICALL
+extern "C" APKOPEN_EXPORT jstring MOZ_JNICALL
Java_org_mozilla_gecko_NSSBridge_nativeEncrypt(JNIEnv* jenv, jclass,
jstring jPath,
jstring jValue)
{
jstring ret = jenv->NewStringUTF("");
const char* path;
path = jenv->GetStringUTFChars(jPath, nullptr);
@@ -109,17 +109,17 @@ Java_org_mozilla_gecko_NSSBridge_nativeE
}
jenv->ReleaseStringUTFChars(jValue, value);
jenv->ReleaseStringUTFChars(jPath, path);
return ret;
}
-extern "C" NS_EXPORT jstring MOZ_JNICALL
+extern "C" APKOPEN_EXPORT jstring MOZ_JNICALL
Java_org_mozilla_gecko_NSSBridge_nativeDecrypt(JNIEnv* jenv, jclass,
jstring jPath,
jstring jValue)
{
jstring ret = jenv->NewStringUTF("");
const char* path;
path = jenv->GetStringUTFChars(jPath, nullptr);
--- a/mozglue/android/SQLiteBridge.cpp
+++ b/mozglue/android/SQLiteBridge.cpp
@@ -131,17 +131,17 @@ JNI_Setup(JNIEnv* jenv)
|| jCursorAddRow == nullptr) {
throwSqliteException(jenv, "GetMethodId error");
return;
}
initialized = true;
}
-extern "C" NS_EXPORT jobject MOZ_JNICALL
+extern "C" APKOPEN_EXPORT jobject MOZ_JNICALL
Java_org_mozilla_gecko_sqlite_SQLiteBridge_sqliteCall(JNIEnv* jenv, jclass,
jstring jDb,
jstring jQuery,
jobjectArray jParams,
jlongArray jQueryRes)
{
JNI_Setup(jenv);
@@ -159,32 +159,32 @@ Java_org_mozilla_gecko_sqlite_SQLiteBrid
f_sqlite3_close(db); // close db even if open failed
return nullptr;
}
jCursor = sqliteInternalCall(jenv, db, jQuery, jParams, jQueryRes);
f_sqlite3_close(db);
return jCursor;
}
-extern "C" NS_EXPORT jobject MOZ_JNICALL
+extern "C" APKOPEN_EXPORT jobject MOZ_JNICALL
Java_org_mozilla_gecko_sqlite_SQLiteBridge_sqliteCallWithDb(JNIEnv* jenv, jclass,
jlong jDb,
jstring jQuery,
jobjectArray jParams,
jlongArray jQueryRes)
{
JNI_Setup(jenv);
jobject jCursor = nullptr;
sqlite3 *db = (sqlite3*)jDb;
jCursor = sqliteInternalCall(jenv, db, jQuery, jParams, jQueryRes);
return jCursor;
}
-extern "C" NS_EXPORT jlong MOZ_JNICALL
+extern "C" APKOPEN_EXPORT jlong MOZ_JNICALL
Java_org_mozilla_gecko_sqlite_SQLiteBridge_openDatabase(JNIEnv* jenv, jclass,
jstring jDb)
{
JNI_Setup(jenv);
int rc;
const char* dbPath;
sqlite3 *db;
@@ -196,17 +196,17 @@ Java_org_mozilla_gecko_sqlite_SQLiteBrid
throwSqliteException(jenv,
"Can't open database: %s", f_sqlite3_errmsg(db));
f_sqlite3_close(db); // close db even if open failed
return 0;
}
return (jlong)db;
}
-extern "C" NS_EXPORT void MOZ_JNICALL
+extern "C" APKOPEN_EXPORT void MOZ_JNICALL
Java_org_mozilla_gecko_sqlite_SQLiteBridge_closeDatabase(JNIEnv* jenv, jclass,
jlong jDb)
{
JNI_Setup(jenv);
sqlite3 *db = (sqlite3*)jDb;
f_sqlite3_close(db);
}