mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Miscellaneous const fixes
These are cases where -Wcast-qual complained and the only change needed was to add or remove a "const" (or sometimes an entire cast).
This commit is contained in:
2
loopy.c
2
loopy.c
@ -1370,7 +1370,7 @@ static bool game_has_unique_soln(const game_state *state, int diff)
|
|||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
solver_state *sstate_new;
|
solver_state *sstate_new;
|
||||||
solver_state *sstate = new_solver_state((game_state *)state, diff);
|
solver_state *sstate = new_solver_state(state, diff);
|
||||||
|
|
||||||
sstate_new = solve_game_rec(sstate);
|
sstate_new = solve_game_rec(sstate);
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ static const char *validate_desc(const game_params *params, const char *desc)
|
|||||||
{
|
{
|
||||||
const char *prob;
|
const char *prob;
|
||||||
game_state *st = new_game_int(params, desc, &prob);
|
game_state *st = new_game_int(params, desc, &prob);
|
||||||
if (!st) return (char*)prob;
|
if (!st) return prob;
|
||||||
free_game(st);
|
free_game(st);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2590,7 +2590,7 @@ static void start_soak(game_params *p, random_state *rs)
|
|||||||
sfree(aux);
|
sfree(aux);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
bool print = false, soak = false, solved = false;
|
bool print = false, soak = false, solved = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
2
random.c
2
random.c
@ -109,7 +109,7 @@ void SHA_Init(SHA_State * s)
|
|||||||
|
|
||||||
void SHA_Bytes(SHA_State * s, const void *p, int len)
|
void SHA_Bytes(SHA_State * s, const void *p, int len)
|
||||||
{
|
{
|
||||||
unsigned char *q = (unsigned char *) p;
|
const unsigned char *q = (const unsigned char *) p;
|
||||||
uint32 wordblock[16];
|
uint32 wordblock[16];
|
||||||
uint32 lenw = len;
|
uint32 lenw = len;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1031,8 +1031,8 @@ static void connect_numbers(game_state *state)
|
|||||||
|
|
||||||
static int compare_heads(const void *a, const void *b)
|
static int compare_heads(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
struct head_meta *ha = (struct head_meta *)a;
|
const struct head_meta *ha = (const struct head_meta *)a;
|
||||||
struct head_meta *hb = (struct head_meta *)b;
|
const struct head_meta *hb = (const struct head_meta *)b;
|
||||||
|
|
||||||
/* Heads with preferred colours first... */
|
/* Heads with preferred colours first... */
|
||||||
if (ha->preference && !hb->preference) return -1;
|
if (ha->preference && !hb->preference) return -1;
|
||||||
@ -2421,7 +2421,7 @@ static void process_desc(char *id)
|
|||||||
thegame.free_params(p);
|
thegame.free_params(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *id = NULL, *desc, *aux = NULL;
|
char *id = NULL, *desc, *aux = NULL;
|
||||||
const char *err;
|
const char *err;
|
||||||
|
@ -444,8 +444,8 @@ typedef struct vertex {
|
|||||||
|
|
||||||
static int vertcmpC(const void *av, const void *bv)
|
static int vertcmpC(const void *av, const void *bv)
|
||||||
{
|
{
|
||||||
const vertex *a = (vertex *)av;
|
const vertex *a = (const vertex *)av;
|
||||||
const vertex *b = (vertex *)bv;
|
const vertex *b = (const vertex *)bv;
|
||||||
|
|
||||||
if (a->param < b->param)
|
if (a->param < b->param)
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user