Replaced Com_sprintf with Q_vsprintf_s, replaced strlen with Q_strlen, replaced strcpy with Q_strcpy_s

Replaced Com_sprintf with Q_vsprintf_s, replaced strlen with Q_strlen, replaced strcpy with Q_strcpy_s

diff --git a/src/engine/GPURenderer/r_backend.cpp b/src/engine/GPURenderer/r_backend.cpp
index 4ecdad0..ab9d777 100644
--- a/src/engine/GPURenderer/r_backend.cpp
+++ b/src/engine/GPURenderer/r_backend.cpp
@@ -1965,7 +1965,7 @@ const void* RB_ExportCubemaps( const void* data )
             }
             else
             {
-                Com_sprintf( filename, MAX_QPATH, "cubemaps/%s/%03d.dds", tr.world->baseName, i );
+                Q_vsprintf_s( filename, MAX_QPATH, MAX_QPATH, "cubemaps/%s/%03d.dds", tr.world->baseName, i );
             }
             
             R_SaveDDS( filename, cubemapPixels, r_cubemapSize->integer, r_cubemapSize->integer, 6 );
diff --git a/src/engine/GPURenderer/r_bsp_tech3.cpp b/src/engine/GPURenderer/r_bsp_tech3.cpp
index 952c7dc..d528b9d 100644
--- a/src/engine/GPURenderer/r_bsp_tech3.cpp
+++ b/src/engine/GPURenderer/r_bsp_tech3.cpp
@@ -282,7 +282,7 @@ static	void R_LoadLightmaps( lump_t* l, lump_t* surfs )
         // Check for the first hdr lightmap, if it exists, use GL_RGBA16 for textures.
         valueType filename[MAX_QPATH];
         
-        Com_sprintf( filename, sizeof( filename ), "maps/%s/lm_0000.hdr", s_worldData.baseName );
+        Q_vsprintf_s( filename, sizeof( filename ), sizeof( filename ), "maps/%s/lm_0000.hdr", s_worldData.baseName );
         if( fileSystem->FileExists( filename ) )
             textureInternalFormat = GL_RGBA16;
     }
@@ -327,7 +327,7 @@ static	void R_LoadLightmaps( lump_t* l, lump_t* surfs )
             // look for hdr lightmaps
             if( textureInternalFormat == GL_RGBA16 )
             {
-                Com_sprintf( filename, sizeof( filename ), "maps/%s/lm_%04d.hdr", s_worldData.baseName, i * ( tr.worldDeluxeMapping ? 2 : 1 ) );
+                Q_vsprintf_s( filename, sizeof( filename ), sizeof( filename ), "maps/%s/lm_%04d.hdr", s_worldData.baseName, i * ( tr.worldDeluxeMapping ? 2 : 1 ) );
                 //CL_RefPrintf(PRINT_ALL, "looking for %s\n", filename);
                 
                 size = fileSystem->ReadFile( filename, ( void** )&hdrLightmap );
@@ -1830,7 +1830,7 @@ static	void R_LoadSurfaces( lump_t* surfs, lump_t* verts, lump_t* indexLump )
         valueType filename[MAX_QPATH];
         sint size;
         
-        Com_sprintf( filename, sizeof( filename ), "maps/%s/vertlight.raw", s_worldData.baseName );
+        Q_vsprintf_s( filename, sizeof( filename ), sizeof( filename ), "maps/%s/vertlight.raw", s_worldData.baseName );
         //CL_RefPrintf(PRINT_ALL, "looking for %s\n", filename);
         
         size = fileSystem->ReadFile( filename, ( void** )&hdrVertColors );
@@ -1951,7 +1951,7 @@ static	void R_LoadSubmodels( lump_t* l )
         
         model->type = MOD_BRUSH;
         model->bmodel = out;
-        Com_sprintf( model->name, sizeof( model->name ), "*%d", i );
+        Q_vsprintf_s( model->name, sizeof( model->name ), sizeof( model->name ), "*%d", i );
         
         for( j = 0 ; j < 3 ; j++ )
         {
@@ -2355,7 +2355,7 @@ void R_LoadLightGrid( lump_t* l )
         float32* hdrLightGrid;
         sint size;
         
-        Com_sprintf( filename, sizeof( filename ), "maps/%s/lightgrid.raw", s_worldData.baseName );
+        Q_vsprintf_s( filename, sizeof( filename ), sizeof( filename ), "maps/%s/lightgrid.raw", s_worldData.baseName );
         //CL_RefPrintf(PRINT_ALL, "looking for %s\n", filename);
         
         size = fileSystem->ReadFile( filename, ( void** )&hdrLightGrid );
@@ -2838,7 +2838,7 @@ void R_LoadCubemaps( void )
         valueType filename[MAX_QPATH];
         cubemap_t* cubemap = &tr.cubemaps[i];
         
-        Com_sprintf( filename, MAX_QPATH, "cubemaps/%s/%03d.dds", tr.world->baseName, i );
+        Q_vsprintf_s( filename, MAX_QPATH, MAX_QPATH, "cubemaps/%s/%03d.dds", tr.world->baseName, i );
         
         cubemap->image = R_FindImageFile( filename, IMGTYPE_COLORALPHA, flags );
     }
@@ -3110,7 +3110,7 @@ void idRenderSystemLocal::LoadWorld( pointer name )
             {
                 sint j;
                 
-                Com_sprintf( fileName, sizeof( fileName ), "primarylg%d.tga", i );
+                Q_vsprintf_s( fileName, sizeof( fileName ), sizeof( fileName ), "primarylg%d.tga", i );
                 
                 out = buffer + 18;
                 for( j = 0; j < w->lightGridBounds[0] * w->lightGridBounds[1]; j++ )
diff --git a/src/engine/GPURenderer/r_font.cpp b/src/engine/GPURenderer/r_font.cpp
index 2623b4e..82736e3 100644
--- a/src/engine/GPURenderer/r_font.cpp
+++ b/src/engine/GPURenderer/r_font.cpp
@@ -391,7 +391,7 @@ void idRenderSystemLocal::RegisterFont( pointer fontName, sint pointSize, fontIn
         return;
     }
     
-    Com_sprintf( name, sizeof( name ), "fonts/fontImage_%i.dat", pointSize );
+    Q_vsprintf_s( name, sizeof( name ), sizeof( name ), "fonts/fontImage_%i.dat", pointSize );
     for( i = 0; i < registeredFontCount; i++ )
     {
         if( Q_stricmp( name, registeredFont[i].name ) == 0 )
@@ -540,13 +540,13 @@ void idRenderSystemLocal::RegisterFont( pointer fontName, sint pointSize, fontIn
                 imageBuff[left++] = ( ( float32 )out[k] * max );
             }
     
-            Com_sprintf( name, sizeof( name ), "fonts/fontImage_%i_%i.tga", imageNumber++, pointSize );
+            Q_vsprintf_s( name, sizeof( name ), sizeof( name ), "fonts/fontImage_%i_%i.tga", imageNumber++, pointSize );
             if( r_saveFontData->integer )
             {
                 WriteTGA( name, imageBuff, 256, 256 );
             }
     
-            //Com_sprintf (name, sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize);
+            //Q_vsprintf_s (name, sizeof(name), sizeof(name), "fonts/fontImage_%i_%i", imageNumber++, pointSize);
             image = R_CreateImage( name, imageBuff, 256, 256, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE, 0 );
             h = RE_RegisterShaderFromImage( name, LIGHTMAP_2D, image, false );
             for( j = lastStart; j < i; j++ )
diff --git a/src/engine/GPURenderer/r_glsl.cpp b/src/engine/GPURenderer/r_glsl.cpp
index 2ef742b..41ec560 100644
--- a/src/engine/GPURenderer/r_glsl.cpp
+++ b/src/engine/GPURenderer/r_glsl.cpp
@@ -426,11 +426,11 @@ static sint GLSL_LoadGPUShaderText( pointer name, uint shaderType, valueType* de
     
     if( shaderType == GL_VERTEX_SHADER )
     {
-        Com_sprintf( filename, sizeof( filename ), "renderProgs/%s.vertex", name );
+        Q_vsprintf_s( filename, sizeof( filename ), sizeof( filename ), "renderProgs/%s.vertex", name );
     }
     else
     {
-        Com_sprintf( filename, sizeof( filename ), "renderProgs/%s.fragment", name );
+        Q_vsprintf_s( filename, sizeof( filename ), sizeof( filename ), "renderProgs/%s.fragment", name );
     }
     
     size = fileSystem->ReadFile( filename, ( void** )&buffer );
diff --git a/src/engine/GPURenderer/r_image.cpp b/src/engine/GPURenderer/r_image.cpp
index 7028c81..2ebc03b 100644
--- a/src/engine/GPURenderer/r_image.cpp
+++ b/src/engine/GPURenderer/r_image.cpp
@@ -2197,7 +2197,7 @@ image_t* R_CreateImage2( pointer name, uchar8* pic, sint width, sint height, uin
     image->type = type;
     image->flags = flags;
     
-    strcpy( image->imgName, name );
+    Q_strcpy_s( image->imgName, name );
     
     image->width = width;
     image->height = height;
diff --git a/src/engine/GPURenderer/r_init.cpp b/src/engine/GPURenderer/r_init.cpp
index c5cbf7e..c9f63fd 100644
--- a/src/engine/GPURenderer/r_init.cpp
+++ b/src/engine/GPURenderer/r_init.cpp
@@ -371,25 +371,25 @@ void GL_CheckErrs( pointer file, sint line )
     switch( err )
     {
         case GL_INVALID_ENUM:
-            strcpy( s, "GL_INVALID_ENUM" );
+            Q_strcpy_s( s, "GL_INVALID_ENUM" );
             break;
         case GL_INVALID_VALUE:
-            strcpy( s, "GL_INVALID_VALUE" );
+            Q_strcpy_s( s, "GL_INVALID_VALUE" );
             break;
         case GL_INVALID_OPERATION:

[... diff too long, it was truncated ...]

GitHub
sha: 8420b815