Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
52f46700
Commit
52f46700
authored
Mar 26, 2024
by
BoskyWSMFN
Committed by
Mouse
Mar 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add-(u)int64_t-format-specifiers
parent
12b8e555
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
skeletons/asn_system.h
skeletons/asn_system.h
+4
-0
tests/tests-skeletons/check-INTEGER.c
tests/tests-skeletons/check-INTEGER.c
+7
-7
No files found.
skeletons/asn_system.h
View file @
52f46700
...
...
@@ -166,9 +166,13 @@ typedef unsigned int uint32_t;
#define ASN_PRI_SSIZE "zd"
#define ASN_PRIuMAX PRIuMAX
#define ASN_PRIdMAX PRIdMAX
#define ASN_PRIu64 PRIu64
#define ASN_PRId64 PRId64
#else
#define ASN_PRI_SIZE "lu"
#define ASN_PRI_SSIZE "ld"
#define ASN_PRIu64 "llu"
#define ASN_PRId64 "lld"
#if LLONG_MAX > LONG_MAX
#define ASN_PRIuMAX "llu"
#define ASN_PRIdMAX "lld"
...
...
tests/tests-skeletons/check-INTEGER.c
View file @
52f46700
...
...
@@ -171,10 +171,10 @@ check_64(uint8_t *buf, size_t size, int64_t check_i64, int check_ret) {
printf
(
"]: "
);
ret
=
asn_INTEGER2int64
(
&
val
,
&
rint64
);
printf
(
" (%"
ASN_PRId
MAX
", %d) vs (%"
ASN_PRIdMAX
", %d)
\n
"
,
printf
(
" (%"
ASN_PRId
64
", %d) vs (%"
ASN_PRId64
", %d)
\n
"
,
rint64
,
ret
,
check_i64
,
check_ret
);
assert
(
ret
==
check_ret
);
printf
(
"%"
ASN_PRId
MAX
" %"
ASN_PRIdMAX
"
\n
"
,
rint64
,
check_i64
);
printf
(
"%"
ASN_PRId
64
" %"
ASN_PRId64
"
\n
"
,
rint64
,
check_i64
);
assert
(
rint64
==
check_i64
);
if
(
check_ret
==
0
)
{
...
...
@@ -196,7 +196,7 @@ check_64(uint8_t *buf, size_t size, int64_t check_i64, int check_ret) {
ret
=
INTEGER_print
(
&
asn_DEF_INTEGER
,
&
val
,
0
,
_print2buf
,
scratch
);
assert
(
shared_scratch_start
<
scratch
+
sizeof
(
scratch
));
assert
(
ret
==
0
);
ret
=
snprintf
(
verify
,
sizeof
(
verify
),
"%"
ASN_PRId
MAX
""
,
check_i64
);
ret
=
snprintf
(
verify
,
sizeof
(
verify
),
"%"
ASN_PRId
64
""
,
check_i64
);
assert
(
ret
<
0
||
(
size_t
)
ret
<
sizeof
(
verify
));
ret
=
strcmp
(
scratch
,
verify
);
printf
(
" [%s] vs [%s]: %d%s
\n
"
,
...
...
@@ -233,7 +233,7 @@ check_unsigned_64(uint8_t *buf, int size, uint64_t check_u64, int check_ret) {
printf
(
"]: "
);
ret
=
asn_INTEGER2uint64
(
&
val
,
&
ruint64
);
printf
(
" (%"
ASN_PRIu
MAX
", %d) vs (%"
ASN_PRIuMAX
", %d)
\n
"
,
printf
(
" (%"
ASN_PRIu
64
", %d) vs (%"
ASN_PRIu64
", %d)
\n
"
,
ruint64
,
ret
,
check_u64
,
check_ret
);
assert
(
ret
==
check_ret
);
assert
(
ruint64
==
check_u64
);
...
...
@@ -264,7 +264,7 @@ check_unsigned_64(uint8_t *buf, int size, uint64_t check_u64, int check_ret) {
ret
=
INTEGER_print
(
&
asn_DEF_INTEGER
,
&
val
,
0
,
_print2buf
,
scratch
);
assert
(
shared_scratch_start
<
scratch
+
sizeof
(
scratch
));
assert
(
ret
==
0
);
ret
=
snprintf
(
verify
,
sizeof
(
verify
),
"%"
ASN_PRIu
MAX
""
,
check_u64
);
ret
=
snprintf
(
verify
,
sizeof
(
verify
),
"%"
ASN_PRIu
64
""
,
check_u64
);
assert
(
ret
<
(
int
)
sizeof
(
verify
));
ret
=
strcmp
(
scratch
,
verify
);
printf
(
" [%s] vs [%s]: %d%s
\n
"
,
...
...
@@ -350,9 +350,9 @@ check_strtoimax() {
char
positive_max
[
32
];
char
negative_min
[
32
];
const
int
len_pmax
=
snprintf
(
positive_max
,
sizeof
(
positive_max
),
"+%"
ASN_PRId
MAX
,
intmax_max
);
"+%"
ASN_PRId
64
,
intmax_max
);
const
int
len_nmin
=
snprintf
(
negative_min
,
sizeof
(
negative_min
),
"%"
ASN_PRId
MAX
,
intmax_min
);
"%"
ASN_PRId
64
,
intmax_min
);
assert
(
len_pmax
<
(
int
)
sizeof
(
positive_max
));
assert
(
len_nmin
<
(
int
)
sizeof
(
negative_min
));
...
...
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