fixed macos crash

This commit is contained in:
Vadim Grigoruk 2018-05-18 19:13:56 +03:00
parent f7449d14ae
commit 6d945a2283
2 changed files with 7 additions and 6 deletions

View File

@ -207,7 +207,7 @@ set(SDLGPU_SRC
add_library(sdlgpu STATIC ${SDLGPU_SRC})
target_compile_definitions(sdlgpu PRIVATE GLEW_STATIC SDL_GPU_DISABLE_GLES)
target_compile_definitions(sdlgpu PRIVATE GLEW_STATIC SDL_GPU_DISABLE_GLES SDL_GPU_DISABLE_OPENGL_3 SDL_GPU_DISABLE_OPENGL_4)
target_include_directories(sdlgpu PRIVATE 3rd-party/sdl-gpu/include)
target_include_directories(sdlgpu PRIVATE 3rd-party/sdl-gpu/src/externals/glew)

View File

@ -48,7 +48,7 @@ static void onExit(void* data)
run->exit = true;
}
static char* data2md5(const void* data, s32 length)
static const char* data2md5(const void* data, s32 length)
{
const char *str = data;
MD5_CTX c;
@ -66,11 +66,12 @@ static char* data2md5(const void* data, s32 length)
}
{
u8 digest[16];
enum{Size = 16};
u8 digest[Size];
MD5_Final(digest, &c);
for (s32 n = 0; n < 16; ++n)
snprintf(&(out[n*2]), 16*2, "%02x", (u32)digest[n]);
for (s32 n = 0; n < Size; ++n)
snprintf(out + n*2, sizeof("ff"), "%02x", digest[n]);
}
return out;
@ -79,7 +80,7 @@ static char* data2md5(const void* data, s32 length)
static void initPMemName(Run* run)
{
const char* data = strlen(run->tic->saveid) ? run->tic->saveid : run->tic->cart.bank0.code.data;
char* md5 = data2md5(data, (s32)strlen(data));
const char* md5 = data2md5(data, strlen(data));
strcpy(run->saveid, TIC_LOCAL);
strcat(run->saveid, md5);
}