mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-30 16:54:29 +00:00
ref_gl: simplified strings operations.
This commit is contained in:
parent
63d8794902
commit
5f54582692
@ -1299,13 +1299,17 @@ GL_CheckTexName
|
|||||||
*/
|
*/
|
||||||
qboolean GL_CheckTexName( const char *name )
|
qboolean GL_CheckTexName( const char *name )
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
if( !COM_CheckString( name ))
|
if( !COM_CheckString( name ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
len = Q_strlen( name );
|
||||||
|
|
||||||
// because multi-layered textures can exceed name string
|
// because multi-layered textures can exceed name string
|
||||||
if( Q_strlen( name ) >= sizeof( gl_textures->name ))
|
if( len >= sizeof( gl_textures->name ))
|
||||||
{
|
{
|
||||||
gEngfuncs.Con_Printf( S_ERROR "LoadTexture: too long name %s (%d)\n", name, Q_strlen( name ));
|
gEngfuncs.Con_Printf( S_ERROR "LoadTexture: too long name %s (%d)\n", name, len );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1529,7 +1533,7 @@ int GL_LoadTextureArray( const char **names, int flags )
|
|||||||
for( i = 0; i < numLayers; i++ )
|
for( i = 0; i < numLayers; i++ )
|
||||||
{
|
{
|
||||||
COM_FileBase( names[i], basename );
|
COM_FileBase( names[i], basename );
|
||||||
Q_strncat( name, va( "%s", basename ), sizeof( name ));
|
Q_strncat( name, basename, sizeof( name ) );
|
||||||
if( i != ( numLayers - 1 )) Q_strncat( name, "|", sizeof( name ));
|
if( i != ( numLayers - 1 )) Q_strncat( name, "|", sizeof( name ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ void R_SetupSky( const char *skyboxname )
|
|||||||
{
|
{
|
||||||
char loadname[MAX_STRING];
|
char loadname[MAX_STRING];
|
||||||
char sidename[MAX_STRING];
|
char sidename[MAX_STRING];
|
||||||
int i, result;
|
int i, result, len;
|
||||||
|
|
||||||
if( !COM_CheckString( skyboxname ))
|
if( !COM_CheckString( skyboxname ))
|
||||||
{
|
{
|
||||||
@ -424,8 +424,10 @@ void R_SetupSky( const char *skyboxname )
|
|||||||
COM_StripExtension( loadname );
|
COM_StripExtension( loadname );
|
||||||
|
|
||||||
// kill the underline suffix to find them manually later
|
// kill the underline suffix to find them manually later
|
||||||
if( loadname[Q_strlen( loadname ) - 1] == '_' )
|
len = Q_strlen( loadname );
|
||||||
loadname[Q_strlen( loadname ) - 1] = '\0';
|
|
||||||
|
if( loadname[len - 1] == '_' )
|
||||||
|
loadname[len - 1] = '\0';
|
||||||
result = CheckSkybox( loadname );
|
result = CheckSkybox( loadname );
|
||||||
|
|
||||||
// to prevent infinite recursion if default skybox was missed
|
// to prevent infinite recursion if default skybox was missed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user