Fixed compiling of three test programs with C++.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 09 Oct 2016 20:31:32 +0200
changeset 105036f9f7acc9d1e
parent 10502 94fa77c53e2e
child 10504 9f8284fde4ea
Fixed compiling of three test programs with C++.
test/testgles.c
test/testgles2.c
test/testime.c
     1.1 --- a/test/testgles.c	Sun Oct 09 20:31:04 2016 +0200
     1.2 +++ b/test/testgles.c	Sun Oct 09 20:31:32 2016 +0200
     1.3 @@ -173,7 +173,7 @@
     1.4          quit(2);
     1.5      }
     1.6  
     1.7 -    context = SDL_calloc(state->num_windows, sizeof(context));
     1.8 +    context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context));
     1.9      if (context == NULL) {
    1.10          SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
    1.11          quit(2);
     2.1 --- a/test/testgles2.c	Sun Oct 09 20:31:04 2016 +0200
     2.2 +++ b/test/testgles2.c	Sun Oct 09 20:31:32 2016 +0200
     2.3 @@ -546,7 +546,7 @@
     2.4          return 0;
     2.5      }
     2.6  
     2.7 -    context = SDL_calloc(state->num_windows, sizeof(context));
     2.8 +    context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context));
     2.9      if (context == NULL) {
    2.10          SDL_Log("Out of memory!\n");
    2.11          quit(2);
    2.12 @@ -640,7 +640,7 @@
    2.13          }
    2.14      }
    2.15  
    2.16 -    datas = SDL_calloc(state->num_windows, sizeof(shader_data));
    2.17 +    datas = (shader_data *)SDL_calloc(state->num_windows, sizeof(shader_data));
    2.18  
    2.19      /* Set rendering settings for each context */
    2.20      for (i = 0; i < state->num_windows; ++i) {
     3.1 --- a/test/testime.c	Sun Oct 09 20:31:04 2016 +0200
     3.2 +++ b/test/testime.c	Sun Oct 09 20:31:32 2016 +0200
     3.3 @@ -110,7 +110,7 @@
     3.4      const size_t unifontTextureSize = UNIFONT_NUM_TEXTURES * state->num_windows * sizeof(void *);
     3.5  
     3.6      /* Allocate memory for the glyph data so the file can be closed after initialization. */
     3.7 -    unifontGlyph = SDL_malloc(unifontGlyphSize);
     3.8 +    unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize);
     3.9      if (unifontGlyph == NULL)
    3.10      {
    3.11          SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024);
    3.12 @@ -119,7 +119,7 @@
    3.13      SDL_memset(unifontGlyph, 0, unifontGlyphSize);
    3.14  
    3.15      /* Allocate memory for texture pointers for all renderers. */
    3.16 -    unifontTexture = SDL_malloc(unifontTextureSize);
    3.17 +    unifontTexture = (SDL_Texture **)SDL_malloc(unifontTextureSize);
    3.18      if (unifontTexture == NULL)
    3.19      {
    3.20          SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024);
    3.21 @@ -270,7 +270,7 @@
    3.22          exit(-1);
    3.23      }
    3.24  
    3.25 -    textureRGBA = SDL_malloc(UNIFONT_TEXTURE_SIZE);
    3.26 +    textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE);
    3.27      if (textureRGBA == NULL)
    3.28      {
    3.29          SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024);