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
dcdaee4c
Commit
dcdaee4c
authored
Feb 17, 2015
by
Cirilo Bernardo
Committed by
Wayne Stambaugh
Feb 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew IDF and VRML exporter Coverity scan error fixes.
parent
1acfbb0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
export_vrml.cpp
pcbnew/exporters/export_vrml.cpp
+9
-5
idf_parser.cpp
utils/idftools/idf_parser.cpp
+9
-0
No files found.
pcbnew/exporters/export_vrml.cpp
View file @
dcdaee4c
...
@@ -185,7 +185,11 @@ public:
...
@@ -185,7 +185,11 @@ public:
colors
[
VRML_COLOR_TIN
]
=
VRML_COLOR
(
.749
,
.756
,
.761
,
.749
,
.756
,
.761
,
colors
[
VRML_COLOR_TIN
]
=
VRML_COLOR
(
.749
,
.756
,
.761
,
.749
,
.756
,
.761
,
0
,
0
,
0
,
0.8
,
0
,
0.8
);
0
,
0
,
0
,
0.8
,
0
,
0.8
);
precision
=
5
;
plainPCB
=
false
;
SetScale
(
1.0
);
SetOffset
(
0.0
,
0.0
);
s_text_layer
=
F_Cu
;
s_text_width
=
1
;
}
}
VRML_COLOR
&
GetColor
(
VRML_COLOR_INDEX
aIndex
)
VRML_COLOR
&
GetColor
(
VRML_COLOR_INDEX
aIndex
)
...
@@ -889,11 +893,11 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb )
...
@@ -889,11 +893,11 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb )
const
CPOLYGONS_LIST
&
poly
=
zone
->
GetFilledPolysList
();
const
CPOLYGONS_LIST
&
poly
=
zone
->
GetFilledPolysList
();
int
nvert
=
poly
.
GetCornersCount
();
int
nvert
=
poly
.
GetCornersCount
();
int
i
=
0
;
int
i
=
0
;
bool
cutout
=
false
;
while
(
i
<
nvert
)
while
(
i
<
nvert
)
{
{
int
seg
=
vl
->
NewContour
();
int
seg
=
vl
->
NewContour
();
bool
first
=
true
;
if
(
seg
<
0
)
if
(
seg
<
0
)
break
;
break
;
...
@@ -914,10 +918,10 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb )
...
@@ -914,10 +918,10 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb )
// KiCad ensures that the first polygon is the outline
// KiCad ensures that the first polygon is the outline
// and all others are holes
// and all others are holes
vl
->
EnsureWinding
(
seg
,
first
?
false
:
true
);
vl
->
EnsureWinding
(
seg
,
cutout
);
if
(
firs
t
)
if
(
!
cutou
t
)
first
=
fals
e
;
cutout
=
tru
e
;
++
i
;
++
i
;
}
}
...
...
utils/idftools/idf_parser.cpp
View file @
dcdaee4c
...
@@ -2425,12 +2425,18 @@ void IDF3_BOARD::readLibSection( std::ifstream& aLibFile, IDF3::FILE_STATE& aLib
...
@@ -2425,12 +2425,18 @@ void IDF3_BOARD::readLibSection( std::ifstream& aLibFile, IDF3::FILE_STATE& aLib
while
(
!
FetchIDFLine
(
aLibFile
,
iline
,
isComment
,
pos
)
&&
aLibFile
.
good
()
);
while
(
!
FetchIDFLine
(
aLibFile
,
iline
,
isComment
,
pos
)
&&
aLibFile
.
good
()
);
if
(
!
aLibFile
.
good
()
&&
!
aLibFile
.
eof
()
)
if
(
!
aLibFile
.
good
()
&&
!
aLibFile
.
eof
()
)
{
delete
pout
;
throw
(
IDF_ERROR
(
__FILE__
,
__FUNCTION__
,
__LINE__
,
throw
(
IDF_ERROR
(
__FILE__
,
__FUNCTION__
,
__LINE__
,
"problems reading library section"
)
);
"problems reading library section"
)
);
}
// no data was read; this only happens at eof()
// no data was read; this only happens at eof()
if
(
iline
.
empty
()
)
if
(
iline
.
empty
()
)
{
delete
pout
;
return
;
return
;
}
if
(
isComment
)
if
(
isComment
)
{
{
...
@@ -2448,6 +2454,7 @@ void IDF3_BOARD::readLibSection( std::ifstream& aLibFile, IDF3::FILE_STATE& aLib
...
@@ -2448,6 +2454,7 @@ void IDF3_BOARD::readLibSection( std::ifstream& aLibFile, IDF3::FILE_STATE& aLib
ostr
<<
"* Violation of specification: quoted string where .ELECTRICAL or .MECHANICAL expected
\n
"
;
ostr
<<
"* Violation of specification: quoted string where .ELECTRICAL or .MECHANICAL expected
\n
"
;
ostr
<<
"* line: '"
<<
iline
<<
"'
\n
"
;
ostr
<<
"* line: '"
<<
iline
<<
"'
\n
"
;
ostr
<<
"* pos: "
<<
pos
;
ostr
<<
"* pos: "
<<
pos
;
delete
pout
;
throw
(
IDF_ERROR
(
__FILE__
,
__FUNCTION__
,
__LINE__
,
ostr
.
str
()
)
);
throw
(
IDF_ERROR
(
__FILE__
,
__FUNCTION__
,
__LINE__
,
ostr
.
str
()
)
);
}
}
...
@@ -2509,6 +2516,8 @@ void IDF3_BOARD::readLibSection( std::ifstream& aLibFile, IDF3::FILE_STATE& aLib
...
@@ -2509,6 +2516,8 @@ void IDF3_BOARD::readLibSection( std::ifstream& aLibFile, IDF3::FILE_STATE& aLib
}
}
}
}
delete
pout
;
if
(
!
aLibFile
.
eof
()
)
if
(
!
aLibFile
.
eof
()
)
throw
(
IDF_ERROR
(
__FILE__
,
__FUNCTION__
,
__LINE__
,
throw
(
IDF_ERROR
(
__FILE__
,
__FUNCTION__
,
__LINE__
,
"problems reading IDF library file"
)
);
"problems reading IDF library file"
)
);
...
...
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