Fix warnings in frotz, one of which is a real bug :)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24268 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Torne Wuff 2010-01-17 22:28:36 +00:00
parent 7f28c94eda
commit d10bcd6429
2 changed files with 6 additions and 6 deletions

View file

@ -53,7 +53,7 @@ int os_random_seed (void)
{ {
if (user_random_seed == -1) if (user_random_seed == -1)
/* Use the rockbox tick as seed value */ /* Use the rockbox tick as seed value */
return ((int)rb->current_tick) & 0x7fff; return ((int)*rb->current_tick) & 0x7fff;
else return user_random_seed; else return user_random_seed;
} }

View file

@ -342,7 +342,7 @@ void init_memory (void)
} }
/* Assign left over memory as the arena for undo alloc */ /* Assign left over memory as the arena for undo alloc */
arena_start = arena_next = (void*)((int)(zmp + story_size + 3) & ~3); arena_start = arena_next = (void*)((intptr_t)(zmp + story_size + 3) & ~3);
arena_end = zmp + buf_size; arena_end = zmp + buf_size;
/* Load story file in chunks of 32KB */ /* Load story file in chunks of 32KB */
@ -385,7 +385,7 @@ void init_undo (void)
if ((arena_end - arena_start) >= size) { if ((arena_end - arena_start) >= size) {
prev_zmp = arena_start; prev_zmp = arena_start;
undo_diff = arena_start + h_dynamic_size; undo_diff = arena_start + h_dynamic_size;
arena_start = (void*)((int)(arena_start + size + 3) & ~3); arena_start = (void*)((intptr_t)(arena_start + size + 3) & ~3);
arena_next = arena_start; arena_next = arena_start;
memcpy (prev_zmp, zmp, h_dynamic_size); memcpy (prev_zmp, zmp, h_dynamic_size);
} else } else
@ -691,7 +691,7 @@ static long mem_diff (zbyte *a, zbyte *b, zword mem_size, zbyte *diff)
unsigned size = mem_size; unsigned size = mem_size;
zbyte *p = diff; zbyte *p = diff;
unsigned j; unsigned j;
zbyte c; zbyte c = 0;
for (;;) { for (;;) {
for (j = 0; size > 0 && (c = *a++ ^ *b++) == 0; j++) for (j = 0; size > 0 && (c = *a++ ^ *b++) == 0; j++)
@ -928,7 +928,7 @@ int save_undo (void)
if ((arena_end - arena_next) >= size) { if ((arena_end - arena_next) >= size) {
/* Trivial: enough room at the end */ /* Trivial: enough room at the end */
p = arena_next; p = arena_next;
arena_next = (void*)((int)(arena_next + size + 3) & ~3); arena_next = (void*)((intptr_t)(arena_next + size + 3) & ~3);
} else { } else {
/* Need to wrap */ /* Need to wrap */
arena_next = arena_start; arena_next = arena_start;
@ -939,7 +939,7 @@ int save_undo (void)
if (((void*)first_undo - arena_next) >= size) { if (((void*)first_undo - arena_next) >= size) {
/* There is room before the "first" undo */ /* There is room before the "first" undo */
p = arena_next; p = arena_next;
arena_next = (void*)((int)(arena_next + size + 3) & ~3); arena_next = (void*)((intptr_t)(arena_next + size + 3) & ~3);
} else { } else {
/* Not enough room, just need to free some */ /* Not enough room, just need to free some */
p = NULL; p = NULL;