Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
856c7177
Commit
856c7177
authored
May 20, 2011
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed reading/writing of utf-8 strings
parent
1388826c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
persistence.cpp
modules/core/src/persistence.cpp
+19
-13
No files found.
modules/core/src/persistence.cpp
View file @
856c7177
...
...
@@ -49,8 +49,8 @@
* Common macros and type definitions *
\****************************************************************************************/
#define cv_isprint(c) ((
signed char)(c) >= (signed
char)' ')
#define cv_isprint_or_tab(c) ((
signed char)(c) >= (signed
char)' ' || (c) == '\t')
#define cv_isprint(c) ((
uchar)(c) >= (u
char)' ')
#define cv_isprint_or_tab(c) ((
uchar)(c) >= (u
char)' ' || (c) == '\t')
static
char
*
icv_itoa
(
int
_val
,
char
*
buffer
,
int
/*radix*/
)
{
...
...
@@ -1905,11 +1905,16 @@ icvXMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node,
}
else
if
(
c
==
'&'
)
{
if
(
*
ptr
==
'#'
)
if
(
*
++
ptr
==
'#'
)
{
int
val
;
int
val
,
base
=
10
;
ptr
++
;
val
=
(
int
)
strtol
(
ptr
,
&
endptr
,
0
);
if
(
*
ptr
==
'x'
)
{
base
=
16
;
ptr
++
;
}
val
=
(
int
)
strtol
(
ptr
,
&
endptr
,
base
);
if
(
(
unsigned
)
val
>
(
unsigned
)
255
||
!
endptr
||
*
endptr
!=
';'
)
CV_PARSE_ERROR
(
"Invalid numeric value in the string"
);
...
...
@@ -1917,7 +1922,7 @@ icvXMLParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node,
}
else
{
endptr
=
ptr
++
;
endptr
=
ptr
;
do
c
=
*++
endptr
;
while
(
isalnum
(
c
)
);
if
(
c
!=
';'
)
...
...
@@ -2427,8 +2432,12 @@ icvXMLWriteString( CvFileStorage* fs, const char* key, const char* str, int quot
{
char
c
=
str
[
i
];
if
(
!
isalnum
(
c
)
&&
(
!
cv_isprint
(
c
)
||
c
==
'<'
||
c
==
'>'
||
c
==
'&'
||
c
==
'\''
||
c
==
'\"'
)
)
if
(
(
uchar
)
c
>=
128
||
c
==
' '
)
{
*
data
++
=
c
;
need_quote
=
1
;
}
else
if
(
!
cv_isprint
(
c
)
||
c
==
'<'
||
c
==
'>'
||
c
==
'&'
||
c
==
'\''
||
c
==
'\"'
)
{
*
data
++
=
'&'
;
if
(
c
==
'<'
)
...
...
@@ -2458,17 +2467,14 @@ icvXMLWriteString( CvFileStorage* fs, const char* key, const char* str, int quot
}
else
{
sprintf
(
data
,
"#x%02x"
,
c
);
sprintf
(
data
,
"#x%02x"
,
(
uchar
)
c
);
data
+=
4
;
}
*
data
++
=
';'
;
need_quote
=
1
;
}
else
{
if
(
c
==
' '
)
need_quote
=
1
;
*
data
++
=
c
;
}
}
if
(
!
need_quote
&&
(
isdigit
(
str
[
0
])
||
str
[
0
]
==
'+'
||
str
[
0
]
==
'-'
||
str
[
0
]
==
'.'
))
...
...
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