Edit

kc3-lang/SDL/visualtest/src/mischelper.c

Branch :

  • Show log

    Commit

  • Author : David Ludwig
    Date : 2014-12-03 10:55:23
    Hash : 70438be2
    Message : WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!

  • visualtest/src/mischelper.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]);
    }