[quake3-commits] r1987 - in trunk/code: cgame client game q3_ui qcommon server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun May 15 10:08:03 EDT 2011


Author: thilo
Date: 2011-05-15 10:08:03 -0400 (Sun, 15 May 2011)
New Revision: 1987

Modified:
   trunk/code/cgame/cg_info.c
   trunk/code/client/cl_main.c
   trunk/code/game/bg_lib.c
   trunk/code/game/bg_lib.h
   trunk/code/game/g_bot.c
   trunk/code/game/g_client.c
   trunk/code/q3_ui/ui_splevel.c
   trunk/code/q3_ui/ui_startserver.c
   trunk/code/qcommon/files.c
   trunk/code/qcommon/q_shared.c
   trunk/code/qcommon/q_shared.h
   trunk/code/server/sv_client.c
Log:
- Remove Q_strrchr(), replace with standard, portable strrchr()
- Add strrchr() to bg_lib.c, patch by DevHC


Modified: trunk/code/cgame/cg_info.c
===================================================================
--- trunk/code/cgame/cg_info.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/cgame/cg_info.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -104,7 +104,7 @@
 
 	if ( loadingPlayerIconCount < MAX_LOADING_PLAYER_ICONS ) {
 		Q_strncpyz( model, Info_ValueForKey( info, "model" ), sizeof( model ) );
-		skin = Q_strrchr( model, '/' );
+		skin = strrchr( model, '/' );
 		if ( skin ) {
 			*skin++ = '\0';
 		} else {

Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/client/cl_main.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -966,7 +966,7 @@
 	CL_Disconnect( qtrue );
 
 	// check for an extension .DEMOEXT_?? (?? is protocol)
-	ext_test = Q_strrchr(arg, '.');
+	ext_test = strrchr(arg, '.');
 	
 	if(ext_test && !Q_stricmpn(ext_test + 1, DEMOEXT, ARRAY_LEN(DEMOEXT) - 1))
 	{

Modified: trunk/code/game/bg_lib.c
===================================================================
--- trunk/code/game/bg_lib.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/game/bg_lib.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -240,6 +240,24 @@
 		return (char *) string;
 }
 
+char *strrchr(const char *string, int c)
+{
+	const char *found = 0;
+	
+	while(*string)
+	{
+		if(*string == c)
+			found = string;
+
+		string++;
+	}
+	
+	if(c)
+		return (char *) found;
+	else
+		return (char *) string;
+}
+
 char *strstr( const char *string, const char *strCharSet ) {
 	while ( *string ) {
 		int		i;

Modified: trunk/code/game/bg_lib.h
===================================================================
--- trunk/code/game/bg_lib.h	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/game/bg_lib.h	2011-05-15 14:08:03 UTC (rev 1987)
@@ -88,6 +88,7 @@
 char *strcpy( char *strDestination, const char *strSource );
 int strcmp( const char *string1, const char *string2 );
 char *strchr( const char *string, int c );
+char *strrchr(const char *string, int c);
 char *strstr( const char *string, const char *strCharSet );
 char *strncpy( char *strDest, const char *strSource, size_t count );
 int tolower( int c );

Modified: trunk/code/game/g_bot.c
===================================================================
--- trunk/code/game/g_bot.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/game/g_bot.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -213,7 +213,7 @@
 	char	*skin;
 
 	Q_strncpyz( model, modelAndSkin, sizeof(model) );
-	skin = Q_strrchr( model, '/' );
+	skin = strrchr( model, '/' );
 	if ( skin ) {
 		*skin++ = '\0';
 	}

Modified: trunk/code/game/g_client.c
===================================================================
--- trunk/code/game/g_client.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/game/g_client.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -626,7 +626,7 @@
 static void ForceClientSkin( gclient_t *client, char *model, const char *skin ) {
 	char *p;
 
-	if ((p = Q_strrchr(model, '/')) != 0) {
+	if ((p = strrchr(model, '/')) != 0) {
 		*p = 0;
 	}
 

Modified: trunk/code/q3_ui/ui_splevel.c
===================================================================
--- trunk/code/q3_ui/ui_splevel.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/q3_ui/ui_splevel.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -130,7 +130,7 @@
 	char	model[MAX_QPATH];
 
 	Q_strncpyz( model, modelAndSkin, sizeof(model));
-	skin = Q_strrchr( model, '/' );
+	skin = strrchr( model, '/' );
 	if ( skin ) {
 		*skin++ = '\0';
 	}

Modified: trunk/code/q3_ui/ui_startserver.c
===================================================================
--- trunk/code/q3_ui/ui_startserver.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/q3_ui/ui_startserver.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -1617,7 +1617,7 @@
 	char	model[MAX_QPATH];
 
 	Q_strncpyz( model, modelAndSkin, sizeof(model));
-	skin = Q_strrchr( model, '/' );
+	skin = strrchr( model, '/' );
 	if ( skin ) {
 		*skin++ = '\0';
 	}

Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/qcommon/files.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -1022,7 +1022,7 @@
 	char *ext_test;
 	int index, protocol;
 
-	ext_test = Q_strrchr(filename, '.');
+	ext_test = strrchr(filename, '.');
 	if(ext_test && !Q_stricmpn(ext_test + 1, DEMOEXT, ARRAY_LEN(DEMOEXT) - 1))
 	{
 		protocol = atoi(ext_test + ARRAY_LEN(DEMOEXT));

Modified: trunk/code/qcommon/q_shared.c
===================================================================
--- trunk/code/qcommon/q_shared.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/qcommon/q_shared.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -683,26 +683,6 @@
 	return ( 0 );
 }
 
-char* Q_strrchr( const char* string, int c )
-{
-	char cc = c;
-	char *s;
-	char *sp=(char *)0;
-
-	s = (char*)string;
-
-	while (*s)
-	{
-		if (*s == cc)
-			sp = s;
-		s++;
-	}
-	if (cc == 0)
-		sp = s;
-
-	return sp;
-}
-
 qboolean Q_isanumber( const char *s )
 {
 	char *p;

Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/qcommon/q_shared.h	2011-05-15 14:08:03 UTC (rev 1987)
@@ -734,7 +734,6 @@
 int		Q_stricmpn (const char *s1, const char *s2, int n);
 char	*Q_strlwr( char *s1 );
 char	*Q_strupr( char *s1 );
-char	*Q_strrchr( const char* string, int c );
 const char	*Q_stristr( const char *s, const char *find);
 
 // buffer size safe library replacements

Modified: trunk/code/server/sv_client.c
===================================================================
--- trunk/code/server/sv_client.c	2011-05-15 13:27:24 UTC (rev 1986)
+++ trunk/code/server/sv_client.c	2011-05-15 14:08:03 UTC (rev 1987)
@@ -864,7 +864,7 @@
 	
  		// Chop off filename extension.
 		Com_sprintf(pakbuf, sizeof(pakbuf), "%s", cl->downloadName);
-		pakptr = Q_strrchr(pakbuf, '.');
+		pakptr = strrchr(pakbuf, '.');
 		
 		if(pakptr)
 		{



More information about the quake3-commits mailing list