Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/efuns/datetime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/efuns/dump_prog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions lib/efuns/edit_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions lib/efuns/interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions lib/efuns/replace_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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--);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/lpc/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--)
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/lpc/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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++) == '+')
{
Expand Down
4 changes: 2 additions & 2 deletions lib/lpc/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions src/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() */
Expand All @@ -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() */
Expand Down
Loading