mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 14:52:00 +00:00
- Remove Q_strrchr(), replace with standard, portable strrchr()
- Add strrchr() to bg_lib.c, patch by DevHC
This commit is contained in:
parent
3ddc59a3ba
commit
b509d770a7
12 changed files with 27 additions and 29 deletions
|
@ -104,7 +104,7 @@ void CG_LoadingClient( int clientNum ) {
|
|||
|
||||
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 {
|
||||
|
|
|
@ -966,7 +966,7 @@ void CL_PlayDemo_f( void ) {
|
|||
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))
|
||||
{
|
||||
|
|
|
@ -240,6 +240,24 @@ char *strchr( const char *string, int c ) {
|
|||
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;
|
||||
|
|
|
@ -88,6 +88,7 @@ char *strcat( char *strDestination, const char *strSource );
|
|||
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 );
|
||||
|
|
|
@ -213,7 +213,7 @@ static void PlayerIntroSound( const char *modelAndSkin ) {
|
|||
char *skin;
|
||||
|
||||
Q_strncpyz( model, modelAndSkin, sizeof(model) );
|
||||
skin = Q_strrchr( model, '/' );
|
||||
skin = strrchr( model, '/' );
|
||||
if ( skin ) {
|
||||
*skin++ = '\0';
|
||||
}
|
||||
|
|
|
@ -626,7 +626,7 @@ Forces a client's skin (for teamplay)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ static void PlayerIcon( const char *modelAndSkin, char *iconName, int iconNameMa
|
|||
char model[MAX_QPATH];
|
||||
|
||||
Q_strncpyz( model, modelAndSkin, sizeof(model));
|
||||
skin = Q_strrchr( model, '/' );
|
||||
skin = strrchr( model, '/' );
|
||||
if ( skin ) {
|
||||
*skin++ = '\0';
|
||||
}
|
||||
|
|
|
@ -1617,7 +1617,7 @@ static void ServerPlayerIcon( const char *modelAndSkin, char *iconName, int icon
|
|||
char model[MAX_QPATH];
|
||||
|
||||
Q_strncpyz( model, modelAndSkin, sizeof(model));
|
||||
skin = Q_strrchr( model, '/' );
|
||||
skin = strrchr( model, '/' );
|
||||
if ( skin ) {
|
||||
*skin++ = '\0';
|
||||
}
|
||||
|
|
|
@ -1022,7 +1022,7 @@ qboolean FS_IsDemoExt(const char *filename, int namelen)
|
|||
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));
|
||||
|
|
|
@ -683,26 +683,6 @@ int Q_isalpha( int c )
|
|||
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;
|
||||
|
|
|
@ -734,7 +734,6 @@ int Q_strncmp (const char *s1, const char *s2, int n);
|
|||
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
|
||||
|
|
|
@ -864,7 +864,7 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
|
|||
|
||||
// Chop off filename extension.
|
||||
Com_sprintf(pakbuf, sizeof(pakbuf), "%s", cl->downloadName);
|
||||
pakptr = Q_strrchr(pakbuf, '.');
|
||||
pakptr = strrchr(pakbuf, '.');
|
||||
|
||||
if(pakptr)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue