Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
3c427645
Commit
3c427645
authored
Feb 22, 2015
by
Mark Roszko
Committed by
Wayne Stambaugh
Feb 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix snprintf usage.
parent
1e6c8cf8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
9 deletions
+7
-9
sch_item_struct.cpp
eeschema/sch_item_struct.cpp
+4
-6
libdxfrw.cpp
lib_dxf/libdxfrw.cpp
+1
-1
python_scripting.cpp
scripting/python_scripting.cpp
+2
-2
No files found.
eeschema/sch_item_struct.cpp
View file @
3c427645
...
...
@@ -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-201
1
KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-201
5
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
);
}
...
...
lib_dxf/libdxfrw.cpp
View file @
3c427645
...
...
@@ -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
;
...
...
scripting/python_scripting.cpp
View file @
3c427645
...
...
@@ -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
;
s
printf
(
cmd
,
"import sys, traceback
\n
"
s
nprintf
(
cmd
,
sizeof
(
cmd
)
,
"import sys, traceback
\n
"
"sys.path.append(
\"
.
\"
)
\n
"
"import pcbnew
\n
"
"pcbnew.LoadPlugins(
\"
%s
\"
)"
,
aUserPluginsPath
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment