mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-02-08 22:20:05 +01:00
since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
28 lines
613 B
C
28 lines
613 B
C
/**
|
|
* \file mischelper.c
|
|
*
|
|
* Source file with miscellaneous helper functions.
|
|
*/
|
|
|
|
#include <SDL_test.h>
|
|
|
|
void
|
|
SDLVisualTest_HashString(char* str, char hash[33])
|
|
{
|
|
SDLTest_Md5Context md5c;
|
|
int i;
|
|
|
|
if(!str)
|
|
{
|
|
SDLTest_LogError("str argument cannot be NULL");
|
|
return;
|
|
}
|
|
|
|
SDLTest_Md5Init(&md5c);
|
|
SDLTest_Md5Update(&md5c, (unsigned char*)str, SDL_strlen(str));
|
|
SDLTest_Md5Final(&md5c);
|
|
|
|
/* convert the md5 hash to an array of hexadecimal digits */
|
|
for(i = 0; i < 16; i++)
|
|
SDL_snprintf(hash + 2 * i, 33 - 2 * i, "%02x", (int)md5c.digest[i]);
|
|
} |