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
d2f267a1
Unverified
Commit
d2f267a1
authored
Jun 15, 2020
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add casts to silence warnings.
parent
a4a1e01e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+3
-2
src/dump.c
src/dump.c
+4
-4
src/load.c
src/load.c
+1
-1
No files found.
mrbgems/mruby-compiler/core/codegen.c
View file @
d2f267a1
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include <ctype.h>
#include <ctype.h>
#include <limits.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <math.h>
#include <math.h>
...
@@ -612,13 +613,13 @@ new_lit(codegen_scope *s, mrb_value val)
...
@@ -612,13 +613,13 @@ new_lit(codegen_scope *s, mrb_value val)
switch
(
mrb_type
(
val
))
{
switch
(
mrb_type
(
val
))
{
case
MRB_TT_STRING
:
case
MRB_TT_STRING
:
if
(
RSTR_NOFREE_P
(
RSTRING
(
val
)))
{
if
(
RSTR_NOFREE_P
(
RSTRING
(
val
)))
{
pv
->
tt
=
(
RSTRING_LEN
(
val
)
<<
2
)
|
IREP_TT_SSTR
;
pv
->
tt
=
(
uint32_t
)(
RSTRING_LEN
(
val
)
<<
2
)
|
IREP_TT_SSTR
;
pv
->
u
.
str
=
RSTRING_PTR
(
val
);
pv
->
u
.
str
=
RSTRING_PTR
(
val
);
}
}
else
{
else
{
char
*
p
;
char
*
p
;
mrb_int
len
=
RSTRING_LEN
(
val
);
mrb_int
len
=
RSTRING_LEN
(
val
);
pv
->
tt
=
(
len
<<
2
)
|
IREP_TT_STR
;
pv
->
tt
=
(
uint32_t
)(
len
<<
2
)
|
IREP_TT_STR
;
p
=
(
char
*
)
codegen_realloc
(
s
,
NULL
,
len
+
1
);
p
=
(
char
*
)
codegen_realloc
(
s
,
NULL
,
len
+
1
);
memcpy
(
p
,
RSTRING_PTR
(
val
),
len
);
memcpy
(
p
,
RSTRING_PTR
(
val
),
len
);
p
[
len
]
=
'\0'
;
p
[
len
]
=
'\0'
;
...
...
src/dump.c
View file @
d2f267a1
...
@@ -160,7 +160,7 @@ write_pool_block(mrb_state *mrb, const mrb_irep *irep, uint8_t *buf)
...
@@ -160,7 +160,7 @@ write_pool_block(mrb_state *mrb, const mrb_irep *irep, uint8_t *buf)
{
{
int
pool_no
;
int
pool_no
;
uint8_t
*
cur
=
buf
;
uint8_t
*
cur
=
buf
;
int
len
;
mrb_
int
len
;
const
char
*
ptr
;
const
char
*
ptr
;
cur
+=
uint16_to_bin
(
irep
->
plen
,
cur
);
/* number of pool */
cur
+=
uint16_to_bin
(
irep
->
plen
,
cur
);
/* number of pool */
...
@@ -936,11 +936,11 @@ dump_pool(mrb_state *mrb, const mrb_pool_value *p, FILE *fp)
...
@@ -936,11 +936,11 @@ dump_pool(mrb_state *mrb, const mrb_pool_value *p, FILE *fp)
if
(
p
->
tt
&
IREP_TT_NFLAG
)
{
/* number */
if
(
p
->
tt
&
IREP_TT_NFLAG
)
{
/* number */
switch
(
p
->
tt
)
{
switch
(
p
->
tt
)
{
case
IREP_TT_INT32
:
case
IREP_TT_INT32
:
fprintf
(
fp
,
"{IREP_TT_INT32, {.i32=%"
PRId32
"}},
\n
"
,
p
->
u
.
i32
);
fprintf
(
fp
,
"{IREP_TT_INT32, {.i32=%"
PRId32
"}},
\n
"
,
p
->
u
.
i32
);
break
;
break
;
#ifdef MRB_64BIT
#ifdef MRB_64BIT
case
IREP_TT_INT64
:
case
IREP_TT_INT64
:
fprintf
(
fp
,
"{IREP_TT_INT64, {.i64=%"
PRId64
"}},
\n
"
,
p
->
u
.
i64
);
fprintf
(
fp
,
"{IREP_TT_INT64, {.i64=%"
PRId64
"}},
\n
"
,
p
->
u
.
i64
);
break
;
break
;
#endif
#endif
case
IREP_TT_FLOAT
:
case
IREP_TT_FLOAT
:
...
@@ -948,7 +948,7 @@ dump_pool(mrb_state *mrb, const mrb_pool_value *p, FILE *fp)
...
@@ -948,7 +948,7 @@ dump_pool(mrb_state *mrb, const mrb_pool_value *p, FILE *fp)
fprintf
(
fp
,
"{IREP_TT_FLOAT, {.f=%#.1f}},
\n
"
,
p
->
u
.
f
);
fprintf
(
fp
,
"{IREP_TT_FLOAT, {.f=%#.1f}},
\n
"
,
p
->
u
.
f
);
}
}
else
{
else
{
fprintf
(
fp
,
"{IREP_TT_FLOAT, {.f="
MRB_FLOAT_FMT
"}},
\n
"
,
p
->
u
.
f
);
fprintf
(
fp
,
"{IREP_TT_FLOAT, {.f="
MRB_FLOAT_FMT
"}},
\n
"
,
p
->
u
.
f
);
}
}
break
;
break
;
}
}
...
...
src/load.c
View file @
d2f267a1
...
@@ -242,8 +242,8 @@ read_irep_record(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags)
...
@@ -242,8 +242,8 @@ read_irep_record(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags)
struct
RData
*
irep_obj
=
mrb_data_object_alloc
(
mrb
,
mrb
->
object_class
,
NULL
,
&
tempirep_type
);
struct
RData
*
irep_obj
=
mrb_data_object_alloc
(
mrb
,
mrb
->
object_class
,
NULL
,
&
tempirep_type
);
int
ai
=
mrb_gc_arena_save
(
mrb
);
int
ai
=
mrb_gc_arena_save
(
mrb
);
mrb_irep
*
irep
=
read_irep_record_1
(
mrb
,
bin
,
len
,
flags
);
mrb_irep
*
irep
=
read_irep_record_1
(
mrb
,
bin
,
len
,
flags
);
int
i
;
mrb_irep
**
reps
;
mrb_irep
**
reps
;
int
i
;
mrb_gc_arena_restore
(
mrb
,
ai
);
mrb_gc_arena_restore
(
mrb
,
ai
);
if
(
irep
==
NULL
)
{
if
(
irep
==
NULL
)
{
...
...
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