From 5a4beeed2d0c229a3a558650f03c8390da2d556c Mon Sep 17 00:00:00 2001 From: Max Anselm Date: Sun, 29 Jul 2012 19:45:27 -0400 Subject: Make all(?) void casts explicit for C++ --- src/load.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/load.c') diff --git a/src/load.c b/src/load.c index c1c0a7eed..cee985f43 100644 --- a/src/load.c +++ b/src/load.c @@ -143,7 +143,7 @@ load_rite_irep_record(mrb_state *mrb, RiteFILE* rfp, unsigned char* dst, uint32_ uint16_t buf_size =0; buf_size = MRB_DUMP_DEFAULT_STR_LEN; - if ((char_buf = mrb_malloc(mrb, buf_size)) == 0) + if ((char_buf = (char *)mrb_malloc(mrb, buf_size)) == 0) goto error_exit; pStart = dst; @@ -192,7 +192,7 @@ load_rite_irep_record(mrb_state *mrb, RiteFILE* rfp, unsigned char* dst, uint32_ if ( pdl > buf_size - 1) { buf_size = pdl + 1; - if ((char_buf = mrb_realloc(mrb, char_buf, buf_size)) == 0) + if ((char_buf = (char *)mrb_realloc(mrb, char_buf, buf_size)) == 0) goto error_exit; } memset(char_buf, '\0', buf_size); @@ -219,7 +219,7 @@ load_rite_irep_record(mrb_state *mrb, RiteFILE* rfp, unsigned char* dst, uint32_ if ( snl > buf_size - 1) { buf_size = snl + 1; - if ((char_buf = mrb_realloc(mrb, char_buf, buf_size)) == 0) + if ((char_buf = (char *)mrb_realloc(mrb, char_buf, buf_size)) == 0) goto error_exit; } memset(char_buf, '\0', buf_size); @@ -262,7 +262,7 @@ mrb_load_irep(mrb_state *mrb, FILE* fp) return ret; len = sizeof(rite_binary_header) + bin_to_uint32(bin_header.rbds); - if ((rite_dst = mrb_malloc(mrb, len)) == NULL) + if ((rite_dst = (unsigned char *)mrb_malloc(mrb, len)) == NULL) return MRB_DUMP_GENERAL_FAILURE; dst = rite_dst; @@ -331,7 +331,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 int ai = mrb_gc_arena_save(mrb); recordStart = src; - buf = mrb_malloc(mrb, bufsize); + buf = (char *)mrb_malloc(mrb, bufsize); if (buf == NULL) { ret = MRB_DUMP_INVALID_IREP; goto error_exit; @@ -359,7 +359,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 irep->ilen = bin_to_uint32(src); //iseq length src += MRB_DUMP_SIZE_OF_LONG; if (irep->ilen > 0) { - if ((irep->iseq = mrb_malloc(mrb, sizeof(mrb_code) * irep->ilen)) == NULL) { + if ((irep->iseq = (mrb_code *)mrb_malloc(mrb, sizeof(mrb_code) * irep->ilen)) == NULL) { ret = MRB_DUMP_GENERAL_FAILURE; goto error_exit; } @@ -380,7 +380,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 irep->plen = bin_to_uint32(src); //pool length src += MRB_DUMP_SIZE_OF_LONG; if (irep->plen > 0) { - irep->pool = mrb_malloc(mrb, sizeof(mrb_value) * irep->plen); + irep->pool = (mrb_value *)mrb_malloc(mrb, sizeof(mrb_value) * irep->plen); if (irep->pool == NULL) { ret = MRB_DUMP_INVALID_IREP; goto error_exit; @@ -394,7 +394,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 if (pdl > bufsize - 1) { mrb_free(mrb, buf); bufsize = pdl + 1; - if ((buf = mrb_malloc(mrb, bufsize)) == NULL) { + if ((buf = (char *)mrb_malloc(mrb, bufsize)) == NULL) { ret = MRB_DUMP_GENERAL_FAILURE; goto error_exit; } @@ -443,7 +443,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 irep->slen = bin_to_uint32(src); //syms length src += MRB_DUMP_SIZE_OF_LONG; if (irep->slen > 0) { - if ((irep->syms = mrb_malloc(mrb, sizeof(mrb_sym) * irep->slen)) == NULL) { + if ((irep->syms = (mrb_sym *)mrb_malloc(mrb, sizeof(mrb_sym) * irep->slen)) == NULL) { ret = MRB_DUMP_INVALID_IREP; goto error_exit; } @@ -461,7 +461,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 if (snl > bufsize - 1) { mrb_free(mrb, buf); bufsize = snl + 1; - if ((buf = mrb_malloc(mrb, bufsize)) == NULL) { + if ((buf = (char *)mrb_malloc(mrb, bufsize)) == NULL) { ret = MRB_DUMP_GENERAL_FAILURE; goto error_exit; } @@ -509,7 +509,7 @@ mrb_read_irep(mrb_state *mrb, const char *bin) mrb_add_irep(mrb, sirep + nirep); for (n=0,i=sirep; nirep[i] = mrb_malloc(mrb, sizeof(mrb_irep))) == NULL) { + if ((mrb->irep[i] = (mrb_irep *)mrb_malloc(mrb, sizeof(mrb_irep))) == NULL) { ret = MRB_DUMP_GENERAL_FAILURE; goto error_exit; } -- cgit v1.2.3