util.h: Use size_t for static array sizes
This commit is contained in:
parent
20e46a98dd
commit
ccba946973
|
@ -100,19 +100,19 @@ MrbData::MrbData(mrb_state *mrb)
|
||||||
{
|
{
|
||||||
int arena = mrb_gc_arena_save(mrb);
|
int arena = mrb_gc_arena_save(mrb);
|
||||||
|
|
||||||
for (int i = 0; i < excDataN; ++i)
|
for (size_t i = 0; i < excDataN; ++i)
|
||||||
exc[excData[i].ind] = mrb_define_class(mrb, excData[i].str, mrb->eException_class);
|
exc[excData[i].ind] = mrb_define_class(mrb, excData[i].str, mrb->eException_class);
|
||||||
|
|
||||||
RClass *errnoMod = mrb_define_module(mrb, "Errno");
|
RClass *errnoMod = mrb_define_module(mrb, "Errno");
|
||||||
|
|
||||||
for (int i = 0; i < enoExcDataN; ++i)
|
for (size_t i = 0; i < enoExcDataN; ++i)
|
||||||
exc[enoExcData[i].ind] =
|
exc[enoExcData[i].ind] =
|
||||||
mrb_define_class_under(mrb, errnoMod, enoExcData[i].str, mrb->eStandardError_class);
|
mrb_define_class_under(mrb, errnoMod, enoExcData[i].str, mrb->eStandardError_class);
|
||||||
|
|
||||||
exc[TypeError] = mrb_class_get(mrb, "TypeError");
|
exc[TypeError] = mrb_class_get(mrb, "TypeError");
|
||||||
exc[ArgumentError] = mrb_class_get(mrb, "ArgumentError");
|
exc[ArgumentError] = mrb_class_get(mrb, "ArgumentError");
|
||||||
|
|
||||||
for (int i = 0; i < symDataN; ++i)
|
for (size_t i = 0; i < symDataN; ++i)
|
||||||
symbols[symData[i].ind] = mrb_intern_cstr(mrb, symData[i].str);
|
symbols[symData[i].ind] = mrb_intern_cstr(mrb, symData[i].str);
|
||||||
|
|
||||||
mrb_gc_arena_restore(mrb, arena);
|
mrb_gc_arena_restore(mrb, arena);
|
||||||
|
|
|
@ -332,7 +332,7 @@ struct InputPrivate
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (code < 0 || code > mapToIndexN-1)
|
if (code < 0 || (size_t) code > mapToIndexN-1)
|
||||||
index = 0;
|
index = 0;
|
||||||
else
|
else
|
||||||
index = mapToIndex[code];
|
index = mapToIndex[code];
|
||||||
|
|
|
@ -103,7 +103,7 @@ inline bool contains(const C &c, const V &v)
|
||||||
|
|
||||||
#define ARRAY_SIZE(obj) (sizeof(obj) / sizeof((obj)[0]))
|
#define ARRAY_SIZE(obj) (sizeof(obj) / sizeof((obj)[0]))
|
||||||
|
|
||||||
#define elementsN(obj) const int obj##N = ARRAY_SIZE(obj)
|
#define elementsN(obj) const size_t obj##N = ARRAY_SIZE(obj)
|
||||||
|
|
||||||
#define DECL_ATTR_DETAILED(name, type, keyword1, keyword2) \
|
#define DECL_ATTR_DETAILED(name, type, keyword1, keyword2) \
|
||||||
keyword1 type get##name() keyword2; \
|
keyword1 type get##name() keyword2; \
|
||||||
|
|
Loading…
Reference in New Issue