Fixed ISO C99 compatibility SDL now builds with gcc 7.2 with the following command line options: -Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index dcaebea..caba537 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -151,11 +151,11 @@ LoadLibSampleRate(void)
return SDL_FALSE;
}
- SRC_src_new = (SRC_STATE* (*)(int converter_type, int channels, int *error))SDL_LoadFunction(SRC_lib, "src_new");
- SRC_src_process = (int (*)(SRC_STATE *state, SRC_DATA *data))SDL_LoadFunction(SRC_lib, "src_process");
- SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset");
- SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete");
- SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror");
+ *(void **)&SRC_src_new = SDL_LoadFunction(SRC_lib, "src_new");
+ *(void **)&SRC_src_process = SDL_LoadFunction(SRC_lib, "src_process");
+ *(void **)&SRC_src_reset = SDL_LoadFunction(SRC_lib, "src_reset");
+ *(void **)&SRC_src_delete = SDL_LoadFunction(SRC_lib, "src_delete");
+ *(void **)&SRC_src_strerror = SDL_LoadFunction(SRC_lib, "src_strerror");
if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) {
SDL_UnloadObject(SRC_lib);
diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c
index 09b83ae..e814956 100644
--- a/src/audio/directsound/SDL_directsound.c
+++ b/src/audio/directsound/SDL_directsound.c
@@ -74,7 +74,7 @@ DSOUND_Load(void)
} else {
/* Now make sure we have DirectX 8 or better... */
#define DSOUNDLOAD(f) { \
- p##f = (fn##f) SDL_LoadFunction(DSoundDLL, #f); \
+ *(void**)&p##f = SDL_LoadFunction(DSoundDLL, #f); \
if (!p##f) loaded = 0; \
}
loaded = 1; /* will reset if necessary. */
diff --git a/src/audio/wasapi/SDL_wasapi_win32.c b/src/audio/wasapi/SDL_wasapi_win32.c
index 4b315ab..a368ee0 100644
--- a/src/audio/wasapi/SDL_wasapi_win32.c
+++ b/src/audio/wasapi/SDL_wasapi_win32.c
@@ -256,8 +256,8 @@ WASAPI_PlatformInit(void)
libavrt = LoadLibraryW(L"avrt.dll"); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */
if (libavrt) {
- pAvSetMmThreadCharacteristicsW = (pfnAvSetMmThreadCharacteristicsW) GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW");
- pAvRevertMmThreadCharacteristics = (pfnAvRevertMmThreadCharacteristics) GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics");
+ *(void **)&pAvSetMmThreadCharacteristicsW = GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW");
+ *(void **)&pAvRevertMmThreadCharacteristics = GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics");
}
return 0;
diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c
index efa41db..8f3462f 100644
--- a/src/core/linux/SDL_dbus.c
+++ b/src/core/linux/SDL_dbus.c
@@ -33,7 +33,7 @@ static int
LoadDBUSSyms(void)
{
#define SDL_DBUS_SYM2(x, y) \
- if (!(dbus.x = SDL_LoadFunction(dbus_handle, #y))) return -1
+ if (!(*(void**)&dbus.x = SDL_LoadFunction(dbus_handle, #y))) return -1
#define SDL_DBUS_SYM(x) \
SDL_DBUS_SYM2(x, dbus_##x)
diff --git a/src/core/windows/SDL_xinput.c b/src/core/windows/SDL_xinput.c
index 75bf600..a4318a0 100644
--- a/src/core/windows/SDL_xinput.c
+++ b/src/core/windows/SDL_xinput.c
@@ -104,13 +104,13 @@ WIN_LoadXInputDLL(void)
s_XInputDLLRefCount = 1;
/* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */
- SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
+ *(void**)&SDL_XInputGetState = GetProcAddress((HMODULE)s_pXInputDLL, (LPCSTR)100);
if (!SDL_XInputGetState) {
- SDL_XInputGetState = (XInputGetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
+ *(void**)&SDL_XInputGetState = GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetState");
}
- SDL_XInputSetState = (XInputSetState_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
- SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
- SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetBatteryInformation" );
+ *(void**)&SDL_XInputSetState = GetProcAddress((HMODULE)s_pXInputDLL, "XInputSetState");
+ *(void**)&SDL_XInputGetCapabilities = GetProcAddress((HMODULE)s_pXInputDLL, "XInputGetCapabilities");
+ *(void**)&SDL_XInputGetBatteryInformation = GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetBatteryInformation" );
if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) {
WIN_UnloadXInputDLL();
return -1;
diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c
index b898826..a5f0a1c 100644
--- a/src/dynapi/SDL_dynapi.c
+++ b/src/dynapi/SDL_dynapi.c
@@ -263,7 +263,7 @@ SDL_InitDynamicAPILocked(void)
SDL_DYNAPI_ENTRYFN entry = SDL_DYNAPI_entry; /* funcs from here by default. */
if (libname) {
- entry = (SDL_DYNAPI_ENTRYFN) get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
+ *(void **)&entry = get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
if (!entry) {
/* !!! FIXME: fail to startup here instead? */
/* !!! FIXME: definitely warn user. */
diff --git a/src/events/SDL_quit.c b/src/events/SDL_quit.c
index 31b89a5..dc34678 100644
--- a/src/events/SDL_quit.c
+++ b/src/events/SDL_quit.c
@@ -55,7 +55,7 @@ SDL_QuitInit_Internal(void)
struct sigaction action;
sigaction(SIGINT, NULL, &action);
#ifdef HAVE_SA_SIGACTION
- if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) {
+ if ( action.sa_handler == SIG_DFL && (__sighandler_t)action.sa_sigaction == SIG_DFL ) {
#else
if ( action.sa_handler == SIG_DFL ) {
#endif
@@ -65,7 +65,7 @@ SDL_QuitInit_Internal(void)
sigaction(SIGTERM, NULL, &action);
#ifdef HAVE_SA_SIGACTION
- if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) {
+ if ( action.sa_handler == SIG_DFL && (__sighandler_t)action.sa_sigaction == SIG_DFL ) {
#else
if ( action.sa_handler == SIG_DFL ) {
#endif
diff --git a/src/filesystem/windows/SDL_sysfilesystem.c b/src/filesystem/windows/SDL_sysfilesystem.c
index 5219789..acc299d 100644
--- a/src/filesystem/windows/SDL_sysfilesystem.c
+++ b/src/filesystem/windows/SDL_sysfilesystem.c
@@ -50,7 +50,7 @@ SDL_GetBasePath(void)
return NULL;
}
- pGetModuleFileNameExW = (GetModuleFileNameExW_t)GetProcAddress(psapi, "GetModuleFileNameExW");
+ *(void**)&pGetModuleFileNameExW = GetProcAddress(psapi, "GetModuleFileNameExW");
if (!pGetModuleFileNameExW) {
WIN_SetError("Couldn't find GetModuleFileNameExW");
FreeLibrary(psapi);
diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c
index e0ccfc4..c8a0e7e 100644
--- a/src/render/direct3d11/SDL_render_d3d11.c
+++ b/src/render/direct3d11/SDL_render_d3d11.c
@@ -568,7 +568,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer)
goto done;
}
- CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
+ *(void**)&CreateDXGIFactoryFunc = SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
if (!CreateDXGIFactoryFunc) {
result = E_FAIL;
goto done;
@@ -580,7 +580,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer)
goto done;
}
- D3D11CreateDeviceFunc = (PFN_D3D11_CREATE_DEVICE)SDL_LoadFunction(data->hD3D11Mod, "D3D11CreateDevice");
+ *(void**)D3D11CreateDeviceFunc = SDL_LoadFunction(data->hD3D11Mod, "D3D11CreateDevice");
if (!D3D11CreateDeviceFunc) {
result = E_FAIL;
goto done;
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index ae8bca5..4bb3b08 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -260,10 +260,8 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file,
#if 0
#define GL_CheckError(prefix, renderer)
-#elif defined(_MSC_VER) || defined(__WATCOMC__)
-#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __FUNCTION__)
#else
-#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION)
#endif
static int
@@ -274,7 +272,7 @@ GL_LoadFunctions(GL_RenderData * data)
#else
#define SDL_PROC(ret,func,params) \
do { \
- data->func = SDL_GL_GetProcAddress(#func); \
+ *(void **)&data->func = SDL_GL_GetProcAddress(#func); \
if ( ! data->func ) { \
return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
} \
@@ -492,7 +490,9 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
data->debug_enabled = SDL_TRUE;
}
if (data->debug_enabled && SDL_GL_ExtensionSupported("GL_ARB_debug_output")) {
- PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
+ PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc;
+
+ *(void **)&glDebugMessageCallbackARBFunc = SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
data->GL_ARB_debug_output_supported = SDL_TRUE;
data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)(char *)&data->next_error_callback);
@@ -521,7 +521,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
/* Check for multitexture support */
if (SDL_GL_ExtensionSupported("GL_ARB_multitexture")) {
- data->glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glActiveTextureARB");
+ *(void **)&data->glActiveTextureARB = SDL_GL_GetProcAddress("glActiveTextureARB");
if (data->glActiveTextureARB) {
data->GL_ARB_multitexture_supported = SDL_TRUE;
data->glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &data->num_texture_units);
@@ -549,16 +549,11 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) {
data->GL_EXT_framebuffer_object_supported = SDL_TRUE;
- data->glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)
- SDL_GL_GetProcAddress("glGenFramebuffersEXT");
- data->glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)
- SDL_GL_GetProcAddress("glDeleteFramebuffersEXT");
- data->glFramebufferTexture2DEXT = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
- SDL_GL_GetProcAddress("glFramebufferTexture2DEXT");
- data->glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEREXTPROC)
- SDL_GL_GetProcAddress("glBindFramebufferEXT");
- data->glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
- SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT");
+ *(void**)&data->glGenFramebuffersEXT = SDL_GL_GetProcAddress("glGenFramebuffersEXT");
+ *(void**)&data->glDeleteFramebuffersEXT = SDL_GL_GetProcAddress("glDeleteFramebuffersEXT");
+ *(void**)&data->glFramebufferTexture2DEXT = SDL_GL_GetProcAddress("glFramebufferTexture2DEXT");
+ *(void**)&data->glBindFramebufferEXT = SDL_GL_GetProcAddress("glBindFramebufferEXT");
+ *(void**)&data->glCheckFramebufferStatusEXT = SDL_GL_GetProcAddress("glCheckFramebufferStatusEXT");
renderer->info.flags |= SDL_RENDERER_TARGETTEXTURE;
}
data->framebuffers = NULL;
@@ -1615,7 +1610,9 @@ GL_DestroyRenderer(SDL_Renderer * renderer)
GL_ClearErrors(renderer);
if (data->GL_ARB_debug_output_supported) {
- PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
+ PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc;
+
+ *(void **)&glDebugMessageCallbackARBFunc = SDL_GL_GetProcAddress("glDebugMessageCallbackARB");
/* Uh oh, we don't have a safe way of removing ourselves from the callback chain, if it changed after we set our callback. */
/* For now, just always replace the callback with the original one */
diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c
index 251b54d..eb2d7e4 100644
--- a/src/render/opengl/SDL_shaders_gl.c
+++ b/src/render/opengl/SDL_shaders_gl.c
@@ -453,20 +453,20 @@ GL_CreateShaderContext(void)
SDL_GL_ExtensionSupported("GL_ARB_shading_language_100") &&
SDL_GL_ExtensionSupported("GL_ARB_vertex_shader") &&
SDL_GL_ExtensionSupported("GL_ARB_fragment_shader")) {
- ctx->glGetError = (GLenum (*)(void)) SDL_GL_GetProcAddress("glGetError");
- ctx->glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB");
- ctx->glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB");
- ctx->glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB");
- ctx->glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB");
- ctx->glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB");
- ctx->glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB");
- ctx->glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB");
- ctx->glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB");
- ctx->glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB");
- ctx->glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB");
- ctx->glUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB");
- ctx->glUniform1fARB = (PFNGLUNIFORM1FARBPROC) SDL_GL_GetProcAddress("glUniform1fARB");
- ctx->glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB");
+ *(void**)&ctx->glGetError = SDL_GL_GetProcAddress("glGetError");
+ *(void **)&ctx->glAttachObjectARB = SDL_GL_GetProcAddress("glAttachObjectARB");
+ *(void **)&ctx->glCompileShaderARB = SDL_GL_GetProcAddress("glCompileShaderARB");
+ *(void **)&ctx->glCreateProgramObjectARB = SDL_GL_GetProcAddress("glCreateProgramObjectARB");
+ *(void **)&ctx->glCreateShaderObjectARB = SDL_GL_GetProcAddress("glCreateShaderObjectARB");
+ *(void **)&ctx->glDeleteObjectARB = SDL_GL_GetProcAddress("glDeleteObjectARB");
+ *(void **)&ctx->glGetInfoLogARB = SDL_GL_GetProcAddress("glGetInfoLogARB");
+ *(void **)&ctx->glGetObjectParameterivARB = SDL_GL_GetProcAddress("glGetObjectParameterivARB");
+ *(void **)&ctx->glGetUniformLocationARB = SDL_GL_GetProcAddress("glGetUniformLocationARB");
+ *(void **)&ctx->glLinkProgramARB = SDL_GL_GetProcAddress("glLinkProgramARB");
+ *(void **)&ctx->glShaderSourceARB = SDL_GL_GetProcAddress("glShaderSourceARB");
+ *(void **)&ctx->glUniform1iARB = SDL_GL_GetProcAddress("glUniform1iARB");
+ *(void **)&ctx->glUniform1fARB = SDL_GL_GetProcAddress("glUniform1fARB");
+ *(void **)&ctx->glUseProgramObjectARB = SDL_GL_GetProcAddress("glUseProgramObjectARB");
if (ctx->glGetError &&
ctx->glAttachObjectARB &&
ctx->glCompileShaderARB &&
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index d6bfca5..83b6046 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -198,14 +198,14 @@ static int GLES_LoadFunctions(GLES_RenderData * data)
#else
#define SDL_PROC(ret,func,params) \
do { \
- data->func = SDL_GL_GetProcAddress(#func); \
+ *(void**)&data->func = SDL_GL_GetProcAddress(#func); \
if ( ! data->func ) { \
return SDL_SetError("Couldn't load GLES function %s: %s", #func, SDL_GetError()); \
} \
} while ( 0 );
#define SDL_PROC_OES(ret,func,params) \
do { \
- data->func = SDL_GL_GetProcAddress(#func); \
+ *(void**)&data->func = SDL_GL_GetProcAddress(#func); \
} while ( 0 );
#endif /* __SDL_NOGETPROCADDR__ */
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 42d60bd..b548a69 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -22,6 +22,7 @@
#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED
+#include "SDL_assert.h"
#include "SDL_hints.h"
#include "SDL_opengles2.h"
#include "../SDL_sysrender.h"
@@ -259,10 +260,8 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file,
#if 0
#define GL_CheckError(prefix, renderer)
-#elif defined(_MSC_VER) || defined(__WATCOMC__)
-#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __FUNCTION__)
#else
-#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION)
#endif
@@ -295,7 +294,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data)
#else
#define SDL_PROC(ret,func,params) \
do { \
- data->func = SDL_GL_GetProcAddress(#func); \
+ *(void **)&data->func = SDL_GL_GetProcAddress(#func); \
if ( ! data->func ) { \
return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \
} \
diff --git a/src/thread/pthread/SDL_systhread.c b/src/thread/pthread/SDL_systhread.c
index 5539d75..d3f7721 100644
--- a/src/thread/pthread/SDL_systhread.c
+++ b/src/thread/pthread/SDL_systhread.c
@@ -91,11 +91,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
if (!checked_setname) {
void *fn = dlsym(RTLD_DEFAULT, "pthread_setname_np");
- #if defined(__MACOSX__) || defined(__IPHONEOS__)
- ppthread_setname_np = (int(*)(const char*)) fn;
- #elif defined(__LINUX__)
- ppthread_setname_np = (int(*)(pthread_t, const char*)) fn;
- #endif
+ *(void **)&ppthread_setname_np = fn;
checked_setname = SDL_TRUE;
}
#endif
diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c
index 90036c9..e44d5ea 100644
--- a/src/thread/windows/SDL_systhread.c
+++ b/src/thread/windows/SDL_systhread.c
@@ -178,7 +178,7 @@ SDL_SYS_SetupThread(const char *name)
if (!kernel32) {
kernel32 = LoadLibraryW(L"kernel32.dll");
if (kernel32) {
- pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription");
+ *(void**)&pSetThreadDescription = GetProcAddress(kernel32, "SetThreadDescription");
}
}
diff --git a/src/video/SDL_blit.c b/src/video/SDL_blit.c
index 0d4e2fd..3459bb0 100644
--- a/src/video/SDL_blit.c
+++ b/src/video/SDL_blit.c
@@ -82,7 +82,7 @@ SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
info->dst_pitch = dst->pitch;
info->dst_skip =
info->dst_pitch - info->dst_w * info->dst_fmt->BytesPerPixel;
- RunBlit = (SDL_BlitFunc) src->map->data;
+ *(void**)&RunBlit = src->map->data;
/* Run the actual software blit */
RunBlit(info);
@@ -282,7 +282,7 @@ SDL_CalculateBlit(SDL_Surface * surface)
blit = SDL_Blit_Slow;
}
}
- map->data = blit;
+ *(SDL_BlitFunc *)&map->data = blit;
/* Make sure we have a blit function */
if (blit == NULL) {
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index 7308c15..3926d5b 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -87,7 +87,7 @@ static const char g_rpi_opt_path[] = "/opt/vc/lib";
_this->egl_data->NAME = (void *)NAME;
#else
#define LOAD_FUNC(NAME) \
-_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
+*(void**)&_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \
if (!_this->egl_data->NAME) \
{ \
return SDL_SetError("Could not retrieve EGL function " #NAME); \
@@ -432,7 +432,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
_this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(size_t)native_display, NULL);
} else {
if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) {
- _this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT");
+ *(void**)&_this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT");
if (_this->egl_data->eglGetPlatformDisplayEXT) {
_this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(size_t)native_display, NULL);
}
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index d1d35c2..9df71c9 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -365,8 +365,8 @@ struct SDL_VideoDevice
/* Data used by the Vulkan drivers */
struct
{
- void *vkGetInstanceProcAddr;
- void *vkEnumerateInstanceExtensionProperties;
+ PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
+ PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
int loader_loaded;
char loader_path[256];
void *loader_handle;
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index e04810b..05623c6 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -224,7 +224,7 @@ ShouldUseTextureFramebuffer()
const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
const char *vendor = NULL;
- glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+ *(void**)&glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
if (glGetStringFunc) {
vendor = (const char *) glGetStringFunc(GL_VENDOR);
}
@@ -2870,7 +2870,7 @@ SDL_GL_ExtensionSupported(const char *extension)
/* Lookup the available extensions */
- glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+ *(void**)&glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
if (!glGetStringFunc) {
return SDL_FALSE;
}
@@ -2881,8 +2881,8 @@ SDL_GL_ExtensionSupported(const char *extension)
GLint num_exts = 0;
GLint i;
- glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
- glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
+ *(void**)&glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi");
+ *(void**)&glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
if ((!glGetStringiFunc) || (!glGetIntegervFunc)) {
return SDL_FALSE;
}
@@ -3342,13 +3342,13 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
}
#if SDL_VIDEO_OPENGL
- glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+ *(void**)&glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
if (!glGetStringFunc) {
return -1;
}
if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
- glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
+ *(void**)&glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
if (glGetFramebufferAttachmentParameterivFunc) {
glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value);
@@ -3359,7 +3359,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
#endif
{
void (APIENTRY *glGetIntegervFunc) (GLenum pname, GLint * params);
- glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
+ *(void**)&glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
if (glGetIntegervFunc) {
glGetIntegervFunc(attrib, (GLint *) value);
} else {
@@ -3367,7 +3367,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
}
}
- glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
+ *(void**)&glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
if (!glGetErrorFunc) {
return -1;
}
@@ -3995,14 +3995,17 @@ int SDL_Vulkan_LoadLibrary(const char *path)
void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
{
+ void *func = NULL;
if (!_this) {
SDL_UninitializedVideo();
return NULL;
}
if (!_this->vulkan_config.loader_loaded) {
SDL_SetError("No Vulkan loader has been loaded");
+ return NULL;
}
- return _this->vulkan_config.vkGetInstanceProcAddr;
+ *(PFN_vkGetInstanceProcAddr*)&func = _this->vulkan_config.vkGetInstanceProcAddr;
+ return func;
}
void SDL_Vulkan_UnloadLibrary(void)
diff --git a/src/video/SDL_vulkan_internal.h b/src/video/SDL_vulkan_internal.h
index 98a3132..b48b114 100644
--- a/src/video/SDL_vulkan_internal.h
+++ b/src/video/SDL_vulkan_internal.h
@@ -81,6 +81,9 @@ extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount,
/* No SDL Vulkan support, just include the header for typedefs */
#include "SDL_vulkan.h"
+typedef void* PFN_vkGetInstanceProcAddr;
+typedef void* PFN_vkEnumerateInstanceExtensionProperties;
+
#endif /* SDL_VIDEO_VULKAN */
#endif /* SDL_vulkan_internal_h_ */
diff --git a/src/video/android/SDL_androidvulkan.c b/src/video/android/SDL_androidvulkan.c
index b497a54..91d7dbb 100644
--- a/src/video/android/SDL_androidvulkan.c
+++ b/src/video/android/SDL_androidvulkan.c
@@ -56,13 +56,13 @@ int Android_Vulkan_LoadLibrary(_THIS, const char *path)
return -1;
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
- vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
if(!vkGetInstanceProcAddr)
goto fail;
- _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
- (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
goto fail;
@@ -139,7 +139,7 @@ SDL_bool Android_Vulkan_CreateSurface(_THIS,
(PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr(
(VkInstance)instance,
"vkCreateAndroidSurfaceKHR");
- VkAndroidSurfaceCreateInfoKHR createInfo = {};
+ VkAndroidSurfaceCreateInfoKHR createInfo;
VkResult result;
if(!_this->vulkan_config.loader_handle)
@@ -154,6 +154,7 @@ SDL_bool Android_Vulkan_CreateSurface(_THIS,
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
}
+ SDL_zero(createInfo);
createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = NULL;
createInfo.flags = 0;
diff --git a/src/video/cocoa/SDL_cocoavulkan.m b/src/video/cocoa/SDL_cocoavulkan.m
index ce72774..eb97fbe 100644
--- a/src/video/cocoa/SDL_cocoavulkan.m
+++ b/src/video/cocoa/SDL_cocoavulkan.m
@@ -83,7 +83,7 @@ int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path)
}
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
- vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
}
@@ -95,9 +95,9 @@ int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path)
goto fail;
}
- _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
- (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) {
goto fail;
diff --git a/src/video/mir/SDL_mirdyn.c b/src/video/mir/SDL_mirdyn.c
index 71dc73c..78e7b82 100644
--- a/src/video/mir/SDL_mirdyn.c
+++ b/src/video/mir/SDL_mirdyn.c
@@ -139,7 +139,7 @@ SDL_MIR_LoadSymbols(void)
#include "SDL_mirsym.h"
#define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname;
-#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod);
+#define SDL_MIR_SYM(rc,fn,params) *(void**)&MIR_##fn = MIR_GetSym(#fn,thismod);
#define SDL_MIR_SYM_CONST(type,name) MIR_##name = *(SDL_DYMMIRCONST_##name*) MIR_GetSym(#name,thismod);
#include "SDL_mirsym.h"
diff --git a/src/video/mir/SDL_mirvideo.c b/src/video/mir/SDL_mirvideo.c
index cff2782..8f3a368 100644
--- a/src/video/mir/SDL_mirvideo.c
+++ b/src/video/mir/SDL_mirvideo.c
@@ -27,6 +27,7 @@
#if SDL_VIDEO_DRIVER_MIR
+#include "SDL_assert.h"
#include "SDL_log.h"
#include "SDL_mirwindow.h"
@@ -103,7 +104,7 @@ MIR_Available()
if (SDL_MIR_LoadSymbols()) {
/* Lets ensure we can connect to the mir server */
- MirConnection* connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__);
+ MirConnection* connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION);
if (!MIR_mir_connection_is_valid(connection)) {
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Unable to connect to the mir server %s",
@@ -319,7 +320,7 @@ MIR_VideoInit(_THIS)
{
MIR_Data* mir_data = _this->driverdata;
- mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__);
+ mir_data->connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION);
mir_data->current_window = NULL;
mir_data->software = SDL_FALSE;
mir_data->pixel_format = mir_pixel_format_invalid;
diff --git a/src/video/mir/SDL_mirvulkan.c b/src/video/mir/SDL_mirvulkan.c
index d5b90be..216f6ff 100644
--- a/src/video/mir/SDL_mirvulkan.c
+++ b/src/video/mir/SDL_mirvulkan.c
@@ -56,14 +56,13 @@ int MIR_Vulkan_LoadLibrary(_THIS, const char *path)
return -1;
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
- vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
if(!vkGetInstanceProcAddr)
goto fail;
- _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
- (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
- VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+ (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
goto fail;
extensions = SDL_Vulkan_CreateInstanceExtensionsList(
@@ -139,7 +138,7 @@ SDL_bool MIR_Vulkan_CreateSurface(_THIS,
(PFN_vkCreateMirSurfaceKHR)vkGetInstanceProcAddr(
(VkInstance)instance,
"vkCreateMirSurfaceKHR");
- VkMirSurfaceCreateInfoKHR createInfo = {};
+ VkMirSurfaceCreateInfoKHR createInfo;
VkResult result;
if(!_this->vulkan_config.loader_handle)
@@ -154,6 +153,7 @@ SDL_bool MIR_Vulkan_CreateSurface(_THIS,
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
}
+ SDL_zero(createInfo);
createInfo.sType = VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = NULL;
createInfo.flags = 0;
diff --git a/src/video/uikit/SDL_uikitvulkan.m b/src/video/uikit/SDL_uikitvulkan.m
index 771c7a4..469a464 100644
--- a/src/video/uikit/SDL_uikitvulkan.m
+++ b/src/video/uikit/SDL_uikitvulkan.m
@@ -84,8 +84,7 @@ int UIKit_Vulkan_LoadLibrary(_THIS, const char *path)
}
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
- vkGetInstanceProcAddr =
- (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
_this->vulkan_config.loader_handle,
"vkGetInstanceProcAddr");
}
diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c
index 1c8a710..f1b9742 100644
--- a/src/video/wayland/SDL_waylanddatamanager.c
+++ b/src/video/wayland/SDL_waylanddatamanager.c
@@ -61,7 +61,7 @@ write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos)
bytes_written = SDL_SetError("Pipe select error");
} else {
if (length > 0) {
- bytes_written = write(fd, buffer + *pos, SDL_min(length, PIPE_BUF));
+ bytes_written = write(fd, (Uint8*)buffer + *pos, SDL_min(length, PIPE_BUF));
}
if (bytes_written > 0) {
@@ -114,10 +114,10 @@ read_pipe(int fd, void** buffer, size_t* total_length, SDL_bool null_terminate)
if (output_buffer == NULL) {
bytes_read = SDL_OutOfMemory();
} else {
- SDL_memcpy(output_buffer + pos, temp, bytes_read);
+ SDL_memcpy((Uint8*)output_buffer + pos, temp, bytes_read);
if (null_terminate == SDL_TRUE) {
- SDL_memset(output_buffer + (new_buffer_length - 1), 0, 1);
+ SDL_memset((Uint8*)output_buffer + (new_buffer_length - 1), 0, 1);
}
*buffer = output_buffer;
diff --git a/src/video/wayland/SDL_waylanddyn.c b/src/video/wayland/SDL_waylanddyn.c
index 98cc518..1633379 100644
--- a/src/video/wayland/SDL_waylanddyn.c
+++ b/src/video/wayland/SDL_waylanddyn.c
@@ -147,7 +147,7 @@ SDL_WAYLAND_LoadSymbols(void)
#include "SDL_waylandsym.h"
#define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname;
-#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod);
+#define SDL_WAYLAND_SYM(rc,fn,params) *(void**)&WAYLAND_##fn = WAYLAND_GetSym(#fn,thismod);
#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod);
#include "SDL_waylandsym.h"
diff --git a/src/video/wayland/SDL_waylandopengles.h b/src/video/wayland/SDL_waylandopengles.h
index 21479f5..58d7f9b 100644
--- a/src/video/wayland/SDL_waylandopengles.h
+++ b/src/video/wayland/SDL_waylandopengles.h
@@ -28,6 +28,7 @@
typedef struct SDL_PrivateGLESData
{
+ int dummy;
} SDL_PrivateGLESData;
/* OpenGLES functions */
diff --git a/src/video/wayland/SDL_waylandvulkan.c b/src/video/wayland/SDL_waylandvulkan.c
index a29744c..fe021df 100644
--- a/src/video/wayland/SDL_waylandvulkan.c
+++ b/src/video/wayland/SDL_waylandvulkan.c
@@ -56,13 +56,12 @@ int Wayland_Vulkan_LoadLibrary(_THIS, const char *path)
return -1;
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
- vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
- _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
+ *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
if(!vkGetInstanceProcAddr)
goto fail;
- _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
- (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
goto fail;
@@ -139,7 +138,7 @@ SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
(PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(
(VkInstance)instance,
"vkCreateWaylandSurfaceKHR");
- VkWaylandSurfaceCreateInfoKHR createInfo = {};
+ VkWaylandSurfaceCreateInfoKHR createInfo;
VkResult result;
if(!_this->vulkan_config.loader_handle)
@@ -154,6 +153,7 @@ SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
}
+ SDL_zero(createInfo);
createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
createInfo.pNext = NULL;
createInfo.flags = 0;
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 4129e9a..d06ee20 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -1086,7 +1086,9 @@ IsWin10FCUorNewer(void)
HMODULE handle = GetModuleHandleW(L"ntdll.dll");
if (handle) {
typedef LONG(WINAPI* RtlGetVersionPtr)(struct SDL_WIN_OSVERSIONINFOW*);
- RtlGetVersionPtr getVersionPtr = (RtlGetVersionPtr)GetProcAddress(handle, "RtlGetVersion");
+ RtlGetVersionPtr getVersionPtr;
+
+ *(void**)&getVersionPtr = GetProcAddress(handle, "RtlGetVersion");
if (getVersionPtr != NULL) {
struct SDL_WIN_OSVERSIONINFOW info;
SDL_zero(info);
diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c
index c7f357b..ec3bf23 100644
--- a/src/video/windows/SDL_windowskeyboard.c
+++ b/src/video/windows/SDL_windowskeyboard.c
@@ -354,10 +354,10 @@ IME_Init(SDL_VideoData *videodata, HWND hwnd)
SDL_ClearError();
return;
}
- videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC");
- videodata->ImmUnlockIMC = (BOOL (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMC");
- videodata->ImmLockIMCC = (LPVOID (WINAPI *)(HIMCC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMCC");
- videodata->ImmUnlockIMCC = (BOOL (WINAPI *)(HIMCC))SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMCC");
+ *(void**)&videodata->ImmLockIMC = SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC");
+ *(void**)&videodata->ImmUnlockIMC = SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMC");
+ *(void**)&videodata->ImmLockIMCC = SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMCC");
+ *(void**)&videodata->ImmUnlockIMCC = SDL_LoadFunction(videodata->ime_himm32, "ImmUnlockIMCC");
IME_SetWindow(videodata, hwnd);
videodata->ime_himc = ImmGetContext(hwnd);
@@ -654,9 +654,9 @@ IME_SetupAPI(SDL_VideoData *videodata)
if (!hime)
return;
- videodata->GetReadingString = (UINT (WINAPI *)(HIMC, UINT, LPWSTR, PINT, BOOL*, PUINT))
+ *(void**)&videodata->GetReadingString =
SDL_LoadFunction(hime, "GetReadingString");
- videodata->ShowReadingWindow = (BOOL (WINAPI *)(HIMC, BOOL))
+ *(void**)&videodata->ShowReadingWindow =
SDL_LoadFunction(hime, "ShowReadingWindow");
if (videodata->ShowReadingWindow) {
diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c
index c3ba56c..5513511 100644
--- a/src/video/windows/SDL_windowsopengl.c
+++ b/src/video/windows/SDL_windowsopengl.c
@@ -119,15 +119,15 @@ WIN_GL_LoadLibrary(_THIS, const char *path)
/* Load function pointers */
handle = _this->gl_config.dll_handle;
- _this->gl_data->wglGetProcAddress = (void *(WINAPI *) (const char *))
+ *(void**)&_this->gl_data->wglGetProcAddress =
SDL_LoadFunction(handle, "wglGetProcAddress");
- _this->gl_data->wglCreateContext = (HGLRC(WINAPI *) (HDC))
+ *(void**)&_this->gl_data->wglCreateContext =
SDL_LoadFunction(handle, "wglCreateContext");
- _this->gl_data->wglDeleteContext = (BOOL(WINAPI *) (HGLRC))
+ *(void**)&_this->gl_data->wglDeleteContext =
SDL_LoadFunction(handle, "wglDeleteContext");
- _this->gl_data->wglMakeCurrent = (BOOL(WINAPI *) (HDC, HGLRC))
+ *(void**)&_this->gl_data->wglMakeCurrent =
SDL_LoadFunction(handle, "wglMakeCurrent");
- _this->gl_data->wglShareLists = (BOOL(WINAPI *) (HGLRC, HGLRC))
+ *(void**)&_this->gl_data->wglShareLists =
SDL_LoadFunction(handle, "wglShareLists");
if (!_this->gl_data->wglGetProcAddress ||
@@ -409,7 +409,7 @@ WIN_GL_InitExtensions(_THIS)
}
_this->gl_data->wglMakeCurrent(hdc, hglrc);
- wglGetExtensionsStringARB = (const char *(WINAPI *) (HDC))
+ *(void**)&wglGetExtensionsStringARB =
_this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB");
if (wglGetExtensionsStringARB) {
extensions = wglGetExtensionsStringARB(hdc);
@@ -420,13 +420,9 @@ WIN_GL_InitExtensions(_THIS)
/* Check for WGL_ARB_pixel_format */
_this->gl_data->HAS_WGL_ARB_pixel_format = SDL_FALSE;
if (HasExtension("WGL_ARB_pixel_format", extensions)) {
- _this->gl_data->wglChoosePixelFormatARB = (BOOL(WINAPI *)
- (HDC, const int *,
- const FLOAT *, UINT,
- int *, UINT *))
+ *(void**)&_this->gl_data->wglChoosePixelFormatARB =
WIN_GL_GetProcAddress(_this, "wglChoosePixelFormatARB");
- _this->gl_data->wglGetPixelFormatAttribivARB =
- (BOOL(WINAPI *) (HDC, int, int, UINT, const int *, int *))
+ *(void**)&_this->gl_data->wglGetPixelFormatAttribivARB =
WIN_GL_GetProcAddress(_this, "wglGetPixelFormatAttribivARB");
if ((_this->gl_data->wglChoosePixelFormatARB != NULL) &&
@@ -438,9 +434,9 @@ WIN_GL_InitExtensions(_THIS)
/* Check for WGL_EXT_swap_control */
_this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_FALSE;
if (HasExtension("WGL_EXT_swap_control", extensions)) {
- _this->gl_data->wglSwapIntervalEXT =
+ *(void**)&_this->gl_data->wglSwapIntervalEXT =
WIN_GL_GetProcAddress(_this, "wglSwapIntervalEXT");
- _this->gl_data->wglGetSwapIntervalEXT =
+ *(void**)&_this->gl_data->wglGetSwapIntervalEXT =
WIN_GL_GetProcAddress(_this, "wglGetSwapIntervalEXT");
if (HasExtension("WGL_EXT_swap_control_tear", extensions)) {
_this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_TRUE;
@@ -721,9 +717,8 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
return NULL;
}
- wglCreateContextAttribsARB =
- (PFNWGLCREATECONTEXTATTRIBSARBPROC) _this->gl_data->
- wglGetProcAddress("wglCreateContextAttribsARB");
+ *(void**)&wglCreateContextAttribsARB =
+ _this->gl_data->wglGetProcAddress("wglCreateContextAttribsARB");
if (!wglCreateContextAttribsARB) {
SDL_SetError("GL 3.x is not supported");
context = temp_context;
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 8d45b72..f2de03f 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -113,16 +113,16 @@ WIN_CreateDevice(int devindex)
data->userDLL = SDL_LoadObject("USER32.DLL");
if (data->userDLL) {
- data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
- data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
- data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
+ *(void**)&data->CloseTouchInputHandle = SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle");
+ *(void**)&data->GetTouchInputInfo = SDL_LoadFunction(data->userDLL, "GetTouchInputInfo");
+ *(void**)&data->RegisterTouchWindow = SDL_LoadFunction(data->userDLL, "RegisterTouchWindow");
} else {
SDL_ClearError();
}
data->shcoreDLL = SDL_LoadObject("SHCORE.DLL");
if (data->shcoreDLL) {
- data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor");
+ *(void**)&data->GetDpiForMonitor = SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor");
} else {
SDL_ClearError();
}
@@ -256,7 +256,7 @@ D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface)
typedef HRESULT (WINAPI *Direct3DCreate9Ex_t)(UINT SDKVersion, IDirect3D9Ex **ppD3D);
Direct3DCreate9Ex_t Direct3DCreate9ExFunc;
- Direct3DCreate9ExFunc = (Direct3DCreate9Ex_t)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9Ex");
+ *(void**)&Direct3DCreate9ExFunc = SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9Ex");
if (Direct3DCreate9ExFunc) {
IDirect3D9Ex *pDirect3D9ExInterface;
HRESULT hr = Direct3DCreate9ExFunc(D3D_SDK_VERSION, &pDirect3D9ExInterface);
@@ -271,7 +271,7 @@ D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface)
}
#endif /* USE_D3D9EX */
- Direct3DCreate9Func = (Direct3DCreate9_t)SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9");
+ *(void**)&Direct3DCreate9Func = SDL_LoadFunction(*pD3DDLL, "Direct3DCreate9");
if (Direct3DCreate9Func) {
*pDirect3D9Interface = Direct3DCreate9Func(D3D_SDK_VERSION);
if (*pDirect3D9Interface) {
@@ -338,9 +338,7 @@ DXGI_LoadDLL(void **pDXGIDLL, IDXGIFactory **pDXGIFactory)
if (*pDXGIDLL) {
HRESULT (WINAPI *CreateDXGI)(REFIID riid, void **ppFactory);
- CreateDXGI =
- (HRESULT (WINAPI *) (REFIID, void**)) SDL_LoadFunction(*pDXGIDLL,
- "CreateDXGIFactory");
+ *(void**)&CreateDXGI = SDL_LoadFunction(*pDXGIDLL, "CreateDXGIFactory");
if (CreateDXGI) {
GUID dxgiGUID = {0x7b7166ec,0x21c7,0x44ae,{0xb2,0x1a,0xc9,0xae,0x32,0x1a,0xe3,0x69}};
if (!SUCCEEDED(CreateDXGI(&dxgiGUID, (void**)pDXGIFactory))) {
diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c
index c4b34f0..9fc1f01 100644
--- a/src/video/windows/SDL_windowsvulkan.c
+++ b/src/video/windows/SDL_windowsvulkan.c
@@ -57,13 +57,13 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path)
return -1;
SDL_strlcpy(_this->vulkan_config.loader_path, path,
SDL_arraysize(_this->vulkan_config.loader_path));
- vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ *(void**)vkGetInstanceProcAddr = SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
if(!vkGetInstanceProcAddr)
goto fail;
- _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
- (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
+ (PFN_vkEnumerateInstanceExtensionProperties)_this->vulkan_config.vkGetInstanceProcAddr(
VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
goto fail;
diff --git a/src/video/winrt/SDL_winrtopengles.cpp b/src/video/winrt/SDL_winrtopengles.cpp
index 7874501..ef316c7 100644
--- a/src/video/winrt/SDL_winrtopengles.cpp
+++ b/src/video/winrt/SDL_winrtopengles.cpp
@@ -63,7 +63,8 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path)
}
/* Load ANGLE/WinRT-specific functions */
- CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->egl_dll_handle, "CreateWinrtEglWindow");
+ CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow;
+ *(void**)&CreateWinrtEglWindow = SDL_LoadFunction(_this->egl_data->egl_dll_handle, "CreateWinrtEglWindow");
if (CreateWinrtEglWindow) {
/* 'CreateWinrtEglWindow' was found, which means that an an older
* version of ANGLE/WinRT is being used. Continue setting up EGL,
diff --git a/src/video/x11/SDL_x11dyn.c b/src/video/x11/SDL_x11dyn.c
index 89f736a..ada7b4d 100644
--- a/src/video/x11/SDL_x11dyn.c
+++ b/src/video/x11/SDL_x11dyn.c
@@ -172,14 +172,12 @@ SDL_X11_LoadSymbols(void)
#include "SDL_x11sym.h"
#define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
-#define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) X11_GetSym(#fn,thismod);
+#define SDL_X11_SYM(a,fn,x,y,z) *(void**)&X11_##fn = X11_GetSym(#fn,thismod);
#include "SDL_x11sym.h"
#ifdef X_HAVE_UTF8_STRING
- X11_XCreateIC = (SDL_DYNX11FN_XCreateIC)
- X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8);
- X11_XGetICValues = (SDL_DYNX11FN_XGetICValues)
- X11_GetSym("XGetICValues", &SDL_X11_HAVE_UTF8);
+ *(void**)&X11_XCreateIC = X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8);
+ *(void**)&X11_XGetICValues = X11_GetSym("XGetICValues", &SDL_X11_HAVE_UTF8);
#endif
if (SDL_X11_HAVE_BASEXLIB) {
diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c
index 7c3cb33..9e04acf 100644
--- a/src/video/x11/SDL_x11opengl.c
+++ b/src/video/x11/SDL_x11opengl.c
@@ -189,29 +189,21 @@ X11_GL_LoadLibrary(_THIS, const char *path)
/* Load function pointers */
handle = _this->gl_config.dll_handle;
- _this->gl_data->glXQueryExtension =
- (Bool (*)(Display *, int *, int *))
+ *(void**)&_this->gl_data->glXQueryExtension =
GL_LoadFunction(handle, "glXQueryExtension");
- _this->gl_data->glXGetProcAddress =
- (void *(*)(const GLubyte *))
+ *(void**)&_this->gl_data->glXGetProcAddress =
GL_LoadFunction(handle, "glXGetProcAddressARB");
- _this->gl_data->glXChooseVisual =
- (XVisualInfo * (*)(Display *, int, int *))
+ *(void**)&_this->gl_data->glXChooseVisual =
X11_GL_GetProcAddress(_this, "glXChooseVisual");
- _this->gl_data->glXCreateContext =
- (GLXContext(*)(Display *, XVisualInfo *, GLXContext, int))
+ *(void**)&_this->gl_data->glXCreateContext =
X11_GL_GetProcAddress(_this, "glXCreateContext");
- _this->gl_data->glXDestroyContext =
- (void (*)(Display *, GLXContext))
+ *(void**)&_this->gl_data->glXDestroyContext =
X11_GL_GetProcAddress(_this, "glXDestroyContext");
- _this->gl_data->glXMakeCurrent =
- (int (*)(Display *, GLXDrawable, GLXContext))
+ *(void**)&_this->gl_data->glXMakeCurrent =
X11_GL_GetProcAddress(_this, "glXMakeCurrent");
- _this->gl_data->glXSwapBuffers =
- (void (*)(Display *, GLXDrawable))
+ *(void**)&_this->gl_data->glXSwapBuffers =
X11_GL_GetProcAddress(_this, "glXSwapBuffers");
- _this->gl_data->glXQueryDrawable =
- (void (*)(Display*,GLXDrawable,int,unsigned int*))
+ *(void**)&_this->gl_data->glXQueryDrawable =
X11_GL_GetProcAddress(_this, "glXQueryDrawable");
if (!_this->gl_data->glXQueryExtension ||
@@ -341,13 +333,11 @@ X11_GL_InitExtensions(_THIS)
vinfo = X11_GL_GetVisual(_this, display, screen);
if (vinfo) {
- GLXContext (*glXGetCurrentContextFunc) (void) =
- (GLXContext(*)(void))
- X11_GL_GetProcAddress(_this, "glXGetCurrentContext");
+ GLXContext (*glXGetCurrentContextFunc)(void);
+ GLXDrawable (*glXGetCurrentDrawableFunc)(void);
- GLXDrawable (*glXGetCurrentDrawableFunc) (void) =
- (GLXDrawable(*)(void))
- X11_GL_GetProcAddress(_this, "glXGetCurrentDrawable");
+ *(void**)&glXGetCurrentContextFunc = X11_GL_GetProcAddress(_this, "glXGetCurrentContext");
+ *(void**)&glXGetCurrentDrawableFunc = X11_GL_GetProcAddress(_this, "glXGetCurrentDrawable");
if (glXGetCurrentContextFunc && glXGetCurrentDrawableFunc) {
XSetWindowAttributes xattr;
@@ -373,9 +363,7 @@ X11_GL_InitExtensions(_THIS)
X11_XFree(vinfo);
}
- glXQueryExtensionsStringFunc =
- (const char *(*)(Display *, int)) X11_GL_GetProcAddress(_this,
- "glXQueryExtensionsString");
+ *(void**)&glXQueryExtensionsStringFunc = X11_GL_GetProcAddress(_this, "glXQueryExtensionsString");
if (glXQueryExtensionsStringFunc) {
extensions = glXQueryExtensionsStringFunc(display, screen);
} else {
@@ -385,8 +373,7 @@ X11_GL_InitExtensions(_THIS)
/* Check for GLX_EXT_swap_control(_tear) */
_this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_FALSE;
if (HasExtension("GLX_EXT_swap_control", extensions)) {
- _this->gl_data->glXSwapIntervalEXT =
- (void (*)(Display*,GLXDrawable,int))
+ *(void**)&_this->gl_data->glXSwapIntervalEXT =
X11_GL_GetProcAddress(_this, "glXSwapIntervalEXT");
if (HasExtension("GLX_EXT_swap_control_tear", extensions)) {
_this->gl_data->HAS_GLX_EXT_swap_control_tear = SDL_TRUE;
@@ -395,26 +382,23 @@ X11_GL_InitExtensions(_THIS)
/* Check for GLX_MESA_swap_control */
if (HasExtension("GLX_MESA_swap_control", extensions)) {
- _this->gl_data->glXSwapIntervalMESA =
- (int(*)(int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalMESA");
- _this->gl_data->glXGetSwapIntervalMESA =
- (int(*)(void)) X11_GL_GetProcAddress(_this,
- "glXGetSwapIntervalMESA");
+ *(void**)&_this->gl_data->glXSwapIntervalMESA =
+ X11_GL_GetProcAddress(_this, "glXSwapIntervalMESA");
+ *(void**)&_this->gl_data->glXGetSwapIntervalMESA =
+ X11_GL_GetProcAddress(_this, "glXGetSwapIntervalMESA");
}
/* Check for GLX_SGI_swap_control */
if (HasExtension("GLX_SGI_swap_control", extensions)) {
- _this->gl_data->glXSwapIntervalSGI =
- (int (*)(int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalSGI");
+ *(void**)&_this->gl_data->glXSwapIntervalSGI =
+ X11_GL_GetProcAddress(_this, "glXSwapIntervalSGI");
}
/* Check for GLX_ARB_create_context */
if (HasExtension("GLX_ARB_create_context", extensions)) {
- _this->gl_data->glXCreateContextAttribsARB =
- (GLXContext (*)(Display*,GLXFBConfig,GLXContext,Bool,const int *))
+ *(void**)&_this->gl_data->glXCreateContextAttribsARB =
X11_GL_GetProcAddress(_this, "glXCreateContextAttribsARB");
- _this->gl_data->glXChooseFBConfig =
- (GLXFBConfig *(*)(Display *, int, const int *, int *))
+ *(void**)&_this->gl_data->glXChooseFBConfig =
X11_GL_GetProcAddress(_this, "glXChooseFBConfig");
}
diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c
index a5896e0..8f6552a 100644
--- a/src/video/x11/SDL_x11vulkan.c
+++ b/src/video/x11/SDL_x11vulkan.c
@@ -57,14 +57,14 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path)
if(!_this->vulkan_config.loader_handle)
return -1;
SDL_strlcpy(_this->vulkan_config.loader_path, path, SDL_arraysize(_this->vulkan_config.loader_path));
- vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
+ *(void**)&vkGetInstanceProcAddr = SDL_LoadFunction(
_this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
if(!vkGetInstanceProcAddr)
goto fail;
- _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
+ _this->vulkan_config.vkGetInstanceProcAddr = vkGetInstanceProcAddr;
_this->vulkan_config.vkEnumerateInstanceExtensionProperties =
- (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
- VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
+ (PFN_vkEnumerateInstanceExtensionProperties)
+ _this->vulkan_config.vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
goto fail;
extensions = SDL_Vulkan_CreateInstanceExtensionsList(
@@ -108,7 +108,7 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path)
videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName);
if(!videoData->vulkan_xlib_xcb_library)
goto fail;
- videoData->vulkan_XGetXCBConnection =
+ *(void**)&videoData->vulkan_XGetXCBConnection =
SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection");
if(!videoData->vulkan_XGetXCBConnection)
{
@@ -184,7 +184,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR =
(PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
"vkCreateXcbSurfaceKHR");
- VkXcbSurfaceCreateInfoKHR createInfo = {};
+ VkXcbSurfaceCreateInfoKHR createInfo;
VkResult result;
if(!vkCreateXcbSurfaceKHR)
{
@@ -192,6 +192,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
}
+ SDL_zero(createInfo);
createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
createInfo.connection = videoData->vulkan_XGetXCBConnection(videoData->display);
if(!createInfo.connection)
@@ -214,7 +215,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
(PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
"vkCreateXlibSurfaceKHR");
- VkXlibSurfaceCreateInfoKHR createInfo = {};
+ VkXlibSurfaceCreateInfoKHR createInfo;
VkResult result;
if(!vkCreateXlibSurfaceKHR)
{
@@ -222,6 +223,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
" extension is not enabled in the Vulkan instance.");
return SDL_FALSE;
}
+ SDL_zero(createInfo);
createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
createInfo.dpy = videoData->display;
createInfo.window = (xcb_window_t)windowData->xwindow;
diff --git a/src/video/yuv2rgb/yuv_rgb_sse_func.h b/src/video/yuv2rgb/yuv_rgb_sse_func.h
index 0fe28a8..6872c0d 100644
--- a/src/video/yuv2rgb/yuv_rgb_sse_func.h
+++ b/src/video/yuv2rgb/yuv_rgb_sse_func.h
@@ -52,7 +52,7 @@
{ \
__m128i red_mask, tmp1, tmp2, tmp3, tmp4; \
\
- red_mask = _mm_set1_epi16(0xF800); \
+ red_mask = _mm_set1_epi16((short)0xF800); \
RGB1 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R1), red_mask); \
RGB2 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R1), red_mask); \
RGB3 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R2), red_mask); \
@@ -145,7 +145,7 @@ PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6)
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
- __m128i a = _mm_set1_epi8( 0xFF ); \
+ __m128i a = _mm_set1_epi8((char)0xFF); \
\
PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
\
@@ -156,7 +156,7 @@ PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6)
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
- __m128i a = _mm_set1_epi8( 0xFF ); \
+ __m128i a = _mm_set1_epi8((char)0xFF); \
\
PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
\
@@ -167,7 +167,7 @@ PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6)
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
- __m128i a = _mm_set1_epi8( 0xFF ); \
+ __m128i a = _mm_set1_epi8((char)0xFF); \
\
PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
\
@@ -178,7 +178,7 @@ PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6)
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
- __m128i a = _mm_set1_epi8( 0xFF ); \
+ __m128i a = _mm_set1_epi8((char)0xFF); \
\
PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
\