glfw: update setIcon hotfix for undefined behavior
See https://github.com/GLFW/glfw/pull/1986 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
82a9cf616d
commit
fd703e98e4
1 changed files with 6 additions and 6 deletions
|
|
@ -2123,8 +2123,8 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
|||
for (i = 0; i < count; i++)
|
||||
longCount += 2 + images[i].width * images[i].height;
|
||||
|
||||
long* icon = calloc(longCount, sizeof(long));
|
||||
long* target = icon;
|
||||
unsigned long* icon = calloc(longCount, sizeof(unsigned long));
|
||||
unsigned long* target = icon;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
|
@ -2133,10 +2133,10 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
|||
|
||||
for (j = 0; j < images[i].width * images[i].height; j++)
|
||||
{
|
||||
*target++ = (((long)images[i].pixels[j * 4 + 0]) << 16) |
|
||||
(((long)images[i].pixels[j * 4 + 1]) << 8) |
|
||||
(((long)images[i].pixels[j * 4 + 2]) << 0) |
|
||||
(((long)images[i].pixels[j * 4 + 3]) << 24);
|
||||
*target++ = (((unsigned long)images[i].pixels[j * 4 + 0]) << 16) |
|
||||
(((unsigned long)images[i].pixels[j * 4 + 1]) << 8) |
|
||||
(((unsigned long)images[i].pixels[j * 4 + 2]) << 0) |
|
||||
(((unsigned long)images[i].pixels[j * 4 + 3]) << 24);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue