mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
public: crtlib: add safe COM_DefaultExtension and COM_ReplaceExtension
This commit is contained in:
parent
cfdfdd5c93
commit
ff436ae100
@ -714,7 +714,7 @@ void COM_StripExtension( char *path )
|
||||
COM_DefaultExtension
|
||||
==================
|
||||
*/
|
||||
void COM_DefaultExtension( char *path, const char *extension )
|
||||
void COM_DefaultExtension( char *path, const char *extension, size_t size )
|
||||
{
|
||||
const char *src;
|
||||
size_t len;
|
||||
@ -731,7 +731,7 @@ void COM_DefaultExtension( char *path, const char *extension )
|
||||
src--;
|
||||
}
|
||||
|
||||
Q_strcpy( &path[len], extension );
|
||||
Q_strncpy( &path[len], extension, size - len );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -739,10 +739,10 @@ void COM_DefaultExtension( char *path, const char *extension )
|
||||
COM_ReplaceExtension
|
||||
==================
|
||||
*/
|
||||
void COM_ReplaceExtension( char *path, const char *extension )
|
||||
void COM_ReplaceExtension( char *path, const char *extension, size_t size )
|
||||
{
|
||||
COM_StripExtension( path );
|
||||
COM_DefaultExtension( path, extension );
|
||||
COM_DefaultExtension( path, extension, size );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -79,15 +79,14 @@ const byte *Q_memmem( const byte *haystack, size_t haystacklen, const byte *need
|
||||
const char *Q_timestamp( int format );
|
||||
int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list args );
|
||||
int Q_snprintf( char *buffer, size_t buffersize, const char *format, ... ) _format( 3 );
|
||||
int Q_sprintf( char *buffer, const char *format, ... ) _format( 2 );
|
||||
#define Q_strpbrk strpbrk
|
||||
void COM_StripColors( const char *in, char *out );
|
||||
#define Q_memprint( val ) Q_pretifymem( val, 2 )
|
||||
char *Q_pretifymem( float value, int digitsafterdecimal );
|
||||
void COM_FileBase( const char *in, char *out, size_t size );
|
||||
const char *COM_FileExtension( const char *in );
|
||||
void COM_DefaultExtension( char *path, const char *extension );
|
||||
void COM_ReplaceExtension( char *path, const char *extension );
|
||||
void COM_DefaultExtension( char *path, const char *extension, size_t size );
|
||||
void COM_ReplaceExtension( char *path, const char *extension, size_t size );
|
||||
void COM_ExtractFilePath( const char *path, char *dest );
|
||||
const char *COM_FileWithoutPath( const char *in );
|
||||
void COM_StripExtension( char *path );
|
||||
|
Loading…
x
Reference in New Issue
Block a user