Clang++ build for windows

This commit is contained in:
Saksham Goyal 2025-10-03 11:48:30 -04:00
parent 8e15281d34
commit 3bec79d0a8
No known key found for this signature in database
GPG Key ID: 287D96BB5977A168
10 changed files with 54 additions and 55 deletions

View File

@ -205,8 +205,8 @@ char** _glfwParseUriList(char* text, int* count)
(*count)++; (*count)++;
path = _glfw_calloc(strlen(line) + 1, 1); path = (char*)_glfw_calloc(strlen(line) + 1, 1);
paths = _glfw_realloc(paths, *count * sizeof(char*)); paths = (char**)_glfw_realloc(paths, *count * sizeof(char*));
paths[*count - 1] = path; paths[*count - 1] = path;
while (*line) while (*line)
@ -231,7 +231,7 @@ char** _glfwParseUriList(char* text, int* count)
char* _glfw_strdup(const char* source) char* _glfw_strdup(const char* source)
{ {
const size_t length = strlen(source); const size_t length = strlen(source);
char* result = _glfw_calloc(length + 1, 1); char* result = (char*)_glfw_calloc(length + 1, 1);
strcpy(result, source); strcpy(result, source);
return result; return result;
} }
@ -357,10 +357,10 @@ void _glfwInputError(int code, const char* format, ...)
if (_glfw.initialized) if (_glfw.initialized)
{ {
error = _glfwPlatformGetTls(&_glfw.errorSlot); error = (_GLFWerror*)_glfwPlatformGetTls(&_glfw.errorSlot);
if (!error) if (!error)
{ {
error = _glfw_calloc(1, sizeof(_GLFWerror)); error = (_GLFWerror*)_glfw_calloc(1, sizeof(_GLFWerror));
_glfwPlatformSetTls(&_glfw.errorSlot, error); _glfwPlatformSetTls(&_glfw.errorSlot, error);
_glfwPlatformLockMutex(&_glfw.errorLock); _glfwPlatformLockMutex(&_glfw.errorLock);
error->next = _glfw.errorListHead; error->next = _glfw.errorListHead;
@ -505,7 +505,7 @@ GLFWAPI int glfwGetError(const char** description)
*description = NULL; *description = NULL;
if (_glfw.initialized) if (_glfw.initialized)
error = _glfwPlatformGetTls(&_glfw.errorSlot); error = (_GLFWerror*)_glfwPlatformGetTls(&_glfw.errorSlot);
else else
error = &_glfwMainThreadError; error = &_glfwMainThreadError;
@ -525,4 +525,3 @@ GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
_GLFW_SWAP(GLFWerrorfun, _glfwErrorCallback, cbfun); _GLFW_SWAP(GLFWerrorfun, _glfwErrorCallback, cbfun);
return cbfun; return cbfun;
} }

View File

@ -489,7 +489,7 @@ void _glfwInitGamepadMappings(void)
{ {
size_t i; size_t i;
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*); const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
_glfw.mappings = _glfw_calloc(count, sizeof(_GLFWmapping)); _glfw.mappings = (_GLFWmapping *)_glfw_calloc(count, sizeof(_GLFWmapping));
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
@ -520,9 +520,9 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
js->allocated = GLFW_TRUE; js->allocated = GLFW_TRUE;
js->axes = _glfw_calloc(axisCount, sizeof(float)); js->axes = (float *)_glfw_calloc(axisCount, sizeof(float));
js->buttons = _glfw_calloc(buttonCount + (size_t) hatCount * 4, 1); js->buttons = (unsigned char *)_glfw_calloc(buttonCount + (size_t) hatCount * 4, 1);
js->hats = _glfw_calloc(hatCount, 1); js->hats = (unsigned char *)_glfw_calloc(hatCount, 1);
js->axisCount = axisCount; js->axisCount = axisCount;
js->buttonCount = buttonCount; js->buttonCount = buttonCount;
js->hatCount = hatCount; js->hatCount = hatCount;
@ -858,7 +858,7 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
return NULL; return NULL;
} }
cursor = _glfw_calloc(1, sizeof(_GLFWcursor)); cursor = (_GLFWcursor *)_glfw_calloc(1, sizeof(_GLFWcursor));
cursor->next = _glfw.cursorListHead; cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor; _glfw.cursorListHead = cursor;
@ -892,7 +892,7 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
return NULL; return NULL;
} }
cursor = _glfw_calloc(1, sizeof(_GLFWcursor)); cursor = (_GLFWcursor *)_glfw_calloc(1, sizeof(_GLFWcursor));
cursor->next = _glfw.cursorListHead; cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor; _glfw.cursorListHead = cursor;
@ -1303,7 +1303,7 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string)
{ {
_glfw.mappingCount++; _glfw.mappingCount++;
_glfw.mappings = _glfw.mappings =
_glfw_realloc(_glfw.mappings, (_GLFWmapping *)_glfw_realloc(_glfw.mappings,
sizeof(_GLFWmapping) * _glfw.mappingCount); sizeof(_GLFWmapping) * _glfw.mappingCount);
_glfw.mappings[_glfw.mappingCount - 1] = mapping; _glfw.mappings[_glfw.mappingCount - 1] = mapping;
} }

View File

@ -39,8 +39,8 @@
// //
static int compareVideoModes(const void* fp, const void* sp) static int compareVideoModes(const void* fp, const void* sp)
{ {
const GLFWvidmode* fm = fp; const GLFWvidmode* fm = (const GLFWvidmode*)fp;
const GLFWvidmode* sm = sp; const GLFWvidmode* sm = (const GLFWvidmode*)sp;
const int fbpp = fm->redBits + fm->greenBits + fm->blueBits; const int fbpp = fm->redBits + fm->greenBits + fm->blueBits;
const int sbpp = sm->redBits + sm->greenBits + sm->blueBits; const int sbpp = sm->redBits + sm->greenBits + sm->blueBits;
const int farea = fm->width * fm->height; const int farea = fm->width * fm->height;
@ -102,7 +102,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
{ {
_glfw.monitorCount++; _glfw.monitorCount++;
_glfw.monitors = _glfw.monitors =
_glfw_realloc(_glfw.monitors, (_GLFWmonitor **)_glfw_realloc(_glfw.monitors,
sizeof(_GLFWmonitor*) * _glfw.monitorCount); sizeof(_GLFWmonitor*) * _glfw.monitorCount);
if (placement == _GLFW_INSERT_FIRST) if (placement == _GLFW_INSERT_FIRST)
@ -170,7 +170,7 @@ void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window)
// //
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM) _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
{ {
_GLFWmonitor* monitor = _glfw_calloc(1, sizeof(_GLFWmonitor)); _GLFWmonitor* monitor = (_GLFWmonitor*) _glfw_calloc(1, sizeof(_GLFWmonitor));
monitor->widthMM = widthMM; monitor->widthMM = widthMM;
monitor->heightMM = heightMM; monitor->heightMM = heightMM;
@ -199,9 +199,9 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
// //
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size) void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
{ {
ramp->red = _glfw_calloc(size, sizeof(unsigned short)); ramp->red = (unsigned short*)_glfw_calloc(size, sizeof(unsigned short));
ramp->green = _glfw_calloc(size, sizeof(unsigned short)); ramp->green = (unsigned short*)_glfw_calloc(size, sizeof(unsigned short));
ramp->blue = _glfw_calloc(size, sizeof(unsigned short)); ramp->blue = (unsigned short*)_glfw_calloc(size, sizeof(unsigned short));
ramp->size = size; ramp->size = size;
} }

View File

@ -112,7 +112,7 @@ GLFWbool _glfwInitVulkan(int mode)
return GLFW_FALSE; return GLFW_FALSE;
} }
ep = _glfw_calloc(count, sizeof(VkExtensionProperties)); ep = (VkExtensionProperties*)_glfw_calloc(count, sizeof(VkExtensionProperties));
err = vkEnumerateInstanceExtensionProperties(NULL, &count, ep); err = vkEnumerateInstanceExtensionProperties(NULL, &count, ep);
if (err) if (err)

View File

@ -134,7 +134,7 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
nativeCount = _glfw_min(nativeCount, extensionCount); nativeCount = _glfw_min(nativeCount, extensionCount);
} }
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig)); usableConfigs = (_GLFWfbconfig *)_glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
for (i = 0; i < nativeCount; i++) for (i = 0; i < nativeCount; i++)
{ {
@ -346,7 +346,7 @@ static void swapBuffersWGL(_GLFWwindow* window)
static void swapIntervalWGL(int interval) static void swapIntervalWGL(int interval)
{ {
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); _GLFWwindow* window = (_GLFWwindow*)_glfwPlatformGetTls(&_glfw.contextSlot);
assert(window != NULL); assert(window != NULL);
window->context.wgl.interval = interval; window->context.wgl.interval = interval;
@ -412,7 +412,7 @@ GLFWbool _glfwInitWGL(void)
if (_glfw.wgl.instance) if (_glfw.wgl.instance)
return GLFW_TRUE; return GLFW_TRUE;
_glfw.wgl.instance = _glfwPlatformLoadModule("opengl32.dll"); _glfw.wgl.instance = (HINSTANCE)_glfwPlatformLoadModule("opengl32.dll");
if (!_glfw.wgl.instance) if (!_glfw.wgl.instance)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,

View File

@ -81,7 +81,7 @@ static GLFWbool loadLibraries(void)
return GLFW_FALSE; return GLFW_FALSE;
} }
_glfw.win32.user32.instance = _glfwPlatformLoadModule("user32.dll"); _glfw.win32.user32.instance = (HINSTANCE)_glfwPlatformLoadModule("user32.dll");
if (!_glfw.win32.user32.instance) if (!_glfw.win32.user32.instance)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@ -100,7 +100,7 @@ static GLFWbool loadLibraries(void)
_glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi) _glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi)
_glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "GetSystemMetricsForDpi"); _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "GetSystemMetricsForDpi");
_glfw.win32.dinput8.instance = _glfwPlatformLoadModule("dinput8.dll"); _glfw.win32.dinput8.instance = (HINSTANCE)_glfwPlatformLoadModule("dinput8.dll");
if (_glfw.win32.dinput8.instance) if (_glfw.win32.dinput8.instance)
{ {
_glfw.win32.dinput8.Create = (PFN_DirectInput8Create) _glfw.win32.dinput8.Create = (PFN_DirectInput8Create)
@ -121,7 +121,7 @@ static GLFWbool loadLibraries(void)
for (i = 0; names[i]; i++) for (i = 0; names[i]; i++)
{ {
_glfw.win32.xinput.instance = _glfwPlatformLoadModule(names[i]); _glfw.win32.xinput.instance = (HINSTANCE)_glfwPlatformLoadModule(names[i]);
if (_glfw.win32.xinput.instance) if (_glfw.win32.xinput.instance)
{ {
_glfw.win32.xinput.GetCapabilities = (PFN_XInputGetCapabilities) _glfw.win32.xinput.GetCapabilities = (PFN_XInputGetCapabilities)
@ -134,7 +134,7 @@ static GLFWbool loadLibraries(void)
} }
} }
_glfw.win32.dwmapi.instance = _glfwPlatformLoadModule("dwmapi.dll"); _glfw.win32.dwmapi.instance = (HINSTANCE)_glfwPlatformLoadModule("dwmapi.dll");
if (_glfw.win32.dwmapi.instance) if (_glfw.win32.dwmapi.instance)
{ {
_glfw.win32.dwmapi.IsCompositionEnabled = (PFN_DwmIsCompositionEnabled) _glfw.win32.dwmapi.IsCompositionEnabled = (PFN_DwmIsCompositionEnabled)
@ -147,7 +147,7 @@ static GLFWbool loadLibraries(void)
_glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor"); _glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor");
} }
_glfw.win32.shcore.instance = _glfwPlatformLoadModule("shcore.dll"); _glfw.win32.shcore.instance = (HINSTANCE)_glfwPlatformLoadModule("shcore.dll");
if (_glfw.win32.shcore.instance) if (_glfw.win32.shcore.instance)
{ {
_glfw.win32.shcore.SetProcessDpiAwareness_ = (PFN_SetProcessDpiAwareness) _glfw.win32.shcore.SetProcessDpiAwareness_ = (PFN_SetProcessDpiAwareness)
@ -156,7 +156,7 @@ static GLFWbool loadLibraries(void)
_glfwPlatformGetModuleSymbol(_glfw.win32.shcore.instance, "GetDpiForMonitor"); _glfwPlatformGetModuleSymbol(_glfw.win32.shcore.instance, "GetDpiForMonitor");
} }
_glfw.win32.ntdll.instance = _glfwPlatformLoadModule("ntdll.dll"); _glfw.win32.ntdll.instance = (HINSTANCE)_glfwPlatformLoadModule("ntdll.dll");
if (_glfw.win32.ntdll.instance) if (_glfw.win32.ntdll.instance)
{ {
_glfw.win32.ntdll.RtlVerifyVersionInfo_ = (PFN_RtlVerifyVersionInfo) _glfw.win32.ntdll.RtlVerifyVersionInfo_ = (PFN_RtlVerifyVersionInfo)
@ -445,7 +445,7 @@ WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source)
return NULL; return NULL;
} }
target = _glfw_calloc(count, sizeof(WCHAR)); target = (WCHAR *)_glfw_calloc(count, sizeof(WCHAR));
if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, count)) if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, count))
{ {
@ -473,7 +473,7 @@ char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source)
return NULL; return NULL;
} }
target = _glfw_calloc(size, 1); target = (char*)_glfw_calloc(size, 1);
if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, size, NULL, NULL)) if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, size, NULL, NULL))
{ {

View File

@ -178,8 +178,8 @@ static const char* getDeviceDescription(const XINPUT_CAPABILITIES* xic)
// //
static int compareJoystickObjects(const void* first, const void* second) static int compareJoystickObjects(const void* first, const void* second)
{ {
const _GLFWjoyobjectWin32* fo = first; const _GLFWjoyobjectWin32* fo = (const _GLFWjoyobjectWin32 *)first;
const _GLFWjoyobjectWin32* so = second; const _GLFWjoyobjectWin32* so = (const _GLFWjoyobjectWin32 *)second;
if (fo->type != so->type) if (fo->type != so->type)
return fo->type - so->type; return fo->type - so->type;
@ -199,7 +199,7 @@ static GLFWbool supportsXInput(const GUID* guid)
if (GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)) != 0) if (GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)) != 0)
return GLFW_FALSE; return GLFW_FALSE;
ridl = _glfw_calloc(count, sizeof(RAWINPUTDEVICELIST)); ridl = (RAWINPUTDEVICELIST *)_glfw_calloc(count, sizeof(RAWINPUTDEVICELIST));
if (GetRawInputDeviceList(ridl, &count, sizeof(RAWINPUTDEVICELIST)) == (UINT) -1) if (GetRawInputDeviceList(ridl, &count, sizeof(RAWINPUTDEVICELIST)) == (UINT) -1)
{ {
@ -274,7 +274,7 @@ static void closeJoystick(_GLFWjoystick* js)
static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi, static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
void* user) void* user)
{ {
_GLFWobjenumWin32* data = user; _GLFWobjenumWin32* data = (_GLFWobjenumWin32 *)user;
_GLFWjoyobjectWin32* object = data->objects + data->objectCount; _GLFWjoyobjectWin32* object = data->objects + data->objectCount;
if (DIDFT_GETTYPE(doi->dwType) & DIDFT_AXIS) if (DIDFT_GETTYPE(doi->dwType) & DIDFT_AXIS)
@ -416,7 +416,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
data.device = device; data.device = device;
data.objects = _glfw_calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs, data.objects = (_GLFWjoyobjectWin32 *)_glfw_calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
sizeof(_GLFWjoyobjectWin32)); sizeof(_GLFWjoyobjectWin32));
if (FAILED(IDirectInputDevice8_EnumObjects(device, if (FAILED(IDirectInputDevice8_EnumObjects(device,

View File

@ -145,7 +145,7 @@ void _glfwPollMonitorsWin32(void)
disconnectedCount = _glfw.monitorCount; disconnectedCount = _glfw.monitorCount;
if (disconnectedCount) if (disconnectedCount)
{ {
disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*)); disconnected = (_GLFWmonitor**)_glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
memcpy(disconnected, memcpy(disconnected,
_glfw.monitors, _glfw.monitors,
_glfw.monitorCount * sizeof(_GLFWmonitor*)); _glfw.monitorCount * sizeof(_GLFWmonitor*));
@ -463,7 +463,7 @@ GLFWvidmode* _glfwGetVideoModesWin32(_GLFWmonitor* monitor, int* count)
if (!*count) if (!*count)
{ {
// HACK: Report the current mode if no valid modes were found // HACK: Report the current mode if no valid modes were found
result = _glfw_calloc(1, sizeof(GLFWvidmode)); result = (GLFWvidmode*)_glfw_calloc(1, sizeof(GLFWvidmode));
_glfwGetVideoModeWin32(monitor, result); _glfwGetVideoModeWin32(monitor, result);
*count = 1; *count = 1;
} }

View File

@ -530,7 +530,7 @@ static void maximizeWindowManually(_GLFWwindow* window)
// //
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
_GLFWwindow* window = GetPropW(hWnd, L"GLFW"); _GLFWwindow* window = (_GLFWwindow*)GetPropW(hWnd, L"GLFW");
if (!window) if (!window)
{ {
if (uMsg == WM_NCCREATE) if (uMsg == WM_NCCREATE)
@ -538,7 +538,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (_glfwIsWindows10Version1607OrGreaterWin32()) if (_glfwIsWindows10Version1607OrGreaterWin32())
{ {
const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam; const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
const _GLFWwndconfig* wndconfig = cs->lpCreateParams; const _GLFWwndconfig* wndconfig = (const _GLFWwndconfig*)cs->lpCreateParams;
// On per-monitor DPI aware V1 systems, only enable // On per-monitor DPI aware V1 systems, only enable
// non-client scaling for windows that scale the client area // non-client scaling for windows that scale the client area
@ -910,7 +910,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
if (size > (UINT) _glfw.win32.rawInputSize) if (size > (UINT) _glfw.win32.rawInputSize)
{ {
_glfw_free(_glfw.win32.rawInput); _glfw_free(_glfw.win32.rawInput);
_glfw.win32.rawInput = _glfw_calloc(size, 1); _glfw.win32.rawInput = (RAWINPUT *)_glfw_calloc(size, 1);
_glfw.win32.rawInputSize = size; _glfw.win32.rawInputSize = size;
} }
@ -1236,7 +1236,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
int i; int i;
const int count = DragQueryFileW(drop, 0xffffffff, NULL, 0); const int count = DragQueryFileW(drop, 0xffffffff, NULL, 0);
char** paths = _glfw_calloc(count, sizeof(char*)); char** paths = (char**)_glfw_calloc(count, sizeof(char*));
// Move the mouse to the position of the drop // Move the mouse to the position of the drop
DragQueryPoint(drop, &pt); DragQueryPoint(drop, &pt);
@ -1245,7 +1245,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
const UINT length = DragQueryFileW(drop, i, NULL, 0); const UINT length = DragQueryFileW(drop, i, NULL, 0);
WCHAR* buffer = _glfw_calloc((size_t) length + 1, sizeof(WCHAR)); WCHAR* buffer = (WCHAR*)_glfw_calloc((size_t) length + 1, sizeof(WCHAR));
DragQueryFileW(drop, i, buffer, length + 1); DragQueryFileW(drop, i, buffer, length + 1);
paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer); paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer);
@ -1291,13 +1291,13 @@ static int createNativeWindow(_GLFWwindow* window,
wc.lpszClassName = L"GLFW30"; wc.lpszClassName = L"GLFW30";
#endif #endif
// Load user-provided icon if available // Load user-provided icon if available
wc.hIcon = LoadImageW(GetModuleHandleW(NULL), wc.hIcon = (HICON)LoadImageW(GetModuleHandleW(NULL),
L"GLFW_ICON", IMAGE_ICON, L"GLFW_ICON", IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED); 0, 0, LR_DEFAULTSIZE | LR_SHARED);
if (!wc.hIcon) if (!wc.hIcon)
{ {
// No user-provided icon found, load default icon // No user-provided icon found, load default icon
wc.hIcon = LoadImageW(NULL, wc.hIcon = (HICON)LoadImageW(NULL,
IDI_APPLICATION, IMAGE_ICON, IDI_APPLICATION, IMAGE_ICON,
0, 0, LR_DEFAULTSIZE | LR_SHARED); 0, 0, LR_DEFAULTSIZE | LR_SHARED);
} }
@ -1321,7 +1321,7 @@ static int createNativeWindow(_GLFWwindow* window,
const int cursorWidth = GetSystemMetrics(SM_CXCURSOR); const int cursorWidth = GetSystemMetrics(SM_CXCURSOR);
const int cursorHeight = GetSystemMetrics(SM_CYCURSOR); const int cursorHeight = GetSystemMetrics(SM_CYCURSOR);
unsigned char* cursorPixels = _glfw_calloc(cursorWidth * cursorHeight, 4); unsigned char* cursorPixels = (unsigned char*)_glfw_calloc(cursorWidth * cursorHeight, 4);
if (!cursorPixels) if (!cursorPixels)
return GLFW_FALSE; return GLFW_FALSE;
@ -1769,7 +1769,7 @@ void _glfwGetWindowContentScaleWin32(_GLFWwindow* window, float* xscale, float*
{ {
const HANDLE handle = MonitorFromWindow(window->win32.handle, const HANDLE handle = MonitorFromWindow(window->win32.handle,
MONITOR_DEFAULTTONEAREST); MONITOR_DEFAULTTONEAREST);
_glfwGetHMONITORContentScaleWin32(handle, xscale, yscale); _glfwGetHMONITORContentScaleWin32((HMONITOR)handle, xscale, yscale);
} }
void _glfwIconifyWindowWin32(_GLFWwindow* window) void _glfwIconifyWindowWin32(_GLFWwindow* window)
@ -2124,7 +2124,7 @@ void _glfwPollEventsWin32(void)
handle = GetActiveWindow(); handle = GetActiveWindow();
if (handle) if (handle)
{ {
window = GetPropW(handle, L"GLFW"); window = (_GLFWwindow*)GetPropW(handle, L"GLFW");
if (window) if (window)
{ {
int i; int i;
@ -2326,7 +2326,7 @@ GLFWbool _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape)
return GLFW_FALSE; return GLFW_FALSE;
} }
cursor->win32.handle = LoadImageW(NULL, cursor->win32.handle = (HCURSOR)LoadImageW(NULL,
MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0, MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
LR_DEFAULTSIZE | LR_SHARED); LR_DEFAULTSIZE | LR_SHARED);
if (!cursor->win32.handle) if (!cursor->win32.handle)
@ -2369,7 +2369,7 @@ void _glfwSetClipboardStringWin32(const char* string)
return; return;
} }
buffer = GlobalLock(object); buffer = (WCHAR *)GlobalLock(object);
if (!buffer) if (!buffer)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@ -2432,7 +2432,7 @@ const char* _glfwGetClipboardStringWin32(void)
return NULL; return NULL;
} }
buffer = GlobalLock(object); buffer = (WCHAR *)GlobalLock(object);
if (!buffer) if (!buffer)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@ -2480,7 +2480,7 @@ EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs)
if (type) if (type)
{ {
*attribs = _glfw_calloc(3, sizeof(EGLint)); *attribs = (EGLint *)_glfw_calloc(3, sizeof(EGLint));
(*attribs)[0] = EGL_PLATFORM_ANGLE_TYPE_ANGLE; (*attribs)[0] = EGL_PLATFORM_ANGLE_TYPE_ANGLE;
(*attribs)[1] = type; (*attribs)[1] = type;
(*attribs)[2] = EGL_NONE; (*attribs)[2] = EGL_NONE;

View File

@ -213,7 +213,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
if (!_glfwIsValidContextConfig(&ctxconfig)) if (!_glfwIsValidContextConfig(&ctxconfig))
return NULL; return NULL;
window = _glfw_calloc(1, sizeof(_GLFWwindow)); window = (_GLFWwindow *)_glfw_calloc(1, sizeof(_GLFWwindow));
window->next = _glfw.windowListHead; window->next = _glfw.windowListHead;
_glfw.windowListHead = window; _glfw.windowListHead = window;