Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
9b892909
Commit
9b892909
authored
Feb 08, 2016
by
peastman
Browse files
Merge pull request #1391 from peastman/xml
irrXML supports numeric escapes
parents
40544daf
2f8448a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
2 deletions
+31
-2
libraries/irrxml/include/CXMLReaderImpl.h
libraries/irrxml/include/CXMLReaderImpl.h
+31
-2
No files found.
libraries/irrxml/include/CXMLReaderImpl.h
View file @
9b892909
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
// For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
// MODIFIED by Peter Eastman, Feb. 4, 2016, to support numeric escape sequences
#ifndef __ICXML_READER_IMPL_H_INCLUDED__
#ifndef __ICXML_READER_IMPL_H_INCLUDED__
#define __ICXML_READER_IMPL_H_INCLUDED__
#define __ICXML_READER_IMPL_H_INCLUDED__
...
@@ -530,8 +532,35 @@ private:
...
@@ -530,8 +532,35 @@ private:
}
}
else
else
{
{
newstr
.
append
(
origstr
.
subString
(
oldPos
,
pos
-
oldPos
+
1
));
int
semicolonPos
=
origstr
.
findNext
(
L';'
,
pos
);
pos
+=
1
;
if
(
semicolonPos
!=
-
1
&&
origstr
.
c_str
()[
pos
+
1
]
==
L'#'
)
{
// it is a numeric character reference
int
number
;
core
::
string
<
char
>
numberString
;
if
(
origstr
.
c_str
()[
pos
+
2
]
==
L'x'
)
{
// hex value
for
(
int
i
=
pos
+
3
;
i
<
semicolonPos
;
++
i
)
numberString
.
append
((
char
)
origstr
[
i
]);
sscanf
(
numberString
.
c_str
(),
"%x"
,
&
number
);
}
else
{
// decimal value
for
(
int
i
=
pos
+
2
;
i
<
semicolonPos
;
++
i
)
numberString
.
append
((
char
)
origstr
[
i
]);
sscanf
(
numberString
.
c_str
(),
"%d"
,
&
number
);
}
newstr
.
append
(
origstr
.
subString
(
oldPos
,
pos
-
oldPos
));
newstr
.
append
((
char_type
)
number
);
pos
=
semicolonPos
+
1
;
}
else
{
newstr
.
append
(
origstr
.
subString
(
oldPos
,
pos
-
oldPos
+
1
));
pos
+=
1
;
}
}
}
// find next &
// find next &
...
...
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