engine: platform: refactor variable declarations

This commit is contained in:
Alibek Omarov
2026-05-20 18:15:51 +05:00
committed by a1batross
parent c6c1163aa0
commit 3c1cf81c2d
34 changed files with 179 additions and 327 deletions

View File

@@ -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 );

View File

@@ -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__ );