Fix warnings about sprintf use.

This commit is contained in:
Marek Roszko 2023-12-17 20:56:15 -05:00
parent 93811b801d
commit 71383c9c73
3 changed files with 8 additions and 8 deletions

View File

@ -238,7 +238,7 @@ void COAX::show_results()
while( ( m_parameters[CUTOFF_FREQUENCY_PRM] <= m_parameters[FREQUENCY_PRM] ) && ( m < 10 ) )
{
sprintf( txt, "H(n,%d) ", m );
snprintf( txt, sizeof( text ), "H(n,%d) ", m );
strcat( text, txt );
m++;
m_parameters[CUTOFF_FREQUENCY_PRM] =
@ -262,7 +262,7 @@ void COAX::show_results()
while( ( m_parameters[CUTOFF_FREQUENCY_PRM] <= m_parameters[FREQUENCY_PRM] ) && ( m < 10 ) )
{
sprintf( txt, "E(n,%d) ", m );
snprintf( txt, sizeof( text ), "E(n,%d) ", m );
strcat( text, txt );
m++;
m_parameters[CUTOFF_FREQUENCY_PRM] =

View File

@ -400,7 +400,7 @@ void RECTWAVEGUIDE::show_results()
if( m_parameters[FREQUENCY_PRM] >= ( fc( m, n ) ) )
{
sprintf( txt, "H(%d,%d) ", m, n );
snprintf( txt, sizeof( txt ), "H(%d,%d) ", m, n );
if( ( strlen( text ) + strlen( txt ) + 5 ) < MAXSTRLEN )
{
strcat( text, txt );
@ -430,7 +430,7 @@ void RECTWAVEGUIDE::show_results()
{
if( m_parameters[FREQUENCY_PRM] >= fc( m, n ) )
{
sprintf( txt, "E(%d,%d) ", m, n );
snprintf( txt, sizeof( txt ), "E(%d,%d) ", m, n );
if( ( strlen( text ) + strlen( txt ) + 5 ) < MAXSTRLEN )
{
strcat( text, txt );

View File

@ -62,11 +62,11 @@ void DL_WriterA::dxfReal( int gc, double value ) const
if( version==DL_Codes::AC1009_MIN )
{
sprintf( str, "%.6lf", value );
snprintf( str, sizeof( str ), "%.6lf", value );
}
else
{
sprintf( str, "%.16lf", value );
snprintf( str, sizeof( str ), "%.16lf", value );
}
// fix for german locale:
@ -122,7 +122,7 @@ void DL_WriterA::dxfHex( int gc, int value ) const
{
char str[12];
sprintf( str, "%0X", value );
snprintf( str, sizeof( str ), "%0X", value );
dxfString( gc, str );
}