mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-08 13:21:51 +08:00
engine: platform: refactor variable declarations
This commit is contained in:
@@ -78,14 +78,12 @@ Android_GetAndroidID
|
||||
const char *Android_GetAndroidID( void )
|
||||
{
|
||||
static char id[32];
|
||||
jstring resultJNIStr;
|
||||
const char *resultCStr;
|
||||
|
||||
if( !COM_StringEmpty( id ))
|
||||
return id;
|
||||
|
||||
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getAndroidID );
|
||||
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||
jstring resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getAndroidID );
|
||||
const char *resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||
Q_strncpy( id, resultCStr, sizeof( id ) );
|
||||
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
||||
(*jni.env)->DeleteLocalRef( jni.env, resultJNIStr );
|
||||
@@ -101,11 +99,8 @@ Android_LoadID
|
||||
const char *Android_LoadID( void )
|
||||
{
|
||||
static char id[32];
|
||||
jstring resultJNIStr;
|
||||
const char *resultCStr;
|
||||
|
||||
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.loadAndroidID );
|
||||
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||
jstring resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.loadAndroidID );
|
||||
const char *resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||
Q_strncpy( id, resultCStr, sizeof( id ) );
|
||||
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
||||
(*jni.env)->DeleteLocalRef( jni.env, resultJNIStr );
|
||||
|
||||
@@ -23,7 +23,6 @@ GNU General Public License for more details.
|
||||
void *ANDROID_LoadLibrary( const char *path )
|
||||
{
|
||||
const char *name = COM_FileWithoutPath( path );
|
||||
void *handle;
|
||||
|
||||
Con_Reportf( "%s: loading \"%s\" (name: \"%s\")\n", __func__, path, name );
|
||||
|
||||
@@ -36,7 +35,7 @@ void *ANDROID_LoadLibrary( const char *path )
|
||||
|
||||
Con_Reportf( "%s: trying APK path \"%s\"\n", __func__, fullpath );
|
||||
|
||||
handle = dlopen( fullpath, RTLD_NOW );
|
||||
void *handle = dlopen( fullpath, RTLD_NOW );
|
||||
if( handle )
|
||||
{
|
||||
Con_Reportf( "%s: loaded from APK path\n", __func__ );
|
||||
@@ -58,7 +57,7 @@ void *ANDROID_LoadLibrary( const char *path )
|
||||
Q_strncpy( libpath, hInst->fullPath, sizeof( libpath ));
|
||||
Mem_Free( hInst );
|
||||
|
||||
handle = dlopen( libpath, RTLD_NOW );
|
||||
void *handle = dlopen( libpath, RTLD_NOW );
|
||||
if( handle )
|
||||
{
|
||||
Con_Reportf( "%s: loaded from VFS path\n", __func__ );
|
||||
@@ -77,7 +76,7 @@ void *ANDROID_LoadLibrary( const char *path )
|
||||
|
||||
// find in system search path (APK's LD_LIBRARY_PATH)
|
||||
Con_Reportf( "%s: trying LD_LIBRARY_PATH for \"%s\"\n", __func__, name );
|
||||
handle = dlopen( name, RTLD_NOW );
|
||||
void *handle = dlopen( name, RTLD_NOW );
|
||||
if( handle )
|
||||
{
|
||||
Con_Reportf( "%s: loaded from LD_LIBRARY_PATH\n", __func__ );
|
||||
|
||||
Reference in New Issue
Block a user