Fix some warnings picked up in an optimized build

This commit is contained in:
Bill Currie 2020-02-24 11:28:43 +09:00
parent c43b9681eb
commit 7406e0308e
4 changed files with 9 additions and 9 deletions

View file

@ -1787,7 +1787,7 @@ struct progs_s {
\return C pointer represented by the parameter. 0 offset -> NULL
*/
static inline pr_type_t *
PR_GetPointer (progs_t *pr, pointer_t o)
PR_GetPointer (const progs_t *pr, pointer_t o)
{
return o ? pr->pr_globals + o : 0;
}
@ -1798,9 +1798,9 @@ PR_GetPointer (progs_t *pr, pointer_t o)
\return Progs offset/pointer represented by \c p. NULL -> 0 offset
*/
static inline pointer_t
PR_SetPointer (progs_t *pr, void *p)
PR_SetPointer (const progs_t *pr, const void *p)
{
return p ? (pr_type_t *) p - pr->pr_globals : 0;
return p ? (const pr_type_t *) p - pr->pr_globals : 0;
}
///@}

View file

@ -92,7 +92,7 @@ Con_BufferAddText (con_buffer_t *buf, const char *text)
}
while (len--) {
byte c = *pos++ = *text++;
if ((size_t) (pos - buf->buffer) >= buf->buffer_size)
if (pos >= buf->buffer + buf->buffer_size)
pos = buf->buffer;
cur_line->len++;
if (pos == tail_line->text) {

View file

@ -196,8 +196,8 @@ pr_debug_expression_error (script_t *script, const char *msg)
}
#define RUP(x,a) (((x) + ((a) - 1)) & ~((a) - 1))
static pr_short_t
pr_debug_type_size (progs_t *pr, qfot_type_t *type)
static pr_short_t __attribute__((pure))
pr_debug_type_size (const progs_t *pr, const qfot_type_t *type)
{
pr_short_t size;
qfot_type_t *aux_type;
@ -208,7 +208,7 @@ pr_debug_type_size (progs_t *pr, qfot_type_t *type)
case ty_union:
size = 0;
for (pr_int_t i = 0; i < type->t.strct.num_fields; i++) {
qfot_var_t *field = &type->t.strct.fields[i];
const qfot_var_t *field = &type->t.strct.fields[i];
aux_type = &G_STRUCT (pr, qfot_type_t, field->type);
size = max (size,
field->offset + pr_debug_type_size (pr, aux_type));
@ -995,7 +995,7 @@ pr_debug_pointer_view (qfot_type_t *type, pr_type_t *value, void *_data)
progs_t *pr = data->pr;
dstring_t *dstr = data->dstr;
pointer_t ofs = value->integer_var;
pr_def_t *def;
pr_def_t *def = 0;
if (pr_debug->int_val && pr->debug) {
def = PR_Get_Local_Def (pr, ofs);

View file

@ -891,7 +891,7 @@ qfo_to_progs (qfo_t *qfo, int *size)
int xdefs_start;
unsigned big_locals = 0;
int big_func = 0;
pr_xdefs_t *xdefs;
pr_xdefs_t *xdefs = 0;
xdef_t *xdef;
*size = RUP (sizeof (dprograms_t), 16);