Go to file
Sam Lantinga b5ea3c6d07 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. */
        }
    }
2017-08-11 21:30:06 -07:00
VisualC Updated Visual Studio 2008 project 2017-07-10 15:55:13 -07:00
VisualC-WinRT WinRT: removed Windows 8.0 from build-bot + NuGet package creation scripts 2017-02-25 21:23:12 -05:00
Xcode Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Xcode-iOS ios: Fixed math include in demos. 2017-05-25 23:01:59 +02:00
acinclude Fixed bug 3481 - Configure fails to detect dynamic library support on powerpc64le 2016-11-06 20:26:48 -08:00
android-project Fixed bug 3464 - Fix for Android hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH 2017-08-11 13:37:40 -07:00
build-scripts Disable static builds for static analysis. 2017-07-30 14:36:01 -04:00
cmake cmake: whoops, Sam and I both fixed this bug at the same time. :) 2017-08-09 22:34:45 -04:00
debian We don't actually build with the Xt library 2017-01-10 23:23:32 -08:00
docs README-linux.md: added libsndio-dev to the package list. 2017-08-07 00:36:45 -04:00
include Fixed bug 3292 - SDL_rwops and 64-bit file I/O 2017-08-11 21:16:33 -07:00
src Fixed bug 3284 - minor correction for SDL_setenv on _WIN32__ platform 2017-08-11 21:30:06 -07:00
test Fixed bug 3639 - SDL_GetPrefPath returns a path with two consecutive slashes on Unix if org is omitted 2017-08-11 11:32:00 -07:00
visualtest Updated copyright for 2017 2017-01-01 18:33:28 -08:00
.hgignore audio: Initial bits to enable audio capture support. 2016-08-01 00:18:56 -04:00
Android.mk Make sure the memory barrier functions are always available, and now they are implemented on Android __ARM_ARCH_5TE__ 2017-02-10 11:21:15 -08:00
BUGS.txt BUGS.txt: Changed mailing list link to discourse.libsdl.org. 2017-04-01 00:05:25 -04:00
CMakeLists.txt Forgot to add function check for fopen64 to CMake build 2017-08-11 21:17:10 -07:00
COPYING.txt Updated copyright for 2017 2017-01-01 18:33:28 -08:00
CREDITS.txt Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
INSTALL.txt More HTTPS doc tweaks. 2017-02-16 16:59:07 -05:00
Makefile.in Fixed bug 3651 - CMake build does not install CMake package configuration 2017-08-09 19:03:10 -07:00
Makefile.minimal Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
Makefile.pandora pandora: Fixed compiler warning about redefining SDL_REVISION. 2017-06-18 23:00:27 +02:00
Makefile.psp PSP: Added missing object for generic TLS to Makefile. 2016-02-13 17:34:14 +01:00
Makefile.wiz Pandora: Updated SDL version in Makefile. 2016-07-19 21:01:30 +02:00
README-SDL.txt More HTTPS changes in the documentation. 2017-02-16 16:52:03 -05:00
README.txt readme: correct webpage URL to use HTTPS. 2017-02-16 13:30:34 -05:00
SDL2.spec.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
SDL2Config.cmake Fixed bug 3651 - CMake build does not install CMake package configuration 2017-08-09 19:03:10 -07:00
TODO.txt Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
VisualC.html Fixed two typos in documentation. 2016-01-12 22:23:53 +01:00
WhatsNew.txt Added note for David Carlier's work on OpenBSD 2016-10-12 18:57:12 -07:00
autogen.sh Don't use pushd/popd in autogen.sh; Ubuntu's /bin/sh doesn't support it. 2016-12-26 22:58:58 -05:00
cmake_uninstall.cmake.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
configure Fixed bug 3292 - SDL_rwops and 64-bit file I/O 2017-08-11 21:16:33 -07:00
configure.in Fixed bug 3292 - SDL_rwops and 64-bit file I/O 2017-08-11 21:16:33 -07:00
sdl2-config.cmake.in Applied Ubuntu patch bug_822210_fix_sdl2-config.cmake_whitespace.patch 2016-10-07 15:08:37 -07:00
sdl2-config.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00
sdl2.m4 Fixed bug 3429 - Update AM_PATH_SDL2() to also check for SDL2.framework 2016-09-29 16:37:08 -07:00
sdl2.pc.in Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 17:33:46 +02:00

README.txt

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.


                         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)