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
fdc7e9a8
Commit
fdc7e9a8
authored
Oct 07, 2012
by
Dick Hollenbeck
Committed by
Wayne Stambaugh
Oct 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit Dick's INPUTSTREAM_LINE_READER patch.
parent
1468a4ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
richio.cpp
common/richio.cpp
+9
-6
No files found.
common/richio.cpp
View file @
fdc7e9a8
...
@@ -195,9 +195,8 @@ INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER( wxInputStream* aStream ) :
...
@@ -195,9 +195,8 @@ INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER( wxInputStream* aStream ) :
unsigned
INPUTSTREAM_LINE_READER
::
ReadLine
()
throw
(
IO_ERROR
)
unsigned
INPUTSTREAM_LINE_READER
::
ReadLine
()
throw
(
IO_ERROR
)
{
{
length
=
0
;
length
=
0
;
line
[
0
]
=
0
;
while
(
!
m_stream
->
Eof
()
)
for
(;;
)
{
{
if
(
length
>=
maxLineLength
)
if
(
length
>=
maxLineLength
)
THROW_IO_ERROR
(
_
(
"Maximum line length exceeded"
)
);
THROW_IO_ERROR
(
_
(
"Maximum line length exceeded"
)
);
...
@@ -205,15 +204,19 @@ unsigned INPUTSTREAM_LINE_READER::ReadLine() throw( IO_ERROR )
...
@@ -205,15 +204,19 @@ unsigned INPUTSTREAM_LINE_READER::ReadLine() throw( IO_ERROR )
if
(
length
+
1
>
capacity
)
if
(
length
+
1
>
capacity
)
expandCapacity
(
capacity
*
2
);
expandCapacity
(
capacity
*
2
);
line
[
length
]
=
m_stream
->
GetC
();
// this read may fail, docs say to test LastRead() before trusting cc.
length
++
;
char
cc
=
m_stream
->
GetC
();
if
(
!
m_stream
->
LastRead
()
)
break
;
line
[
length
++
]
=
cc
;
if
(
line
[
length
-
1
]
==
'\n'
)
if
(
cc
==
'\n'
)
break
;
break
;
}
}
line
[
length
]
=
0
;
line
[
length
]
=
0
;
length
-=
1
;
// lineNum is incremented even if there was no line read, because this
// lineNum is incremented even if there was no line read, because this
// leads to better error reporting when we hit an end of file.
// leads to better error reporting when we hit an end of 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