diff --git a/lib/efuns/datetime.c b/lib/efuns/datetime.c index 5af626f..99a70f0 100644 --- a/lib/efuns/datetime.c +++ b/lib/efuns/datetime.c @@ -30,18 +30,18 @@ void f_ctime (void) { char *cp, *nl, *p; - int l; + size_t len; time_t t = (time_t)sp->u.number; cp = ctime (&t); if ((nl = strchr (cp, '\n'))) - l = nl - cp; + len = nl - cp; else - l = strlen (cp); + len = strlen (cp); - p = new_string (l, "f_ctime"); - strncpy (p, cp, l); - p[l] = '\0'; + p = new_string (len, "f_ctime"); + strncpy (p, cp, len); + p[len] = '\0'; put_malloced_string (p); } #endif diff --git a/lib/efuns/dump_prog.c b/lib/efuns/dump_prog.c index f42b1b0..166e92d 100644 --- a/lib/efuns/dump_prog.c +++ b/lib/efuns/dump_prog.c @@ -28,13 +28,13 @@ f_dump_prog (void) if (st_num_arg == 2) { ob = sp[-1].u.ob; - d = sp->u.number; + d = (int)sp->u.number; where = 0; } else if (st_num_arg == 3) { ob = sp[-2].u.ob; - d = sp[-1].u.number; + d = (int)sp[-1].u.number; where = (sp->type == T_STRING) ? sp->u.string : 0; } else @@ -63,7 +63,7 @@ f_dump_prog (void) * 2 - dump line number table */ static void -dump_prog (program_t * prog, char *fn, int flags) +dump_prog (program_t * prog, char *fn, int dump_flags) { char *fname; FILE *f; @@ -156,12 +156,12 @@ dump_prog (program_t * prog, char *fn, int flags) fputc ('\n', f); } - if (flags & 1) + if (dump_flags & 1) { fprintf (f, "\n;;; *** Disassembly ***\n"); disassemble (f, prog->program, 0, prog->program_size, prog); } - if (flags & 2) + if (dump_flags & 2) { fprintf (f, "\n;;; *** Line Number Info ***\n"); dump_line_numbers (f, prog); diff --git a/lib/efuns/edit_source.c b/lib/efuns/edit_source.c index 225a2ec..e1116a2 100644 --- a/lib/efuns/edit_source.c +++ b/lib/efuns/edit_source.c @@ -476,13 +476,11 @@ expand_define () if (n == NARGS) { yyerror ("Maximum macro argument count exceeded"); - return 0; } } if (n != p->nargs) { yyerror ("Wrong number of macro arguments"); - return 0; } /* Do expansion */ b = xbuf; diff --git a/lib/efuns/interactive.c b/lib/efuns/interactive.c index d6a1b3e..33238da 100644 --- a/lib/efuns/interactive.c +++ b/lib/efuns/interactive.c @@ -76,7 +76,7 @@ f_get_char (void) { tmp = 1; st_num_arg--; /* Don't count the flag as an arg */ - flag = arg[1].u.number; + flag = (int)arg[1].u.number; } st_num_arg--; i = get_char (arg, flag, st_num_arg, &arg[1 + tmp]); @@ -104,7 +104,7 @@ f_input_to (void) { tmp = 1; st_num_arg--; /* Don't count the flag as an arg */ - flag = arg[1].u.number; + flag = (int)arg[1].u.number; } st_num_arg--; /* Don't count the name of the func either. */ i = input_to (arg, flag, st_num_arg, &arg[1 + tmp]); @@ -171,7 +171,7 @@ void f_remove_interactive (void) { void f_query_idle (void) { - int i; + int64_t i; i = query_idle (sp->u.ob); free_object (sp->u.ob, "f_query_idle"); diff --git a/lib/efuns/replace_program.c b/lib/efuns/replace_program.c index 5f8806a..5d3221a 100644 --- a/lib/efuns/replace_program.c +++ b/lib/efuns/replace_program.c @@ -119,7 +119,7 @@ void f_replace_program (int num_arg, int instruction) { replace_ob_t *tmp; - int name_len; + size_t name_len; char *name, *xname; program_t *new_prog; int var_offset; @@ -157,7 +157,7 @@ f_replace_program (int num_arg, int instruction) obj_list_replace = tmp; } tmp->new_prog = new_prog; - tmp->var_offset = var_offset; + tmp->var_offset = (unsigned short)var_offset; free_string_svalue (sp--); } diff --git a/lib/lpc/class.c b/lib/lpc/class.c index 214bf64..747dff1 100644 --- a/lib/lpc/class.c +++ b/lib/lpc/class.c @@ -37,7 +37,7 @@ allocate_class (class_def_t * cld, int has_values) (array_t *) DXALLOC (sizeof (array_t) + sizeof (svalue_t) * (n - 1), TAG_CLASS, "allocate_class"); p->ref = 1; - p->size = n; + p->size = (unsigned short)n; if (has_values) { while (n--) @@ -60,7 +60,7 @@ allocate_class_by_size (int size) (array_t *) DXALLOC (sizeof (array_t) + sizeof (svalue_t) * (size - 1), TAG_CLASS, "allocate_class"); p->ref = 1; - p->size = size; + p->size = (unsigned short)size; while (size--) p->item[size] = const0; diff --git a/lib/lpc/object.c b/lib/lpc/object.c index 77c9f7e..d882432 100644 --- a/lib/lpc/object.c +++ b/lib/lpc/object.c @@ -643,7 +643,7 @@ parse_numeric (char **cpp, char c, svalue_t * dest) } if (c == '.') { - float f1 = 0.0, f2 = 10.0; + double f1 = 0.0, f2 = 10.0; c = *cp++; if (!isdigit (c)) @@ -691,7 +691,7 @@ parse_numeric (char **cpp, char c, svalue_t * dest) else if (c == 'e') { int expo = 0; - float f1; + double f1; if ((c = *cp++) == '+') { diff --git a/lib/lpc/program.c b/lib/lpc/program.c index a10642c..5eadc70 100644 --- a/lib/lpc/program.c +++ b/lib/lpc/program.c @@ -133,8 +133,8 @@ runtime_function_u *find_func_entry (const program_t * prog, int index) { else first = mid; } - ret.inh.offset = first; - ret.inh.index = index - prog->inherit[first].function_index_offset; + ret.inh.offset = (unsigned short)first; + ret.inh.index = (unsigned short)index - prog->inherit[first].function_index_offset; return &ret; /* FIXME: returning pointer to static variable */ } else diff --git a/src/backend.c b/src/backend.c index 76b361f..4b25806 100644 --- a/src/backend.c +++ b/src/backend.c @@ -408,7 +408,7 @@ static void look_for_objects_to_swap () { for (ob = obj_list; ob; ob = next_ob) { - int ref_time; + time_t ref_time; /* * Objects can be destructed, which means that next object to @@ -766,19 +766,19 @@ void update_load_av () { static time_t last_time; - int n; + time_t duration; double c; static int acc = 0; acc++; if (current_time == last_time) return; - n = current_time - last_time; - if (n < NUM_CONSTS) - c = consts[n]; + duration = current_time - last_time; + if (duration < NUM_CONSTS) + c = consts[duration]; else - c = exp (-n / 900.0); - load_av = c * load_av + acc * (1 - c) / n; + c = exp (-duration / 900.0); + load_av = c * load_av + acc * (1 - c) / duration; last_time = current_time; acc = 0; } /* update_load_av() */ @@ -789,19 +789,19 @@ void update_compile_av (int lines) { static time_t last_time; - int n; + time_t duration; double c; static int acc = 0; acc += lines; if (current_time == last_time) return; - n = current_time - last_time; - if (n < NUM_CONSTS) - c = consts[n]; + duration = current_time - last_time; + if (duration < NUM_CONSTS) + c = consts[duration]; else - c = exp (-n / 900.0); - compile_av = c * compile_av + acc * (1 - c) / n; + c = exp (-duration / 900.0); + compile_av = c * compile_av + acc * (1 - c) / duration; last_time = current_time; acc = 0; } /* update_compile_av() */