diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cb5eec62..d9ce8fb3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,4 @@ + include_directories(${GLFW_SOURCE_DIR}/src ${GLFW_BINARY_DIR}/src ${glfw_INCLUDE_DIRS}) @@ -38,6 +39,10 @@ elseif (_GLFW_X11_GLX) endif() endif() +if (MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif() + add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) set_target_properties(glfw PROPERTIES OUTPUT_NAME "${GLFW_LIB_NAME}") diff --git a/src/gamma.c b/src/gamma.c index eed0b66d..51e0ce14 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -67,8 +67,12 @@ GLFWAPI void glfwSetGamma(float gamma) value = (float) i / (float) (size - 1); // Apply gamma curve value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f; + // Clamp to value range - value = (float) fmax(fmin(value, 65535.f), 0.f); + if (value < 0.f) + value = 0.f; + else if (value > 65535.f) + value = 65535.f; ramp.red[i] = (unsigned short) value; ramp.green[i] = (unsigned short) value; diff --git a/src/monitor.c b/src/monitor.c index 3a4d9b90..269bef8a 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -34,6 +34,7 @@ #include #if defined(_MSC_VER) #include + #define strdup _strdup #endif diff --git a/src/win32_monitor.c b/src/win32_monitor.c index cbaf1b2c..a7d8bd24 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -271,7 +271,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count) return NULL; } - monitors[found]->Win32.name = wcsdup(adapter.DeviceName); + monitors[found]->Win32.name = _wcsdup(adapter.DeviceName); found++; } diff --git a/tests/threads.c b/tests/threads.c index 35c83716..49e3739a 100644 --- a/tests/threads.c +++ b/tests/threads.c @@ -28,6 +28,8 @@ // //======================================================================== +#include "tinycthread.h" + #include #include @@ -35,8 +37,6 @@ #include #include -#include "tinycthread.h" - typedef struct { GLFWwindow window;