From 8bafa51d3b0ccb0e5d7a0384f7e60f682521d1c6 Mon Sep 17 00:00:00 2001 From: James Park Date: Sun, 21 Apr 2019 21:25:35 -0700 Subject: [PATCH] libobs: Fix GS_UNSIGNED_LONG definition GS_UNSIGNED_LONG is defined as sizeof(long) in some places, making it 8 outside of Windows instead of 4 as it should be. Fixes https://obsproject.com/mantis/view.php?id=1444 --- libobs-opengl/gl-indexbuffer.c | 2 +- libobs/graphics/graphics.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libobs-opengl/gl-indexbuffer.c b/libobs-opengl/gl-indexbuffer.c index 187835ea7..aef280f05 100644 --- a/libobs-opengl/gl-indexbuffer.c +++ b/libobs-opengl/gl-indexbuffer.c @@ -38,7 +38,7 @@ gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device, uint32_t flags) { struct gs_index_buffer *ib = bzalloc(sizeof(struct gs_index_buffer)); - size_t width = type == GS_UNSIGNED_LONG ? sizeof(long) : sizeof(short); + size_t width = type == GS_UNSIGNED_LONG ? 4 : 2; ib->device = device; ib->data = indices; diff --git a/libobs/graphics/graphics.c b/libobs/graphics/graphics.c index 467e904a2..671d92568 100644 --- a/libobs/graphics/graphics.c +++ b/libobs/graphics/graphics.c @@ -1517,9 +1517,7 @@ gs_indexbuffer_t *gs_indexbuffer_create(enum gs_index_type type, return NULL; if (indices && num && (flags & GS_DUP_BUFFER) != 0) { - size_t size = type == GS_UNSIGNED_SHORT - ? sizeof(unsigned short) - : sizeof(unsigned long); + size_t size = type == GS_UNSIGNED_SHORT ? 2 : 4; indices = bmemdup(indices, size * num); }