• Show log

    Commit

  • Hash : b5ea3c6d
    Author : Sam Lantinga
    Date : 2017-08-11T21:30:06

    Fixed bug 3284 - minor correction for SDL_setenv on _WIN32__ platform
    
    Coriiander
    
    Here is a minor correction for a non-breaking mistake in SDL_setenv for __WIN32__ platform. See below for details.
    
    FILE:
    "SDL/src/stdlib/SDL_getenv.c"
    
    FUNCTION: (__WIN32__ platform)
    int SDL_setenv(const char *name, const char *value, int overwrite)
    
    CODE:
        if (!overwrite) {
            char ch = 0;
            const size_t len = GetEnvironmentVariableA(name, &ch, sizeof (ch));
            if (len > 0) {
                return 0;  /* asked not to overwrite existing value. */
            }
        }
    
    
    WHAT'S WRONG:
    The 3th argument to GetEnvironmentVariable (being DWORD nSize) must be the number of characters, not the number of bytes. SDL currently passes "the size of 1 char", rather "1". While it is non-breaking (1=1 after all), it is incorrect. Furthermore there is no need to specify the 2nd and 3th arguments at all.
    
    CORRECTION 1: (corrected argument_
        if (!overwrite) {
            char ch = 0;
            const size_t len = GetEnvironmentVariableA(name, &ch, 1);
            if (len > 0) {
                return 0;  /* asked not to overwrite existing value. */
            }
        }
    
    CORRECTION 2: (stripped of unneeded code)
        if (!overwrite) {
            if (GetEnvironmentVariableA(name, NULL, 0) > 0) {
                return 0;  /* asked not to overwrite existing value. */
            }
        }
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/SDL.git
    Git SSH git@git.kmx.io:kc3-lang/SDL.git
    Public access ? public
    Description

    Fork of https://github.com/libsdl-org/SDL

    Users
    thodg_m kc3_lang_org thodg_w www_kmx_io thodg thodg_l
    Tags

  • README.txt

  •                          Simple DirectMedia Layer
    
                                      (SDL)
    
                                    Version 2.0
    
    ---
    https://www.libsdl.org/
    
    Simple DirectMedia Layer is a cross-platform development library designed
    to provide low level access to audio, keyboard, mouse, joystick, and graphics
    hardware via OpenGL and Direct3D. It is used by video playback software,
    emulators, and popular games including Valve's award winning catalog
    and many Humble Bundle games.
    
    More extensive documentation is available in the docs directory, starting
    with README.md
    
    Enjoy!
    	Sam Lantinga				(slouken@libsdl.org)