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
8aab369f
Commit
8aab369f
authored
Nov 18, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
isspace() handles characters in range 0-255 only
parent
178bc946
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
dsn.cpp
pcbnew/dsn.cpp
+18
-6
No files found.
pcbnew/dsn.cpp
View file @
8aab369f
...
@@ -621,6 +621,18 @@ void LEXER::ThrowIOError( wxString aText, int charOffset ) throw (IOError)
...
@@ -621,6 +621,18 @@ void LEXER::ThrowIOError( wxString aText, int charOffset ) throw (IOError)
}
}
/**
* Function isspace
* strips the upper bits of the int to ensure the value passed to ::isspace() is
* in the range of 0-255
*/
static
inline
bool
isSpace
(
int
cc
)
{
// make sure int passed to ::isspace() is 0-255
return
::
isspace
(
cc
&
0xff
);
}
DSN_T
LEXER
::
NextTok
()
throw
(
IOError
)
DSN_T
LEXER
::
NextTok
()
throw
(
IOError
)
{
{
char
*
cur
=
next
;
char
*
cur
=
next
;
...
@@ -643,7 +655,7 @@ L_read:
...
@@ -643,7 +655,7 @@ L_read:
cur
=
start
;
cur
=
start
;
// skip leading whitespace
// skip leading whitespace
while
(
cur
<
limit
&&
is
s
pace
(
*
cur
)
)
while
(
cur
<
limit
&&
is
S
pace
(
*
cur
)
)
++
cur
;
++
cur
;
// if the first non-blank character is #, this line is a comment.
// if the first non-blank character is #, this line is a comment.
...
@@ -653,7 +665,7 @@ L_read:
...
@@ -653,7 +665,7 @@ L_read:
else
else
{
{
// skip leading whitespace
// skip leading whitespace
while
(
cur
<
limit
&&
is
s
pace
(
*
cur
)
)
while
(
cur
<
limit
&&
is
S
pace
(
*
cur
)
)
++
cur
;
++
cur
;
}
}
...
@@ -681,7 +693,7 @@ L_read:
...
@@ -681,7 +693,7 @@ L_read:
head
=
cur
+
1
;
head
=
cur
+
1
;
if
(
head
<
limit
&&
*
head
!=
')'
&&
*
head
!=
'('
&&
!
is
s
pace
(
*
head
)
)
if
(
head
<
limit
&&
*
head
!=
')'
&&
*
head
!=
'('
&&
!
is
S
pace
(
*
head
)
)
{
{
ThrowIOError
(
errtxt
,
CurOffset
()
);
ThrowIOError
(
errtxt
,
CurOffset
()
);
}
}
...
@@ -714,7 +726,7 @@ L_read:
...
@@ -714,7 +726,7 @@ L_read:
like: U2-14 or "U2"-"14"
like: U2-14 or "U2"-"14"
This is detectable by a non-space immediately preceeding the dash.
This is detectable by a non-space immediately preceeding the dash.
*/
*/
if
(
*
cur
==
'-'
&&
cur
>
start
&&
!
is
s
pace
(
cur
[
-
1
]
)
)
if
(
*
cur
==
'-'
&&
cur
>
start
&&
!
is
S
pace
(
cur
[
-
1
]
)
)
{
{
head
=
cur
+
1
;
head
=
cur
+
1
;
curText
.
clear
();
curText
.
clear
();
...
@@ -730,7 +742,7 @@ L_read:
...
@@ -730,7 +742,7 @@ L_read:
while
(
head
<
limit
&&
strchr
(
".0123456789"
,
*
head
)
)
while
(
head
<
limit
&&
strchr
(
".0123456789"
,
*
head
)
)
++
head
;
++
head
;
if
(
(
head
<
limit
&&
is
s
pace
(
*
head
))
||
*
head
==
')'
||
*
head
==
'('
||
head
==
limit
)
if
(
(
head
<
limit
&&
is
S
pace
(
*
head
))
||
*
head
==
')'
||
*
head
==
'('
||
head
==
limit
)
{
{
curText
.
clear
();
curText
.
clear
();
curText
.
append
(
cur
,
head
);
curText
.
append
(
cur
,
head
);
...
@@ -770,7 +782,7 @@ L_read:
...
@@ -770,7 +782,7 @@ L_read:
// call it a T_SYMBOL.
// call it a T_SYMBOL.
{
{
head
=
cur
+
1
;
head
=
cur
+
1
;
while
(
head
<
limit
&&
!
is
s
pace
(
*
head
)
&&
*
head
!=
')'
&&
*
head
!=
'('
)
while
(
head
<
limit
&&
!
is
S
pace
(
*
head
)
&&
*
head
!=
')'
&&
*
head
!=
'('
)
++
head
;
++
head
;
curText
.
clear
();
curText
.
clear
();
...
...
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