int and size_t
This commit is contained in:
parent
7b0ec3adde
commit
cb54f0e065
11
codegen.c
11
codegen.c
|
@ -490,7 +490,6 @@ analyze_if(analyze_state *state, pic_value obj, bool tailpos)
|
|||
switch (pic_length(pic, obj)) {
|
||||
default:
|
||||
pic_errorf(pic, "syntax error");
|
||||
break;
|
||||
case 4:
|
||||
if_false = pic_list_ref(pic, obj, 3);
|
||||
FALLTHROUGH;
|
||||
|
@ -956,7 +955,7 @@ create_activation(codegen_context *cxt)
|
|||
if ((n = xh_val(xh_get_int(®s, *var), size_t)) <= xv_size(&cxt->args) || (cxt->varg && n == xv_size(&cxt->args) + 1)) {
|
||||
/* copy arguments to capture variable area */
|
||||
cxt->code[cxt->clen].insn = OP_LREF;
|
||||
cxt->code[cxt->clen].u.i = n;
|
||||
cxt->code[cxt->clen].u.i = (int)n;
|
||||
cxt->clen++;
|
||||
} else {
|
||||
/* otherwise, just extend the stack */
|
||||
|
@ -1030,9 +1029,9 @@ pop_codegen_context(codegen_state *state)
|
|||
irep = (struct pic_irep *)pic_obj_alloc(pic, sizeof(struct pic_irep), PIC_TT_IREP);
|
||||
irep->name = state->cxt->name;
|
||||
irep->varg = state->cxt->varg;
|
||||
irep->argc = xv_size(&state->cxt->args) + 1;
|
||||
irep->localc = xv_size(&state->cxt->locals);
|
||||
irep->capturec = xv_size(&state->cxt->captures);
|
||||
irep->argc = (int)xv_size(&state->cxt->args) + 1;
|
||||
irep->localc = (int)xv_size(&state->cxt->locals);
|
||||
irep->capturec = (int)xv_size(&state->cxt->captures);
|
||||
irep->code = pic_realloc(pic, state->cxt->code, sizeof(pic_code) * state->cxt->clen);
|
||||
irep->clen = state->cxt->clen;
|
||||
irep->irep = pic_realloc(pic, state->cxt->irep, sizeof(struct pic_irep *) * state->cxt->ilen);
|
||||
|
@ -1067,7 +1066,7 @@ index_capture(codegen_state *state, pic_sym sym, int depth)
|
|||
for (i = 0; i < xv_size(&cxt->captures); ++i) {
|
||||
var = xv_get(&cxt->captures, i);
|
||||
if (*var == sym)
|
||||
return i;
|
||||
return (int)i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
14
vector.c
14
vector.c
|
@ -243,14 +243,15 @@ static pic_value
|
|||
pic_vec_vector_map(pic_state *pic)
|
||||
{
|
||||
struct pic_proc *proc;
|
||||
int argc, i, len, j;
|
||||
int argc;
|
||||
size_t i, len, j;
|
||||
pic_value *argv, vals;
|
||||
pic_vec *vec;
|
||||
|
||||
pic_get_args(pic, "l*", &proc, &argc, &argv);
|
||||
|
||||
len = INT_MAX;
|
||||
for (i = 0; i < argc; ++i) {
|
||||
for (i = 0; i < (size_t)argc; ++i) {
|
||||
pic_assert_type(pic, argv[i], vec);
|
||||
|
||||
len = len < pic_vec_ptr(argv[i])->len
|
||||
|
@ -262,7 +263,7 @@ pic_vec_vector_map(pic_state *pic)
|
|||
|
||||
for (i = 0; i < len; ++i) {
|
||||
vals = pic_nil_value();
|
||||
for (j = 0; j < argc; ++j) {
|
||||
for (j = 0; j < (size_t)argc; ++j) {
|
||||
pic_push(pic, pic_vec_ptr(argv[j])->data[i], vals);
|
||||
}
|
||||
vec->data[i] = pic_apply(pic, proc, vals);
|
||||
|
@ -275,13 +276,14 @@ static pic_value
|
|||
pic_vec_vector_for_each(pic_state *pic)
|
||||
{
|
||||
struct pic_proc *proc;
|
||||
int argc, i, len, j;
|
||||
int argc;
|
||||
size_t i, len, j;
|
||||
pic_value *argv, vals;
|
||||
|
||||
pic_get_args(pic, "l*", &proc, &argc, &argv);
|
||||
|
||||
len = INT_MAX;
|
||||
for (i = 0; i < argc; ++i) {
|
||||
for (i = 0; i < (size_t)argc; ++i) {
|
||||
pic_assert_type(pic, argv[i], vec);
|
||||
|
||||
len = len < pic_vec_ptr(argv[i])->len
|
||||
|
@ -291,7 +293,7 @@ pic_vec_vector_for_each(pic_state *pic)
|
|||
|
||||
for (i = 0; i < len; ++i) {
|
||||
vals = pic_nil_value();
|
||||
for (j = 0; j < argc; ++j) {
|
||||
for (j = 0; j < (size_t)argc; ++j) {
|
||||
pic_push(pic, pic_vec_ptr(argv[j])->data[i], vals);
|
||||
}
|
||||
pic_apply(pic, proc, vals);
|
||||
|
|
Loading…
Reference in New Issue