Fixed various VC++ warnings.

master
Camilla Berglund ago%!(EXTRA string=13 years)
parent 5bbbf8640e
commit 633839502c
  1. 5
      src/CMakeLists.txt
  2. 6
      src/gamma.c
  3. 1
      src/monitor.c
  4. 2
      src/win32_monitor.c
  5. 4
      tests/threads.c

@ -1,3 +1,4 @@
include_directories(${GLFW_SOURCE_DIR}/src include_directories(${GLFW_SOURCE_DIR}/src
${GLFW_BINARY_DIR}/src ${GLFW_BINARY_DIR}/src
${glfw_INCLUDE_DIRS}) ${glfw_INCLUDE_DIRS})
@ -38,6 +39,10 @@ elseif (_GLFW_X11_GLX)
endif() endif()
endif() endif()
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
set_target_properties(glfw PROPERTIES OUTPUT_NAME "${GLFW_LIB_NAME}") set_target_properties(glfw PROPERTIES OUTPUT_NAME "${GLFW_LIB_NAME}")

@ -67,8 +67,12 @@ GLFWAPI void glfwSetGamma(float gamma)
value = (float) i / (float) (size - 1); value = (float) i / (float) (size - 1);
// Apply gamma curve // Apply gamma curve
value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f; value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f;
// Clamp to value range // 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.red[i] = (unsigned short) value;
ramp.green[i] = (unsigned short) value; ramp.green[i] = (unsigned short) value;

@ -34,6 +34,7 @@
#include <stdlib.h> #include <stdlib.h>
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include <malloc.h> #include <malloc.h>
#define strdup _strdup
#endif #endif

@ -271,7 +271,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
return NULL; return NULL;
} }
monitors[found]->Win32.name = wcsdup(adapter.DeviceName); monitors[found]->Win32.name = _wcsdup(adapter.DeviceName);
found++; found++;
} }

@ -28,6 +28,8 @@
// //
//======================================================================== //========================================================================
#include "tinycthread.h"
#include <GL/glfw3.h> #include <GL/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -35,8 +37,6 @@
#include <math.h> #include <math.h>
#include <assert.h> #include <assert.h>
#include "tinycthread.h"
typedef struct typedef struct
{ {
GLFWwindow window; GLFWwindow window;

Loading…
Cancel
Save