1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 12:18:51 -05:00

Fixed warnings on VC++.

This commit is contained in:
Camilla Berglund 2013-01-06 21:02:57 +01:00
parent c3da8e417f
commit f0f4af4287
8 changed files with 28 additions and 9 deletions

View File

@ -11,6 +11,10 @@ endif()
include_directories(${GLFW_SOURCE_DIR}/include
${GLFW_SOURCE_DIR}/support)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
if (NOT APPLE)
# HACK: This is NOTFOUND on OS X 10.8
include_directories(${OPENGL_INCLUDE_DIR})

View File

@ -23,8 +23,6 @@
//
//========================================================================
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

View File

@ -228,7 +228,7 @@ void _glfwDestroyMonitors(void)
const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
const GLFWvidmode* desired)
{
unsigned int i;
int i;
unsigned int sizeDiff, leastSizeDiff = UINT_MAX;
unsigned int colorDiff, leastColorDiff = UINT_MAX;
const GLFWvidmode* current;

View File

@ -34,13 +34,19 @@
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "getopt.h"
/* 2013-01-06 Camilla Berglund <elmindreda@elmindreda.org>
*
* Only define _CRT_SECURE_NO_WARNINGS if not already defined.
*/
/* 2012-08-12 Lambert Clara <lambert.clara@yahoo.fr>
*
* Constify third argument of getopt.

View File

@ -21,6 +21,11 @@ freely, subject to the following restrictions:
distribution.
*/
/* 2013-01-06 Camilla Berglund <elmindreda@elmindreda.org>
*
* Added casts from time_t to DWORD to avoid warnings on VC++.
*/
#include "tinycthread.h"
#include <stdlib.h>
@ -291,8 +296,8 @@ int cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *ts)
struct timespec now;
if (clock_gettime(TIME_UTC, &now) == 0)
{
DWORD delta = (ts->tv_sec - now.tv_sec) * 1000 +
(ts->tv_nsec - now.tv_nsec + 500000) / 1000000;
DWORD delta = (DWORD) ((ts->tv_sec - now.tv_sec) * 1000 +
(ts->tv_nsec - now.tv_nsec + 500000) / 1000000);
return _cnd_timedwait_win32(cond, mtx, delta);
}
else
@ -471,8 +476,8 @@ int thrd_sleep(const struct timespec *time_point, struct timespec *remaining)
#if defined(_TTHREAD_WIN32_)
/* Delta in milliseconds */
delta = (time_point->tv_sec - now.tv_sec) * 1000 +
(time_point->tv_nsec - now.tv_nsec + 500000) / 1000000;
delta = (DWORD) ((time_point->tv_sec - now.tv_sec) * 1000 +
(time_point->tv_nsec - now.tv_nsec + 500000) / 1000000);
if (delta > 0)
{
Sleep(delta);

View File

@ -16,6 +16,10 @@ endif()
include_directories(${GLFW_SOURCE_DIR}/include
${GLFW_SOURCE_DIR}/support)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
if (NOT APPLE)
# HACK: This is NOTFOUND on OS X 10.8
include_directories(${OPENGL_INCLUDE_DIR})

View File

@ -31,8 +31,6 @@
//
//========================================================================
#define _CRT_SECURE_NO_WARNINGS
#include <GL/glfw3.h>
#include <stdio.h>

View File

@ -34,6 +34,10 @@
#include <string.h>
#include <stdlib.h>
#ifdef _MSC_VER
#define strdup(x) _strdup(x)
#endif
typedef struct Joystick
{
GLboolean present;