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
2af3e5f6
Commit
2af3e5f6
authored
Jun 03, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix #1325743: cvpcb crashes when opening any netlist.
parent
563502b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
8 deletions
+28
-8
legacy_plugin.cpp
pcbnew/legacy_plugin.cpp
+4
-4
legacy_plugin.h
pcbnew/legacy_plugin.h
+10
-0
pcb_parser.cpp
pcbnew/pcb_parser.cpp
+4
-4
pcb_parser.h
pcbnew/pcb_parser.h
+10
-0
No files found.
pcbnew/legacy_plugin.cpp
View file @
2af3e5f6
...
@@ -1305,13 +1305,13 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
...
@@ -1305,13 +1305,13 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
int
netcode
=
intParse
(
line
+
SZ
(
"Ne"
),
&
data
);
int
netcode
=
intParse
(
line
+
SZ
(
"Ne"
),
&
data
);
// Store the new code mapping
// Store the new code mapping
pad
->
SetNetCode
(
m_netCodes
[
netcode
]
);
pad
->
SetNetCode
(
getNetCode
(
netcode
)
);
// read Netname
// read Netname
ReadDelimitedText
(
buf
,
data
,
sizeof
(
buf
)
);
ReadDelimitedText
(
buf
,
data
,
sizeof
(
buf
)
);
#ifndef NDEBUG
#ifndef NDEBUG
if
(
m_board
)
if
(
m_board
)
assert
(
m_board
->
FindNet
(
m_netCodes
[
netcode
]
)
->
GetNetname
()
==
assert
(
m_board
->
FindNet
(
getNetCode
(
netcode
)
)
->
GetNetname
()
==
FROM_UTF8
(
StrPurge
(
buf
)
)
);
FROM_UTF8
(
StrPurge
(
buf
)
)
);
#endif
/* NDEBUG */
#endif
/* NDEBUG */
}
}
...
@@ -2102,7 +2102,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
...
@@ -2102,7 +2102,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
via
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
via
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
}
}
newTrack
->
SetNetCode
(
m_netCodes
[
net_code
]
);
newTrack
->
SetNetCode
(
getNetCode
(
net_code
)
);
newTrack
->
SetState
(
flags
,
true
);
newTrack
->
SetState
(
flags
,
true
);
m_board
->
Add
(
newTrack
);
m_board
->
Add
(
newTrack
);
...
@@ -2250,7 +2250,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
...
@@ -2250,7 +2250,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
// Init the net code only, not the netname, to be sure
// Init the net code only, not the netname, to be sure
// the zone net name is the name read in file.
// the zone net name is the name read in file.
// (When mismatch, the user will be prompted in DRC, to fix the actual name)
// (When mismatch, the user will be prompted in DRC, to fix the actual name)
zc
->
BOARD_CONNECTED_ITEM
::
SetNetCode
(
m_netCodes
[
netcode
]
);
zc
->
BOARD_CONNECTED_ITEM
::
SetNetCode
(
getNetCode
(
netcode
)
);
}
}
else
if
(
TESTLINE
(
"ZLayer"
)
)
// layer found
else
if
(
TESTLINE
(
"ZLayer"
)
)
// layer found
...
...
pcbnew/legacy_plugin.h
View file @
2af3e5f6
...
@@ -139,6 +139,16 @@ protected:
...
@@ -139,6 +139,16 @@ protected:
double
diskToBiu
;
///< convert from disk engineering units to BIUs
double
diskToBiu
;
///< convert from disk engineering units to BIUs
///< with this scale factor
///< with this scale factor
///> Converts net code using the mapping table if available,
///> otherwise returns unchanged net code
inline
int
getNetCode
(
int
aNetCode
)
{
if
(
aNetCode
<
(
int
)
m_netCodes
.
size
()
)
return
m_netCodes
[
aNetCode
];
return
aNetCode
;
}
/**
/**
* Function biuParse
* Function biuParse
* parses an ASCII decimal floating point value and scales it into a BIU
* parses an ASCII decimal floating point value and scales it into a BIU
...
...
pcbnew/pcb_parser.cpp
View file @
2af3e5f6
...
@@ -2201,7 +2201,7 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent ) throw( IO_ERROR, PARSE_ERROR )
...
@@ -2201,7 +2201,7 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent ) throw( IO_ERROR, PARSE_ERROR )
break
;
break
;
case
T_net
:
case
T_net
:
pad
->
SetNetCode
(
m_netCodes
[
parseInt
(
"net number"
)]
);
pad
->
SetNetCode
(
getNetCode
(
parseInt
(
"net number"
)
)
);
NeedSYMBOLorNUMBER
();
NeedSYMBOLorNUMBER
();
assert
(
FromUTF8
()
==
m_board
->
FindNet
(
pad
->
GetNetCode
()
)
->
GetNetname
()
);
assert
(
FromUTF8
()
==
m_board
->
FindNet
(
pad
->
GetNetCode
()
)
->
GetNetname
()
);
NeedRIGHT
();
NeedRIGHT
();
...
@@ -2299,7 +2299,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR )
...
@@ -2299,7 +2299,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR )
break
;
break
;
case
T_net
:
case
T_net
:
track
->
SetNetCode
(
m_netCodes
[
parseInt
(
"net number"
)]
);
track
->
SetNetCode
(
getNetCode
(
parseInt
(
"net number"
)
)
);
break
;
break
;
case
T_tstamp
:
case
T_tstamp
:
...
@@ -2377,7 +2377,7 @@ VIA* PCB_PARSER::parseVIA() throw( IO_ERROR, PARSE_ERROR )
...
@@ -2377,7 +2377,7 @@ VIA* PCB_PARSER::parseVIA() throw( IO_ERROR, PARSE_ERROR )
break
;
break
;
case
T_net
:
case
T_net
:
via
->
SetNetCode
(
m_netCodes
[
parseInt
(
"net number"
)]
);
via
->
SetNetCode
(
getNetCode
(
parseInt
(
"net number"
)
)
);
NeedRIGHT
();
NeedRIGHT
();
break
;
break
;
...
@@ -2429,7 +2429,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
...
@@ -2429,7 +2429,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
// Init the net code only, not the netname, to be sure
// Init the net code only, not the netname, to be sure
// the zone net name is the name read in file.
// the zone net name is the name read in file.
// (When mismatch, the user will be prompted in DRC, to fix the actual name)
// (When mismatch, the user will be prompted in DRC, to fix the actual name)
zone
->
SetNetCode
(
m_netCodes
[
parseInt
(
"net number"
)]
);
zone
->
SetNetCode
(
getNetCode
(
parseInt
(
"net number"
)
)
);
NeedRIGHT
();
NeedRIGHT
();
break
;
break
;
...
...
pcbnew/pcb_parser.h
View file @
2af3e5f6
...
@@ -69,6 +69,16 @@ class PCB_PARSER : public PCB_LEXER
...
@@ -69,6 +69,16 @@ class PCB_PARSER : public PCB_LEXER
LAYER_MSK_MAP
m_layerMasks
;
///< map layer names to their masks
LAYER_MSK_MAP
m_layerMasks
;
///< map layer names to their masks
std
::
vector
<
int
>
m_netCodes
;
///< net codes mapping for boards being loaded
std
::
vector
<
int
>
m_netCodes
;
///< net codes mapping for boards being loaded
///> Converts net code using the mapping table if available,
///> otherwise returns unchanged net code
inline
int
getNetCode
(
int
aNetCode
)
{
if
(
aNetCode
<
(
int
)
m_netCodes
.
size
()
)
return
m_netCodes
[
aNetCode
];
return
aNetCode
;
}
/**
/**
* Function init
* Function init
* clears and re-establishes m_layerMap with the default layer names.
* clears and re-establishes m_layerMap with the default layer names.
...
...
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