Fixed Windows RT build
authorSam Lantinga <slouken@libsdl.org>
Tue, 19 Mar 2019 16:52:09 -0700
changeset 126654743da9c3eea
parent 12664 71a3366d5b34
child 12666 792209d71724
Fixed Windows RT build
src/core/winrt/SDL_winrtapp_common.cpp
src/cpuinfo/SDL_cpuinfo.c
src/render/SDL_render.c
src/render/direct3d/SDL_render_d3d.c
src/render/direct3d11/SDL_render_d3d11.c
src/render/opengl/SDL_render_gl.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
src/render/psp/SDL_render_psp.c
src/render/software/SDL_render_sw.c
src/thread/windows/SDL_systhread.c
src/thread/windows/SDL_systls.c
src/video/SDL_bmp.c
     1.1 --- a/src/core/winrt/SDL_winrtapp_common.cpp	Tue Mar 19 11:02:43 2019 -0700
     1.2 +++ b/src/core/winrt/SDL_winrtapp_common.cpp	Tue Mar 19 16:52:09 2019 -0700
     1.3 @@ -20,6 +20,7 @@
     1.4  */
     1.5  #include "../../SDL_internal.h"
     1.6  
     1.7 +#include "SDL_main.h"
     1.8  #include "SDL_system.h"
     1.9  #include "SDL_winrtapp_direct3d.h"
    1.10  #include "SDL_winrtapp_xaml.h"
     2.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Tue Mar 19 11:02:43 2019 -0700
     2.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Tue Mar 19 16:52:09 2019 -0700
     2.3 @@ -25,7 +25,7 @@
     2.4  #include "SDL_simd.h"
     2.5  #endif
     2.6  
     2.7 -#if defined(__WIN32__)
     2.8 +#if defined(__WIN32__) || defined(__WINRT__)
     2.9  #include "../core/windows/SDL_windows.h"
    2.10  #endif
    2.11  #if defined(__OS2__)
     3.1 --- a/src/render/SDL_render.c	Tue Mar 19 11:02:43 2019 -0700
     3.2 +++ b/src/render/SDL_render.c	Tue Mar 19 16:52:09 2019 -0700
     3.3 @@ -1188,7 +1188,7 @@
     3.4      const SDL_PixelFormat *fmt;
     3.5      SDL_bool needAlpha;
     3.6      SDL_bool direct_update;
     3.7 -    Uint32 i;
     3.8 +    int i;
     3.9      Uint32 format;
    3.10      SDL_Texture *texture;
    3.11  
    3.12 @@ -1219,7 +1219,7 @@
    3.13      }
    3.14  
    3.15      format = renderer->info.texture_formats[0];
    3.16 -    for (i = 0; i < renderer->info.num_texture_formats; ++i) {
    3.17 +    for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) {
    3.18          if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) &&
    3.19              SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) {
    3.20              format = renderer->info.texture_formats[i];
     4.1 --- a/src/render/direct3d/SDL_render_d3d.c	Tue Mar 19 11:02:43 2019 -0700
     4.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Tue Mar 19 16:52:09 2019 -0700
     4.3 @@ -791,7 +791,7 @@
     4.4      const DWORD color = D3DCOLOR_ARGB(cmd->data.draw.a, cmd->data.draw.r, cmd->data.draw.g, cmd->data.draw.b);
     4.5      const size_t vertslen = count * sizeof (Vertex);
     4.6      Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first);
     4.7 -    size_t i;
     4.8 +    int i;
     4.9  
    4.10      if (!verts) {
    4.11          return -1;
    4.12 @@ -815,7 +815,7 @@
    4.13      const DWORD color = D3DCOLOR_ARGB(cmd->data.draw.a, cmd->data.draw.r, cmd->data.draw.g, cmd->data.draw.b);
    4.14      const size_t vertslen = count * sizeof (Vertex) * 4;
    4.15      Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first);
    4.16 -    size_t i;
    4.17 +    int i;
    4.18  
    4.19      if (!verts) {
    4.20          return -1;
     5.1 --- a/src/render/direct3d11/SDL_render_d3d11.c	Tue Mar 19 11:02:43 2019 -0700
     5.2 +++ b/src/render/direct3d11/SDL_render_d3d11.c	Tue Mar 19 16:52:09 2019 -0700
     5.3 @@ -1559,7 +1559,7 @@
     5.4      const float g = (float)(cmd->data.draw.g / 255.0f);
     5.5      const float b = (float)(cmd->data.draw.b / 255.0f);
     5.6      const float a = (float)(cmd->data.draw.a / 255.0f);
     5.7 -    size_t i;
     5.8 +    int i;
     5.9  
    5.10      if (!verts) {
    5.11          return -1;
    5.12 @@ -1591,7 +1591,7 @@
    5.13      const float g = (float)(cmd->data.draw.g / 255.0f);
    5.14      const float b = (float)(cmd->data.draw.b / 255.0f);
    5.15      const float a = (float)(cmd->data.draw.a / 255.0f);
    5.16 -    size_t i;
    5.17 +    int i;
    5.18  
    5.19      if (!verts) {
    5.20          return -1;
     6.1 --- a/src/render/opengl/SDL_render_gl.c	Tue Mar 19 11:02:43 2019 -0700
     6.2 +++ b/src/render/opengl/SDL_render_gl.c	Tue Mar 19 16:52:09 2019 -0700
     6.3 @@ -805,7 +805,7 @@
     6.4  GL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
     6.5  {
     6.6      GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first);
     6.7 -    size_t i;
     6.8 +    int i;
     6.9  
    6.10      if (!verts) {
    6.11          return -1;
    6.12 @@ -824,7 +824,7 @@
    6.13  GL_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
    6.14  {
    6.15      GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 4 * sizeof (GLfloat), 0, &cmd->data.draw.first);
    6.16 -    size_t i;
    6.17 +    int i;
    6.18  
    6.19      if (!verts) {
    6.20          return -1;
     7.1 --- a/src/render/opengles/SDL_render_gles.c	Tue Mar 19 11:02:43 2019 -0700
     7.2 +++ b/src/render/opengles/SDL_render_gles.c	Tue Mar 19 16:52:09 2019 -0700
     7.3 @@ -533,7 +533,7 @@
     7.4  GLES_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
     7.5  {
     7.6      GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first);
     7.7 -    size_t i;
     7.8 +    int i;
     7.9  
    7.10      if (!verts) {
    7.11          return -1;
    7.12 @@ -552,7 +552,7 @@
    7.13  GLES_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
    7.14  {
    7.15      GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 8 * sizeof (GLfloat), 0, &cmd->data.draw.first);
    7.16 -    size_t i;
    7.17 +    int i;
    7.18  
    7.19      if (!verts) {
    7.20          return -1;
     8.1 --- a/src/render/opengles2/SDL_render_gles2.c	Tue Mar 19 11:02:43 2019 -0700
     8.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Tue Mar 19 16:52:09 2019 -0700
     8.3 @@ -766,7 +766,7 @@
     8.4  GLES2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
     8.5  {
     8.6      GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first);
     8.7 -    size_t i;
     8.8 +    int i;
     8.9  
    8.10      if (!verts) {
    8.11          return -1;
    8.12 @@ -785,7 +785,7 @@
    8.13  GLES2_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
    8.14  {
    8.15      GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 8 * sizeof (GLfloat), 0, &cmd->data.draw.first);
    8.16 -    size_t i;
    8.17 +    int i;
    8.18  
    8.19      if (!verts) {
    8.20          return -1;
     9.1 --- a/src/render/psp/SDL_render_psp.c	Tue Mar 19 11:02:43 2019 -0700
     9.2 +++ b/src/render/psp/SDL_render_psp.c	Tue Mar 19 16:52:09 2019 -0700
     9.3 @@ -444,7 +444,7 @@
     9.4  PSP_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
     9.5  {
     9.6      VertV *verts = (VertV *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertV), 4, &cmd->data.draw.first);
     9.7 -    size_t i;
     9.8 +    int i;
     9.9  
    9.10      if (!verts) {
    9.11          return -1;
    9.12 @@ -465,7 +465,7 @@
    9.13  PSP_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
    9.14  {
    9.15      VertV *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (VertV), 4, &cmd->data.draw.first);
    9.16 -    size_t i;
    9.17 +    int i;
    9.18  
    9.19      if (!verts) {
    9.20          return -1;
    10.1 --- a/src/render/software/SDL_render_sw.c	Tue Mar 19 11:02:43 2019 -0700
    10.2 +++ b/src/render/software/SDL_render_sw.c	Tue Mar 19 16:52:09 2019 -0700
    10.3 @@ -190,7 +190,7 @@
    10.4  SW_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
    10.5  {
    10.6      SDL_Point *verts = (SDL_Point *) SDL_AllocateRenderVertices(renderer, count * sizeof (SDL_Point), 0, &cmd->data.draw.first);
    10.7 -    size_t i;
    10.8 +    int i;
    10.9  
   10.10      if (!verts) {
   10.11          return -1;
   10.12 @@ -219,7 +219,7 @@
   10.13  SW_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
   10.14  {
   10.15      SDL_Rect *verts = (SDL_Rect *) SDL_AllocateRenderVertices(renderer, count * sizeof (SDL_Rect), 0, &cmd->data.draw.first);
   10.16 -    size_t i;
   10.17 +    int i;
   10.18  
   10.19      if (!verts) {
   10.20          return -1;
    11.1 --- a/src/thread/windows/SDL_systhread.c	Tue Mar 19 11:02:43 2019 -0700
    11.2 +++ b/src/thread/windows/SDL_systhread.c	Tue Mar 19 16:52:09 2019 -0700
    11.3 @@ -29,6 +29,7 @@
    11.4  #include "../SDL_thread_c.h"
    11.5  #include "../SDL_systhread.h"
    11.6  #include "SDL_systhread_c.h"
    11.7 +#include "../../core/windows/SDL_windows.h"
    11.8  
    11.9  #ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD
   11.10  /* We'll use the C library from this DLL */
    12.1 --- a/src/thread/windows/SDL_systls.c	Tue Mar 19 11:02:43 2019 -0700
    12.2 +++ b/src/thread/windows/SDL_systls.c	Tue Mar 19 16:52:09 2019 -0700
    12.3 @@ -28,6 +28,13 @@
    12.4  #include "SDL_thread.h"
    12.5  #include "../SDL_thread_c.h"
    12.6  
    12.7 +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
    12.8 +#define TLS_OUT_OF_INDEXES  FLS_OUT_OF_INDEXES
    12.9 +#define TlsAlloc()  FlsAlloc(NULL)
   12.10 +#define TlsSetValue FlsSetValue
   12.11 +#define TlsGetValue FlsGetValue
   12.12 +#endif
   12.13 +
   12.14  static DWORD thread_local_storage = TLS_OUT_OF_INDEXES;
   12.15  static SDL_bool generic_local_storage = SDL_FALSE;
   12.16  
    13.1 --- a/src/video/SDL_bmp.c	Tue Mar 19 11:02:43 2019 -0700
    13.2 +++ b/src/video/SDL_bmp.c	Tue Mar 19 16:52:09 2019 -0700
    13.3 @@ -321,7 +321,7 @@
    13.4          SDL_assert(biBitCount <= 8);
    13.5          if (biClrUsed == 0) {
    13.6              biClrUsed = 1 << biBitCount;
    13.7 -		} else if (biClrUsed > (1 << biBitCount)) {
    13.8 +		} else if (biClrUsed > (Uint32)(1 << biBitCount)) {
    13.9  			SDL_SetError("BMP file has an invalid number of colors");
   13.10  			was_error = SDL_TRUE;
   13.11  			goto done;
   13.12 @@ -423,7 +423,7 @@
   13.13                  was_error = SDL_TRUE;
   13.14                  goto done;
   13.15              }
   13.16 -			if (biBitCount == 8 && palette && biClrUsed < (1 << biBitCount)) {
   13.17 +			if (biBitCount == 8 && palette && biClrUsed < (Uint32)(1 << biBitCount)) {
   13.18  				for (i = 0; i < surface->w; ++i) {
   13.19  					if (bits[i] >= biClrUsed) {
   13.20  						SDL_SetError("A BMP image contains a pixel with a color out of the palette");