X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=radiant%2Fxywindow.cpp;h=4f1d4082f08dfe74ad3be661a18fd395fbd9fdb9;hp=4e6b531e5aa1316257a27965c99ec1d9d426a924;hb=550b552a0b1912ac0ef62ffc611e23860749df50;hpb=a3d27eedb7107d7dd964fcc9d25c6464e3280b98 diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 4e6b531e..4f1d4082 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -1439,9 +1439,9 @@ void XYWnd::XY_LoadBackgroundImage( const char *name ){ } auto fileNameWithoutExt = u::buffer<512>(); - strncpy( fileNameWithoutExt, relative, sizeof( fileNameWithoutExt ) - 1 ); - fileNameWithoutExt[512 - 1] = '\0'; - fileNameWithoutExt[strlen( fileNameWithoutExt ) - 4] = '\0'; + fileNameWithoutExt.copy(relative); + fileNameWithoutExt.terminate(); + fileNameWithoutExt.mut()[fileNameWithoutExt.strlen() - 4] = '\0'; Image *image = QERApp_LoadImage( 0, fileNameWithoutExt ); if ( !image ) { @@ -1718,12 +1718,12 @@ void XYWnd::XY_DrawGrid( void ) { float offy = m_vOrigin[nDim1] - w + 4 / m_fScale; for ( x = xb - fmod( xb, stepx ); x <= xe ; x += stepx ) { glRasterPos2f( x, offx ); - sprintf( text, "%g", x ); + text.sprintf( "%g", x ); GlobalOpenGL().drawString( text ); } for ( y = yb - fmod( yb, stepy ); y <= ye ; y += stepy ) { glRasterPos2f( offy, y ); - sprintf( text, "%g", y ); + text.sprintf( "%g", y ); GlobalOpenGL().drawString( text ); } @@ -1847,7 +1847,7 @@ void XYWnd::XY_DrawBlockGrid(){ for ( y = yb ; y < ye ; y += g_xywindow_globals_private.blockSize ) { glRasterPos2f( x + ( g_xywindow_globals_private.blockSize / 2 ), y + ( g_xywindow_globals_private.blockSize / 2 ) ); - sprintf( text, "%i,%i",(int)floor( x / g_xywindow_globals_private.blockSize ), (int)floor( y / g_xywindow_globals_private.blockSize ) ); + text.sprintf( "%i,%i",(int)floor( x / g_xywindow_globals_private.blockSize ), (int)floor( y / g_xywindow_globals_private.blockSize ) ); GlobalOpenGL().drawString( text ); } }