Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix warnings detected on Android build
  • Loading branch information
1bsyl committed Dec 6, 2018
1 parent 39ec169 commit 7468d1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
14 changes: 5 additions & 9 deletions src/core/android/SDL_android.c
Expand Up @@ -942,11 +942,6 @@ static void LocalReferenceHolder_Cleanup(struct LocalReferenceHolder *refholder)
}
}

static SDL_bool LocalReferenceHolder_IsActive(void)
{
return s_active > 0;
}

ANativeWindow* Android_JNI_GetNativeWindow(void)
{
ANativeWindow* anw;
Expand Down Expand Up @@ -1372,7 +1367,8 @@ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent)
JNIEnv *mEnv = Android_JNI_GetEnv();
jthrowable exception;

SDL_assert(LocalReferenceHolder_IsActive());
/* Detect mismatch LocalReferenceHolder_Init/Cleanup */
SDL_assert((s_active > 0));

exception = (*mEnv)->ExceptionOccurred(mEnv);
if (exception != NULL) {
Expand Down Expand Up @@ -1455,13 +1451,13 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx)
}

mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "getStartOffset", "()J");
ctx->hidden.androidio.offset = (*mEnv)->CallLongMethod(mEnv, inputStream, mid);
ctx->hidden.androidio.offset = (long)(*mEnv)->CallLongMethod(mEnv, inputStream, mid);
if (Android_JNI_ExceptionOccurred(SDL_TRUE)) {
goto fallback;
}

mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "getDeclaredLength", "()J");
ctx->hidden.androidio.size = (*mEnv)->CallLongMethod(mEnv, inputStream, mid);
ctx->hidden.androidio.size = (long)(*mEnv)->CallLongMethod(mEnv, inputStream, mid);
if (Android_JNI_ExceptionOccurred(SDL_TRUE)) {
goto fallback;
}
Expand Down Expand Up @@ -1779,7 +1775,7 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence)
if (amount > movement) {
amount = movement;
}
result = Android_JNI_FileRead(ctx, buffer, 1, amount);
result = Android_JNI_FileRead(ctx, buffer, 1, (size_t)amount);
if (result <= 0) {
/* Failed to read/skip the required amount, so fail */
return -1;
Expand Down
2 changes: 1 addition & 1 deletion src/joystick/android/SDL_sysjoystick.c
Expand Up @@ -83,7 +83,7 @@ static Uint32 crc32_for_byte(Uint32 r)
return r ^ (Uint32)0xFF000000L;
}

static Uint32 crc32(const void *data, int count)
static Uint32 crc32(const void *data, size_t count)
{
Uint32 crc = 0;
int i;
Expand Down
3 changes: 1 addition & 2 deletions src/timer/unix/SDL_systimer.c
Expand Up @@ -112,8 +112,7 @@ SDL_GetTicks(void)
#if HAVE_CLOCK_GETTIME
struct timespec now;
clock_gettime(SDL_MONOTONIC_CLOCK, &now);
ticks = (now.tv_sec - start_ts.tv_sec) * 1000 + (now.tv_nsec -
start_ts.tv_nsec) / 1000000;
ticks = (Uint32)((now.tv_sec - start_ts.tv_sec) * 1000 + (now.tv_nsec - start_ts.tv_nsec) / 1000000);
#elif defined(__APPLE__)
uint64_t now = mach_absolute_time();
ticks = (Uint32)((((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000);
Expand Down

0 comments on commit 7468d1e

Please sign in to comment.