Fix snprintf usage.
This commit is contained in:
parent
1e6c8cf88f
commit
3c42764563
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -112,8 +112,7 @@ std::string SCH_ITEM::FormatInternalUnits( int aValue )
|
|||
|
||||
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
|
||||
{
|
||||
// printf( "f: " );
|
||||
len = snprintf( buf, 49, "%.10f", engUnits );
|
||||
len = snprintf( buf, sizeof(buf), "%.10f", engUnits );
|
||||
|
||||
while( --len > 0 && buf[len] == '0' )
|
||||
buf[len] = '\0';
|
||||
|
@ -122,8 +121,7 @@ std::string SCH_ITEM::FormatInternalUnits( int aValue )
|
|||
}
|
||||
else
|
||||
{
|
||||
// printf( "g: " );
|
||||
len = snprintf( buf, 49, "%.10g", engUnits );
|
||||
len = snprintf( buf, sizeof(buf), "%.10g", engUnits );
|
||||
}
|
||||
|
||||
return std::string( buf, len );
|
||||
|
@ -135,7 +133,7 @@ std::string SCH_ITEM::FormatAngle( double aAngle )
|
|||
char temp[50];
|
||||
int len;
|
||||
|
||||
len = snprintf( temp, 49, "%.10g", aAngle / 10.0 );
|
||||
len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
|
||||
|
||||
return std::string( temp, len );
|
||||
}
|
||||
|
|
|
@ -3818,7 +3818,7 @@ std::string dxfRW::toHexStr( int n )
|
|||
{
|
||||
#if defined(__APPLE__)
|
||||
char buffer[9] = { '\0' };
|
||||
snprintf( buffer, 9, "%X", n );
|
||||
snprintf( buffer, sizeof(buffer), "%X", n );
|
||||
return std::string( buffer );
|
||||
#else
|
||||
std::ostringstream Convert;
|
||||
|
|
|
@ -144,7 +144,7 @@ bool pcbnewInitPythonScripting( const char * aUserPluginsPath )
|
|||
// Make sure that that the correct version of wxPython is loaded. In systems where there
|
||||
// are different versions of wxPython installed this can lead to select wrong wxPython
|
||||
// version being selected.
|
||||
snprintf( cmd, 1023, "import wxversion; wxversion.select('%s')", WXPYTHON_VERSION );
|
||||
snprintf( cmd, sizeof(cmd), "import wxversion; wxversion.select('%s')", WXPYTHON_VERSION );
|
||||
PyRun_SimpleString( cmd );
|
||||
|
||||
// Load the wxPython core API. Imports the wx._core_ module and sets a
|
||||
|
@ -168,7 +168,7 @@ bool pcbnewInitPythonScripting( const char * aUserPluginsPath )
|
|||
{
|
||||
char cmd[1024];
|
||||
PyLOCK lock;
|
||||
sprintf( cmd, "import sys, traceback\n"
|
||||
snprintf( cmd, sizeof(cmd), "import sys, traceback\n"
|
||||
"sys.path.append(\".\")\n"
|
||||
"import pcbnew\n"
|
||||
"pcbnew.LoadPlugins(\"%s\")", aUserPluginsPath );
|
||||
|
|
Loading…
Reference in New Issue