Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
165eb69b
Commit
165eb69b
authored
Jun 13, 2014
by
Paul Sokolovsky
Browse files
vstr: Restore bytestr compatibility.
parent
42a52516
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/vstr.c
View file @
165eb69b
...
...
@@ -199,6 +199,7 @@ void vstr_add_byte(vstr_t *vstr, byte b) {
}
void
vstr_add_char
(
vstr_t
*
vstr
,
unichar
c
)
{
#if MICROPY_PY_BUILTINS_STR_UNICODE
// TODO: Can this be simplified and deduplicated?
// Is it worth just calling vstr_add_len(vstr, 4)?
if
(
c
<
0x80
)
{
...
...
@@ -233,6 +234,13 @@ void vstr_add_char(vstr_t *vstr, unichar c) {
buf
[
2
]
=
((
c
>>
6
)
&
0x3F
)
|
0x80
;
buf
[
3
]
=
(
c
&
0x3F
)
|
0x80
;
}
#else
byte
*
buf
=
(
byte
*
)
vstr_add_len
(
vstr
,
1
);
if
(
buf
==
NULL
)
{
return
;
}
buf
[
0
]
=
c
;
#endif
}
void
vstr_add_str
(
vstr_t
*
vstr
,
const
char
*
str
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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