From 9fbba1638c0baf01267b6eb919343081a9305924 Mon Sep 17 00:00:00 2001 From: Chris Cascioli Date: Tue, 24 Feb 2026 21:32:33 -0500 Subject: [PATCH] Silences realloc warning C6308 and added name to credits --- readme.md | 2 ++ thirteen.h | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index b2b13b6..947788e 100644 --- a/readme.md +++ b/readme.md @@ -248,5 +248,7 @@ Francesco Carucci - MacOS/Metal and WASM/WebGPU implementation Nikita Lisitsa - Linux/X11+OpenGL implementation +Chris Cascioli - GetWindowHandle() and warning cleanup + Any contribution to this library earns you a spot in the credits, so feel free to add your name to this list as part of any submitted PR. Also add your name to the top of thirteen.h so the two places stay synchronized. Thank you for your contributions! diff --git a/thirteen.h b/thirteen.h index 738f06b..3e54d94 100644 --- a/thirteen.h +++ b/thirteen.h @@ -11,6 +11,8 @@ Alan Wolfe - API, examples and Win32/DX12 implementation Francesco Carucci - MacOS/Metal and WASM/WebGPU implementation Nikita Lisitsa - Linux/X11+OpenGL implementation + +Chris Cascioli - GetWindowHandle() and warning cleanup */ #pragma once @@ -2264,10 +2266,11 @@ namespace Thirteen if (width == Internal::width && height == Internal::height) return Pixels; - // Reallocate pixel buffer - Pixels = (uint8*)realloc(Pixels, width * height * 4); - if (!Pixels) + // Reallocate pixel buffer (checking temp result before Pixels assignment silences warning) + uint8* reallocResult = (uint8*)realloc(Pixels, width * height * 4); + if (!reallocResult) return nullptr; + Pixels = reallocResult; // Update dimensions Internal::width = width;