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
9ae4e609
Commit
9ae4e609
authored
Nov 27, 2012
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start using FILE_LINE_READER( const wxString& )
parent
98086a88
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
53 deletions
+10
-53
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+2
-18
legacy_plugin.cpp
pcbnew/legacy_plugin.cpp
+2
-18
specctra.cpp
pcbnew/specctra.cpp
+6
-17
No files found.
pcbnew/kicad_plugin.cpp
View file @
9ae4e609
...
...
@@ -222,16 +222,8 @@ void FP_CACHE::Load()
do
{
FILE
*
fp
=
wxFopen
(
fpFileName
,
wxT
(
"r"
)
);
if
(
!
fp
)
{
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"cannot open footprint library file '%s'"
),
fpFileName
.
GetData
()
)
);
}
// reader now owns fp, will close on exception or return
FILE_LINE_READER
reader
(
fp
,
fp
FileName
);
FILE_LINE_READER
reader
(
fpFileName
);
m_owner
->
m_parser
->
SetLineReader
(
&
reader
);
...
...
@@ -1551,15 +1543,7 @@ PCB_IO::~PCB_IO()
BOARD
*
PCB_IO
::
Load
(
const
wxString
&
aFileName
,
BOARD
*
aAppendToMe
,
PROPERTIES
*
aProperties
)
{
wxFFile
file
(
aFileName
,
wxT
(
"r"
)
);
if
(
!
file
.
IsOpened
()
)
{
wxString
msg
=
wxString
::
Format
(
_
(
"Unable to read file
\"
%s
\"
"
),
GetChars
(
aFileName
)
);
THROW_IO_ERROR
(
msg
);
}
FILE_LINE_READER
reader
(
file
.
fp
(),
aFileName
,
false
/* wxFFile owns fp */
);
FILE_LINE_READER
reader
(
aFileName
);
m_parser
->
SetLineReader
(
&
reader
);
m_parser
->
SetBoard
(
aAppendToMe
);
...
...
pcbnew/legacy_plugin.cpp
View file @
9ae4e609
...
...
@@ -238,15 +238,7 @@ BOARD* LEGACY_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE
// delete on exception, iff I own m_board, according to aAppendToMe
auto_ptr
<
BOARD
>
deleter
(
aAppendToMe
?
NULL
:
m_board
);
FILE
*
fp
=
wxFopen
(
aFileName
,
wxT
(
"r"
)
);
if
(
!
fp
)
{
m_error
.
Printf
(
_
(
"Unable to open file '%s'"
),
aFileName
.
GetData
()
);
THROW_IO_ERROR
(
m_error
);
}
// reader now owns fp, will close on exception or return
FILE_LINE_READER
reader
(
fp
,
aFileName
);
FILE_LINE_READER
reader
(
aFileName
);
m_reader
=
&
reader
;
// member function accessibility
...
...
@@ -3920,15 +3912,7 @@ wxDateTime FPL_CACHE::GetLibModificationTime()
void
FPL_CACHE
::
Load
()
{
FILE
*
fp
=
wxFopen
(
m_lib_name
,
wxT
(
"r"
)
);
if
(
!
fp
)
{
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Unable to open legacy library file '%s'"
),
m_lib_name
.
GetData
()
)
);
}
// reader now owns fp, will close on exception or return
FILE_LINE_READER
reader
(
fp
,
m_lib_name
);
FILE_LINE_READER
reader
(
m_lib_name
);
ReadAndVerifyHeader
(
&
reader
);
SkipIndex
(
&
reader
);
...
...
pcbnew/specctra.cpp
View file @
9ae4e609
...
...
@@ -230,14 +230,9 @@ void SPECCTRA_DB::readTIME( time_t* time_stamp ) throw( IO_ERROR )
void
SPECCTRA_DB
::
LoadPCB
(
const
wxString
&
filename
)
throw
(
IO_ERROR
)
{
FILE
*
fp
=
wxFopen
(
filename
,
wxT
(
"r"
)
);
FILE
_LINE_READER
reader
(
filename
);
if
(
!
fp
)
{
ThrowIOError
(
_
(
"Unable to open file
\"
%s
\"
"
),
GetChars
(
filename
)
);
}
PushReader
(
new
FILE_LINE_READER
(
fp
,
filename
)
);
PushReader
(
&
reader
);
if
(
NextTok
()
!=
T_LEFT
)
Expecting
(
T_LEFT
);
...
...
@@ -248,21 +243,15 @@ void SPECCTRA_DB::LoadPCB( const wxString& filename ) throw( IO_ERROR )
SetPCB
(
new
PCB
()
);
doPCB
(
pcb
);
delete
PopReader
();
// close fp
PopReader
();
}
void
SPECCTRA_DB
::
LoadSESSION
(
const
wxString
&
filename
)
throw
(
IO_ERROR
)
{
FILE
*
fp
=
wxFopen
(
filename
,
wxT
(
"r"
)
);
if
(
!
fp
)
{
ThrowIOError
(
_
(
"Unable to open file
\"
%s
\"
"
),
GetChars
(
filename
)
);
}
FILE_LINE_READER
reader
(
filename
);
PushReader
(
new
FILE_LINE_READER
(
fp
,
filename
)
);
PushReader
(
&
reader
);
if
(
NextTok
()
!=
T_LEFT
)
Expecting
(
T_LEFT
);
...
...
@@ -274,7 +263,7 @@ void SPECCTRA_DB::LoadSESSION( const wxString& filename ) throw( IO_ERROR )
doSESSION
(
session
);
delete
PopReader
();
// close fp
PopReader
();
}
...
...
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