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:
Ben Harris
2023-02-18 23:14:12 +00:00
parent 3c3468355f
commit 26c7f3aa28
5 changed files with 9 additions and 9 deletions

View File

@ -1370,7 +1370,7 @@ static bool game_has_unique_soln(const game_state *state, int diff)
{
bool ret;
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);

View File

@ -551,7 +551,7 @@ static const char *validate_desc(const game_params *params, const char *desc)
{
const char *prob;
game_state *st = new_game_int(params, desc, &prob);
if (!st) return (char*)prob;
if (!st) return prob;
free_game(st);
return NULL;
}
@ -2590,7 +2590,7 @@ static void start_soak(game_params *p, random_state *rs)
sfree(aux);
}
int main(int argc, const char *argv[])
int main(int argc, char *argv[])
{
bool print = false, soak = false, solved = false;
int ret;

View File

@ -109,7 +109,7 @@ void SHA_Init(SHA_State * s)
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 lenw = len;
int i;

View File

@ -1031,8 +1031,8 @@ static void connect_numbers(game_state *state)
static int compare_heads(const void *a, const void *b)
{
struct head_meta *ha = (struct head_meta *)a;
struct head_meta *hb = (struct head_meta *)b;
const struct head_meta *ha = (const struct head_meta *)a;
const struct head_meta *hb = (const struct head_meta *)b;
/* Heads with preferred colours first... */
if (ha->preference && !hb->preference) return -1;
@ -2421,7 +2421,7 @@ static void process_desc(char *id)
thegame.free_params(p);
}
int main(int argc, const char *argv[])
int main(int argc, char *argv[])
{
char *id = NULL, *desc, *aux = NULL;
const char *err;

View File

@ -444,8 +444,8 @@ typedef struct vertex {
static int vertcmpC(const void *av, const void *bv)
{
const vertex *a = (vertex *)av;
const vertex *b = (vertex *)bv;
const vertex *a = (const vertex *)av;
const vertex *b = (const vertex *)bv;
if (a->param < b->param)
return -1;