Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
9e677114
Commit
9e677114
authored
9 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py/mpprint: Fix sign extension when printf'ing %u, %x and %X.
parent
331a4819
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/mpprint.c
+3
-3
3 additions, 3 deletions
py/mpprint.c
tests/unix/extra_coverage.py.exp
+4
-0
4 additions, 0 deletions
tests/unix/extra_coverage.py.exp
unix/coverage.c
+4
-0
4 additions, 0 deletions
unix/coverage.c
with
11 additions
and
3 deletions
py/mpprint.c
+
3
−
3
View file @
9e677114
...
@@ -494,16 +494,16 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
...
@@ -494,16 +494,16 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
break
;
break
;
}
}
case
'u'
:
case
'u'
:
chrs
+=
mp_print_int
(
print
,
va_arg
(
args
,
int
),
0
,
10
,
'a'
,
flags
,
fill
,
width
);
chrs
+=
mp_print_int
(
print
,
va_arg
(
args
,
unsigned
int
),
0
,
10
,
'a'
,
flags
,
fill
,
width
);
break
;
break
;
case
'd'
:
case
'd'
:
chrs
+=
mp_print_int
(
print
,
va_arg
(
args
,
int
),
1
,
10
,
'a'
,
flags
,
fill
,
width
);
chrs
+=
mp_print_int
(
print
,
va_arg
(
args
,
int
),
1
,
10
,
'a'
,
flags
,
fill
,
width
);
break
;
break
;
case
'x'
:
case
'x'
:
chrs
+=
mp_print_int
(
print
,
va_arg
(
args
,
int
),
0
,
16
,
'a'
,
flags
,
fill
,
width
);
chrs
+=
mp_print_int
(
print
,
va_arg
(
args
,
unsigned
int
),
0
,
16
,
'a'
,
flags
,
fill
,
width
);
break
;
break
;
case
'X'
:
case
'X'
:
chrs
+=
mp_print_int
(
print
,
va_arg
(
args
,
int
),
0
,
16
,
'A'
,
flags
,
fill
,
width
);
chrs
+=
mp_print_int
(
print
,
va_arg
(
args
,
unsigned
int
),
0
,
16
,
'A'
,
flags
,
fill
,
width
);
break
;
break
;
case
'p'
:
case
'p'
:
case
'P'
:
// don't bother to handle upcase for 'P'
case
'P'
:
// don't bother to handle upcase for 'P'
...
...
This diff is collapsed.
Click to expand it.
tests/unix/extra_coverage.py.exp
+
4
−
0
View file @
9e677114
...
@@ -8,6 +8,10 @@ ab abc
...
@@ -8,6 +8,10 @@ ab abc
false true
false true
(null)
(null)
t
t
-2147483648
2147483648
80000000
80000000
# vstr
# vstr
tests
tests
sts
sts
...
...
This diff is collapsed.
Click to expand it.
unix/coverage.c
+
4
−
0
View file @
9e677114
...
@@ -22,6 +22,10 @@ STATIC mp_obj_t extra_coverage(void) {
...
@@ -22,6 +22,10 @@ STATIC mp_obj_t extra_coverage(void) {
mp_printf
(
&
mp_plat_print
,
"%b %b
\n
"
,
0
,
1
);
// bools
mp_printf
(
&
mp_plat_print
,
"%b %b
\n
"
,
0
,
1
);
// bools
mp_printf
(
&
mp_plat_print
,
"%s
\n
"
,
NULL
);
// null string
mp_printf
(
&
mp_plat_print
,
"%s
\n
"
,
NULL
);
// null string
mp_printf
(
&
mp_plat_print
,
"%t
\n
"
);
// non-format char
mp_printf
(
&
mp_plat_print
,
"%t
\n
"
);
// non-format char
mp_printf
(
&
mp_plat_print
,
"%d
\n
"
,
0x80000000
);
// should print signed
mp_printf
(
&
mp_plat_print
,
"%u
\n
"
,
0x80000000
);
// should print unsigned
mp_printf
(
&
mp_plat_print
,
"%x
\n
"
,
0x80000000
);
// should print unsigned
mp_printf
(
&
mp_plat_print
,
"%X
\n
"
,
0x80000000
);
// should print unsigned
}
}
// vstr
// vstr
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment