Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
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
mruby
Commits
84d9296c
Commit
84d9296c
authored
Sep 25, 2019
by
dearblue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use inttypes for `snprintf()`
parent
3c1a2612
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
include/mruby/value.h
include/mruby/value.h
+3
-0
mrbgems/mruby-pack/src/pack.c
mrbgems/mruby-pack/src/pack.c
+4
-4
No files found.
include/mruby/value.h
View file @
84d9296c
...
...
@@ -41,12 +41,15 @@ struct mrb_state;
#if defined _MSC_VER && _MSC_VER < 1800
# define PRIo64 "llo"
# define PRId64 "lld"
# define PRIu64 "llu"
# define PRIx64 "llx"
# define PRIo16 "ho"
# define PRId16 "hd"
# define PRIu16 "hu"
# define PRIx16 "hx"
# define PRIo32 "o"
# define PRId32 "d"
# define PRIu32 "u"
# define PRIx32 "x"
#else
# include <inttypes.h>
...
...
mrbgems/mruby-pack/src/pack.c
View file @
84d9296c
...
...
@@ -237,7 +237,7 @@ unpack_l(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
int32_t
sl
=
ul
;
#ifndef MRB_INT64
if
(
!
FIXABLE
(
sl
))
{
snprintf
(
msg
,
sizeof
(
msg
),
"cannot unpack to Fixnum: %
ld"
,
(
long
)
sl
);
snprintf
(
msg
,
sizeof
(
msg
),
"cannot unpack to Fixnum: %
"
PRId32
,
sl
);
mrb_raise
(
mrb
,
E_RANGE_ERROR
,
msg
);
}
#endif
...
...
@@ -245,7 +245,7 @@ unpack_l(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
}
else
{
#ifndef MRB_INT64
if
(
!
POSFIXABLE
(
ul
))
{
snprintf
(
msg
,
sizeof
(
msg
),
"cannot unpack to Fixnum: %
lu"
,
(
unsigned
long
)
ul
);
snprintf
(
msg
,
sizeof
(
msg
),
"cannot unpack to Fixnum: %
"
PRIu32
,
ul
);
mrb_raise
(
mrb
,
E_RANGE_ERROR
,
msg
);
}
#endif
...
...
@@ -307,13 +307,13 @@ unpack_q(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
if
(
flags
&
PACK_FLAG_SIGNED
)
{
int64_t
sll
=
ull
;
if
(
!
FIXABLE
(
sll
))
{
snprintf
(
msg
,
sizeof
(
msg
),
"cannot unpack to Fixnum: %
lld"
,
(
long
long
)
sll
);
snprintf
(
msg
,
sizeof
(
msg
),
"cannot unpack to Fixnum: %
"
PRId64
,
sll
);
mrb_raise
(
mrb
,
E_RANGE_ERROR
,
msg
);
}
n
=
sll
;
}
else
{
if
(
!
POSFIXABLE
(
ull
))
{
snprintf
(
msg
,
sizeof
(
msg
),
"cannot unpack to Fixnum: %
llu"
,
(
unsigned
long
long
)
ull
);
snprintf
(
msg
,
sizeof
(
msg
),
"cannot unpack to Fixnum: %
"
PRIu64
,
ull
);
mrb_raise
(
mrb
,
E_RANGE_ERROR
,
msg
);
}
n
=
ull
;
...
...
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