/* will return true for VC8 (VC2005) and higher */
#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 )
size_t sLen;
+#if HAVE_ERRNO
errno_t err;
#endif
+#endif
if( fgState.Initialised )
fgError( "illegal glutInit() reinitialization attempt" );
#ifndef _WIN32_WCE
{
/* will return true for VC8 (VC2005) and higher */
-#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 )
+#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 ) && HAVE_ERRNO
char* fps = NULL;
err = _dupenv_s( &fps, &sLen, "GLUT_FPS" );
if (err)
fgState.FPSInterval = interval;
}
/* will return true for VC8 (VC2005) and higher */
-#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 )
+#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 ) && HAVE_ERRNO
free ( fps ); fps = NULL; /* dupenv_s allocates a string that we must free */
#endif
}
/* will return true for VC8 (VC2005) and higher */
-#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 )
+#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 ) && HAVE_ERRNO
err = _dupenv_s( &displayName, &sLen, "DISPLAY" );
if (err)
fgError("Error getting DISPLAY environment variable");
*/
fghInitialize( displayName );
/* will return true for VC8 (VC2005) and higher */
-#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 )
+#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 ) && HAVE_ERRNO
free ( displayName ); displayName = NULL; /* dupenv_s allocates a string that we must free */
#endif
#include "freeglut_internal.h"
#if TARGET_HOST_POSIX_X11
+#if HAVE_ERRNO
#include <errno.h>
+#endif
#include <sys/ioctl.h>
#include <sys/time.h>
#include <time.h>
if( !fgState.InputDevsInitialised )
{
/* will return true for VC8 (VC2005) and higher */
-#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 )
+#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 ) && HAVE_ERRNO
char *dial_device=NULL;
size_t sLen;
errno_t err = _dupenv_s( &dial_device, &sLen, "GLUT_DIALS_SERIAL" );
if ( !dial_device ) return;
if ( !( dialbox_port = serial_open ( dial_device ) ) ) return;
/* will return true for VC8 (VC2005) and higher */
-#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 )
+#if TARGET_HOST_MS_WINDOWS && ( _MSC_VER >= 1400 ) && HAVE_ERRNO
free ( dial_device ); dial_device = NULL; /* dupenv_s allocates a string that we must free */
#endif
serial_putchar(dialbox_port,DIAL_INITIALIZE);
# if HAVE_FCNTL_H
# include <fcntl.h>
# endif
-# include <errno.h>
+# if HAVE_ERRNO
+# include <errno.h>
+# endif
# if defined(__FreeBSD__) || defined(__NetBSD__)
/* XXX The below hack is done until freeglut's autoconf is updated. */
# define HAVE_USB_JS 1
close(f);
if (cp)
return 1;
- } else if (errno == EACCES) {
+ }
+#if HAVE_ERRNO
+ else if (errno == EACCES) {
if (!protection_warned) {
fgWarning ( "Can't open %s for read!", buf );
protection_warned = 1;
}
}
+#endif
}
return 0;
}
if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 )
{
+#if HAVE_ERRNO
fgWarning ( "error: %s: %s", os->fname, strerror( errno ) );
+#else
+ fgWarning ( "error: %s", os->fname );
+#endif
return FALSE;
}
if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0)
{
/*** XXX {report_id} may not be the right variable? ***/
+#if HAVE_ERRNO
fgWarning ( "error: %s%d: %s", UHIDDEV, report_id, strerror( errno ) );
+#else
+ fgWarning ( "error: %s%d", UHIDDEV, report_id );
+#endif
return FALSE;
}
}
}
}
+#if HAVE_ERRNO
if ( len < 0 && errno != EAGAIN )
+#else
+ if ( len < 0 )
+#endif
{
perror( joy->os->fname );
joy->error = 1;
if ( status != sizeof( struct js_event ) )
{
+#if HAVE_ERRNO
if ( errno == EAGAIN )
{
/* Use the old values */
sizeof( float ) * joy->num_axes );
return;
}
+#endif
fgWarning ( "%s", joy->fname );
joy->error = GL_TRUE;
joy->os->fd = open( joy->os->fname, O_RDONLY | O_NONBLOCK);
+#if HAVE_ERRNO
if( joy->os->fd < 0 && errno == EACCES )
fgWarning ( "%s exists but is not readable by you", joy->os->fname );
+#endif
joy->error =( joy->os->fd < 0 );
#include <GL/freeglut.h>
#include "freeglut_internal.h"
-#include <errno.h>
+#if HAVE_ERRNO
+# include <errno.h>
+#endif
#include <stdarg.h>
#if HAVE_VPRINTF
# define VFPRINTF(s,f,a) vfprintf((s),(f),(a))
wait.tv_usec = (msec % 1000) * 1000;
err = select( socket+1, &fdset, NULL, NULL, &wait );
+#if HAVE_ERRNO
if( ( -1 == err ) && ( errno != EINTR ) )
fgWarning ( "freeglut select() error: %d", errno );
+#endif
}
#elif TARGET_HOST_MS_WINDOWS
MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLINPUT );