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
Hide 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()
...
@@ -222,16 +222,8 @@ void FP_CACHE::Load()
do
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
// 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
);
m_owner
->
m_parser
->
SetLineReader
(
&
reader
);
...
@@ -1551,15 +1543,7 @@ PCB_IO::~PCB_IO()
...
@@ -1551,15 +1543,7 @@ PCB_IO::~PCB_IO()
BOARD
*
PCB_IO
::
Load
(
const
wxString
&
aFileName
,
BOARD
*
aAppendToMe
,
PROPERTIES
*
aProperties
)
BOARD
*
PCB_IO
::
Load
(
const
wxString
&
aFileName
,
BOARD
*
aAppendToMe
,
PROPERTIES
*
aProperties
)
{
{
wxFFile
file
(
aFileName
,
wxT
(
"r"
)
);
FILE_LINE_READER
reader
(
aFileName
);
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 */
);
m_parser
->
SetLineReader
(
&
reader
);
m_parser
->
SetLineReader
(
&
reader
);
m_parser
->
SetBoard
(
aAppendToMe
);
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
...
@@ -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
// delete on exception, iff I own m_board, according to aAppendToMe
auto_ptr
<
BOARD
>
deleter
(
aAppendToMe
?
NULL
:
m_board
);
auto_ptr
<
BOARD
>
deleter
(
aAppendToMe
?
NULL
:
m_board
);
FILE
*
fp
=
wxFopen
(
aFileName
,
wxT
(
"r"
)
);
FILE_LINE_READER
reader
(
aFileName
);
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
);
m_reader
=
&
reader
;
// member function accessibility
m_reader
=
&
reader
;
// member function accessibility
...
@@ -3920,15 +3912,7 @@ wxDateTime FPL_CACHE::GetLibModificationTime()
...
@@ -3920,15 +3912,7 @@ wxDateTime FPL_CACHE::GetLibModificationTime()
void
FPL_CACHE
::
Load
()
void
FPL_CACHE
::
Load
()
{
{
FILE
*
fp
=
wxFopen
(
m_lib_name
,
wxT
(
"r"
)
);
FILE_LINE_READER
reader
(
m_lib_name
);
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
);
ReadAndVerifyHeader
(
&
reader
);
ReadAndVerifyHeader
(
&
reader
);
SkipIndex
(
&
reader
);
SkipIndex
(
&
reader
);
...
...
pcbnew/specctra.cpp
View file @
9ae4e609
...
@@ -230,14 +230,9 @@ void SPECCTRA_DB::readTIME( time_t* time_stamp ) throw( IO_ERROR )
...
@@ -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
)
void
SPECCTRA_DB
::
LoadPCB
(
const
wxString
&
filename
)
throw
(
IO_ERROR
)
{
{
FILE
*
fp
=
wxFopen
(
filename
,
wxT
(
"r"
)
);
FILE
_LINE_READER
reader
(
filename
);
if
(
!
fp
)
PushReader
(
&
reader
);
{
ThrowIOError
(
_
(
"Unable to open file
\"
%s
\"
"
),
GetChars
(
filename
)
);
}
PushReader
(
new
FILE_LINE_READER
(
fp
,
filename
)
);
if
(
NextTok
()
!=
T_LEFT
)
if
(
NextTok
()
!=
T_LEFT
)
Expecting
(
T_LEFT
);
Expecting
(
T_LEFT
);
...
@@ -248,21 +243,15 @@ void SPECCTRA_DB::LoadPCB( const wxString& filename ) throw( IO_ERROR )
...
@@ -248,21 +243,15 @@ void SPECCTRA_DB::LoadPCB( const wxString& filename ) throw( IO_ERROR )
SetPCB
(
new
PCB
()
);
SetPCB
(
new
PCB
()
);
doPCB
(
pcb
);
doPCB
(
pcb
);
PopReader
();
delete
PopReader
();
// close fp
}
}
void
SPECCTRA_DB
::
LoadSESSION
(
const
wxString
&
filename
)
throw
(
IO_ERROR
)
void
SPECCTRA_DB
::
LoadSESSION
(
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
)
if
(
NextTok
()
!=
T_LEFT
)
Expecting
(
T_LEFT
);
Expecting
(
T_LEFT
);
...
@@ -274,7 +263,7 @@ void SPECCTRA_DB::LoadSESSION( const wxString& filename ) throw( IO_ERROR )
...
@@ -274,7 +263,7 @@ void SPECCTRA_DB::LoadSESSION( const wxString& filename ) throw( IO_ERROR )
doSESSION
(
session
);
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