r1188 - in trunk/code: qcommon sdl sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Oct 1 03:56:39 EDT 2007


Author: tma
Date: 2007-10-01 03:56:32 -0400 (Mon, 01 Oct 2007)
New Revision: 1188

Modified:
   trunk/code/qcommon/qcommon.h
   trunk/code/sdl/sdl_gamma.c
   trunk/code/sdl/sdl_glimp.c
   trunk/code/sys/sys_main.c
Log:
* Remove some C99isms (f0rqu3)
* Provide Q_snprintf wrapper for snprintf (f0rqu3)


Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h	2007-09-24 10:01:10 UTC (rev 1187)
+++ trunk/code/qcommon/qcommon.h	2007-10-01 07:56:32 UTC (rev 1188)
@@ -689,10 +689,12 @@
 
 // vsnprintf is ISO/IEC 9899:1999
 // abstracting this to make it portable
-#ifdef WIN32
+#ifdef _WIN32
 #define Q_vsnprintf _vsnprintf
+#define Q_snprintf _snprintf
 #else
 #define Q_vsnprintf vsnprintf
+#define Q_snprintf snprintf
 #endif
 
 // centralizing the declarations for cl_cdkey

Modified: trunk/code/sdl/sdl_gamma.c
===================================================================
--- trunk/code/sdl/sdl_gamma.c	2007-09-24 10:01:10 UTC (rev 1187)
+++ trunk/code/sdl/sdl_gamma.c	2007-10-01 07:56:32 UTC (rev 1188)
@@ -48,23 +48,25 @@
 #include <windows.h>
 
 	// Win2K and newer put this odd restriction on gamma ramps...
-	OSVERSIONINFO	vinfo;
+	{
+		OSVERSIONINFO	vinfo;
 
-	vinfo.dwOSVersionInfoSize = sizeof( vinfo );
-	GetVersionEx( &vinfo );
-	if( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
-	{
-		Com_DPrintf( "performing gamma clamp.\n" );
-		for( j = 0 ; j < 3 ; j++ )
+		vinfo.dwOSVersionInfoSize = sizeof( vinfo );
+		GetVersionEx( &vinfo );
+		if( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
 		{
-			for( i = 0 ; i < 128 ; i++ )
+			Com_DPrintf( "performing gamma clamp.\n" );
+			for( j = 0 ; j < 3 ; j++ )
 			{
-				if( table[ j ] [ i] > ( ( 128 + i ) << 8 ) )
-					table[ j ][ i ] = ( 128 + i ) << 8;
+				for( i = 0 ; i < 128 ; i++ )
+				{
+					if( table[ j ] [ i] > ( ( 128 + i ) << 8 ) )
+						table[ j ][ i ] = ( 128 + i ) << 8;
+				}
+
+				if( table[ j ] [127 ] > 254 << 8 )
+					table[ j ][ 127 ] = 254 << 8;
 			}
-
-			if( table[ j ] [127 ] > 254 << 8 )
-				table[ j ][ 127 ] = 254 << 8;
 		}
 	}
 #endif

Modified: trunk/code/sdl/sdl_glimp.c
===================================================================
--- trunk/code/sdl/sdl_glimp.c	2007-09-24 10:01:10 UTC (rev 1187)
+++ trunk/code/sdl/sdl_glimp.c	2007-10-01 07:56:32 UTC (rev 1188)
@@ -115,6 +115,7 @@
 	int tcolorbits, tdepthbits, tstencilbits;
 	int i = 0;
 	SDL_Surface *vidscreen = NULL;
+	Uint32 flags = SDL_OPENGL;
 
 	ri.Printf( PRINT_ALL, "Initializing OpenGL display\n");
 
@@ -127,7 +128,6 @@
 	}
 	ri.Printf( PRINT_ALL, " %d %d\n", glConfig.vidWidth, glConfig.vidHeight);
 
-	Uint32 flags = SDL_OPENGL;
 	if (fullscreen)
 	{
 		flags |= SDL_FULLSCREEN;

Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c	2007-09-24 10:01:10 UTC (rev 1187)
+++ trunk/code/sys/sys_main.c	2007-10-01 07:56:32 UTC (rev 1188)
@@ -463,7 +463,7 @@
 	assert( name );
 
 	getcwd(curpath, sizeof(curpath));
-	snprintf (fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name);
+	Q_snprintf (fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name);
 
 	// TODO: use fs_searchpaths from files.c
 	pwdpath = Sys_Cwd();




More information about the quake3-commits mailing list