mirror of
https://github.com/glfw/glfw.git
synced 2024-11-21 12:34:36 +00:00
Fix missing assertions for native access functions
This commit is contained in:
parent
738dd6ff1d
commit
38ec7abd3b
@ -32,6 +32,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
@ -628,6 +629,8 @@ void _glfwSetGammaRampCocoa(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
assert(monitor != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <float.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
// HACK: This enum value is missing from framework headers on OS X 10.11 despite
|
||||
// having been (according to documentation) added in Mac OS X 10.7
|
||||
@ -2041,6 +2042,8 @@ VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance,
|
||||
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||
@ -2056,6 +2059,8 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* handle)
|
||||
GLFWAPI id glfwGetCocoaView(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||
|
@ -909,6 +909,8 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
|
||||
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
|
||||
|
||||
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||
@ -923,6 +925,8 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
|
||||
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
|
||||
|
||||
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||
|
@ -678,6 +678,8 @@ GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
|
||||
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
@ -698,6 +700,8 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle)
|
||||
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
static void makeContextCurrentNSGL(_GLFWwindow* window)
|
||||
{
|
||||
@ -362,6 +363,8 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||
GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||
|
@ -370,6 +370,8 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* handle,
|
||||
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
|
||||
|
@ -776,6 +776,8 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
|
||||
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
// Callback for EnumDisplayMonitors in createMonitor
|
||||
@ -540,6 +541,8 @@ void _glfwSetGammaRampWin32(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
assert(monitor != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
|
||||
@ -554,6 +557,8 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* handle)
|
||||
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
assert(monitor != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <windowsx.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
@ -2577,6 +2578,8 @@ VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance,
|
||||
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "wayland-client-protocol.h"
|
||||
|
||||
@ -259,6 +260,8 @@ void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
assert(monitor != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
|
||||
|
@ -3298,6 +3298,8 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void)
|
||||
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
// Check whether the display mode should be included in enumeration
|
||||
@ -612,6 +613,8 @@ void _glfwSetGammaRampX11(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
|
||||
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
assert(monitor != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
@ -626,6 +629,8 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* handle)
|
||||
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
assert(monitor != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
|
@ -3303,6 +3303,8 @@ GLFWAPI Display* glfwGetX11Display(void)
|
||||
GLFWAPI Window glfwGetX11Window(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(None);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
@ -3316,6 +3318,8 @@ GLFWAPI Window glfwGetX11Window(GLFWwindow* handle)
|
||||
|
||||
GLFWAPI void glfwSetX11SelectionString(const char* string)
|
||||
{
|
||||
assert(string != NULL);
|
||||
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
|
Loading…
Reference in New Issue
Block a user