VS2005 tweaks (thanks, Ozkan!).
authorRyan C. Gordon <icculus@icculus.org>
Sun, 07 Jun 2015 19:58:42 -0400
changeset 97158945c203a54b
parent 9714 e501460cb4c4
child 9716 f2804ed2a5a3
VS2005 tweaks (thanks, Ozkan!).

Fixes Bugzilla #2895.

His notes:

The following trivial changes make SDL2 tree (mostly) compatible with Visual
Studio 2005:

* SDL_stdlib.c: Similar to VS2010 and newer, VS2005 also generates memcpy(),
(it also generates memset(), see below), so propagate the #if condition to
cover VS2005.

* SDL_pixels.c (SDL_CalculateGammaRamp): VS2005 generates a memset() call for
gamma==0 case, so replace the if loop with SDL_memset().

* SDL_windowsvideo.h: Include msctf.h only with VS2008 and newer, otherwise
include SDL_msctf.h

* SDL_windowskeyboard.c: Adjust the #ifdefs so that SDL_msctf.h inclusion is
always recognized correctly.
src/stdlib/SDL_stdlib.c
src/video/SDL_pixels.c
src/video/windows/SDL_windowskeyboard.c
src/video/windows/SDL_windowsvideo.h
     1.1 --- a/src/stdlib/SDL_stdlib.c	Sun Jun 07 18:29:23 2015 -0400
     1.2 +++ b/src/stdlib/SDL_stdlib.c	Sun Jun 07 19:58:42 2015 -0400
     1.3 @@ -279,7 +279,8 @@
     1.4  #endif
     1.5  
     1.6  /* The optimizer on Visual Studio 2010/2012 generates memcpy() calls */
     1.7 -#if _MSC_VER >= 1600 && defined(_WIN64) && !defined(_DEBUG)
     1.8 +/* Visual Studio 2005 does it too, and it also generates memset() calls */
     1.9 +#if (_MSC_VER == 1400 || _MSC_VER >= 1600) && defined(_WIN64) && !defined(_DEBUG)
    1.10  #include <intrin.h>
    1.11  
    1.12  #pragma function(memcpy)
     2.1 --- a/src/video/SDL_pixels.c	Sun Jun 07 18:29:23 2015 -0400
     2.2 +++ b/src/video/SDL_pixels.c	Sun Jun 07 19:58:42 2015 -0400
     2.3 @@ -1101,9 +1101,7 @@
     2.4  
     2.5      /* 0.0 gamma is all black */
     2.6      if (gamma == 0.0f) {
     2.7 -        for (i = 0; i < 256; ++i) {
     2.8 -            ramp[i] = 0;
     2.9 -        }
    2.10 +        SDL_memset(ramp, 0, 256 * sizeof(Uint16));
    2.11          return;
    2.12      } else if (gamma == 1.0f) {
    2.13          /* 1.0 gamma is identity */
     3.1 --- a/src/video/windows/SDL_windowskeyboard.c	Sun Jun 07 18:29:23 2015 -0400
     3.2 +++ b/src/video/windows/SDL_windowskeyboard.c	Sun Jun 07 19:58:42 2015 -0400
     3.3 @@ -211,7 +211,12 @@
     3.4  
     3.5  #else
     3.6  
     3.7 -#ifdef __GNUC__
     3.8 +#ifdef _SDL_msctf_h
     3.9 +#define USE_INIT_GUID
    3.10 +#elif defined(__GNUC__)
    3.11 +#define USE_INIT_GUID
    3.12 +#endif
    3.13 +#ifdef USE_INIT_GUID
    3.14  #undef DEFINE_GUID
    3.15  #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const GUID n = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
    3.16  DEFINE_GUID(IID_ITfInputProcessorProfileActivationSink,        0x71C6E74E,0x0F28,0x11D8,0xA8,0x2A,0x00,0x06,0x5B,0x84,0x43,0x5C);
     4.1 --- a/src/video/windows/SDL_windowsvideo.h	Sun Jun 07 18:29:23 2015 -0400
     4.2 +++ b/src/video/windows/SDL_windowsvideo.h	Sun Jun 07 19:58:42 2015 -0400
     4.3 @@ -27,7 +27,7 @@
     4.4  
     4.5  #include "../SDL_sysvideo.h"
     4.6  
     4.7 -#if defined(_MSC_VER)
     4.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1500)
     4.9  #include <msctf.h>
    4.10  #else
    4.11  #include "SDL_msctf.h"