From 2f2180767d47ece430fee1343ee357ca97d24770 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 24 Feb 2007 20:19:27 +0000 Subject: [PATCH] Massive warnings cleanup and cleanup of size_t vs uintptr_t vs unsigned long. svn path=/trunk/yasm/; revision=1792 --- frontends/yasm/yasm-options.c | 4 ++-- libyasm/bitvect.c | 10 ++++----- libyasm/coretype.h | 6 +++--- libyasm/expr.c | 4 ++-- libyasm/floatnum.c | 4 ++-- libyasm/intnum.c | 8 ++++---- libyasm/md5.c | 2 +- libyasm/md5.h | 2 +- libyasm/mergesort.c | 3 ++- libyasm/phash.c | 14 +++++++------ libyasm/phash.h | 4 ++-- modules/arch/x86/x86bc.c | 2 +- modules/arch/x86/x86expr.c | 6 +++--- modules/arch/x86/x86id.c | 27 ++++++++++++------------- modules/dbgfmts/codeview/cv-symline.c | 7 ++++--- modules/dbgfmts/codeview/cv-type.c | 2 +- modules/dbgfmts/dwarf2/dwarf2-aranges.c | 2 +- modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h | 12 +++++------ modules/dbgfmts/dwarf2/dwarf2-info.c | 4 ++-- modules/dbgfmts/dwarf2/dwarf2-line.c | 21 ++++++++++--------- modules/dbgfmts/stabs/stabs-dbgfmt.c | 2 +- modules/listfmts/nasm/nasm-listfmt.c | 2 +- modules/objfmts/bin/bin-objfmt.c | 3 ++- modules/objfmts/coff/coff-objfmt.c | 14 ++++++------- modules/objfmts/dbg/dbg-objfmt.c | 2 +- modules/objfmts/elf/elf-objfmt.c | 10 ++++----- modules/objfmts/elf/elf.c | 8 ++++---- modules/objfmts/macho/macho-objfmt.c | 6 ++++-- modules/objfmts/rdf/rdf-objfmt.c | 6 +++--- modules/objfmts/xdf/xdf-objfmt.c | 8 ++++---- modules/parsers/gas/gas-parse.c | 12 ++++++----- modules/parsers/nasm/nasm-parse.c | 6 +++--- modules/preprocs/nasm/nasm-pp.c | 27 +++++++++++++------------ modules/preprocs/nasm/nasmlib.c | 4 ++-- modules/preprocs/nasm/nasmlib.h | 2 +- tools/gap/gap.c | 2 +- tools/gap/perfect.c | 2 +- 37 files changed, 135 insertions(+), 125 deletions(-) diff --git a/frontends/yasm/yasm-options.c b/frontends/yasm/yasm-options.c index 95464d2c..fed8d694 100644 --- a/frontends/yasm/yasm-options.c +++ b/frontends/yasm/yasm-options.c @@ -161,8 +161,8 @@ help_msg(const char *msg, const char *tail, opt_option *options, size_t nopts) printf("%s", gettext(msg)); for (i = 0; i < nopts; i++) { - int shortopt_len = 0; - int longopt_len = 0; + size_t shortopt_len = 0; + size_t longopt_len = 0; optbuf[0] = 0; optopt[0] = 0; diff --git a/libyasm/bitvect.c b/libyasm/bitvect.c index abebc8f8..c39f9b65 100644 --- a/libyasm/bitvect.c +++ b/libyasm/bitvect.c @@ -1497,7 +1497,7 @@ ErrCode BitVector_from_Hex(wordptr addr, charptr string) N_word size = size_(addr); N_word mask = mask_(addr); boolean ok = TRUE; - N_word length; + size_t length; N_word value; N_word count; int digit; @@ -1534,7 +1534,7 @@ ErrCode BitVector_from_Oct(wordptr addr, charptr string) N_word size = size_(addr); N_word mask = mask_(addr); boolean ok = TRUE; - N_word length; + size_t length; N_word value; N_word value_fill = 0; N_word count; @@ -1609,7 +1609,7 @@ ErrCode BitVector_from_Bin(wordptr addr, charptr string) N_word size = size_(addr); N_word mask = mask_(addr); boolean ok = TRUE; - N_word length; + size_t length; N_word value; N_word count; int digit; @@ -1819,7 +1819,7 @@ ErrCode BitVector_from_Dec_static(BitVector_from_Dec_static_data *data, N_word accu; N_word powr; N_word count; - N_word length; + size_t length; int digit; if (bits > 0) @@ -1930,7 +1930,7 @@ ErrCode BitVector_from_Dec(wordptr addr, charptr string) N_word accu; N_word powr; N_word count; - N_word length; + size_t length; int digit; if (bits > 0) diff --git a/libyasm/coretype.h b/libyasm/coretype.h index 1e22709a..a6b92b04 100644 --- a/libyasm/coretype.h +++ b/libyasm/coretype.h @@ -260,7 +260,7 @@ typedef enum yasm_sym_vis { * \return Nonzero if an error occurred, 0 otherwise. */ typedef int (*yasm_output_value_func) - (yasm_value *value, /*@out@*/ unsigned char *buf, size_t destsize, + (yasm_value *value, /*@out@*/ unsigned char *buf, unsigned int destsize, unsigned long offset, yasm_bytecode *bc, int warn, /*@null@*/ void *d); /** Convert a symbol reference to its byte representation. Usually implemented @@ -281,8 +281,8 @@ typedef int (*yasm_output_value_func) * \return Nonzero if an error occurred, 0 otherwise. */ typedef int (*yasm_output_reloc_func) - (yasm_symrec *sym, yasm_bytecode *bc, unsigned char *buf, size_t destsize, - size_t valsize, int warn, void *d); + (yasm_symrec *sym, yasm_bytecode *bc, unsigned char *buf, + unsigned int destsize, unsigned int valsize, int warn, void *d); /** Sort an array using merge sort algorithm. * \internal diff --git a/libyasm/expr.c b/libyasm/expr.c index 461dd1bc..4495b28f 100644 --- a/libyasm/expr.c +++ b/libyasm/expr.c @@ -75,7 +75,7 @@ yasm_expr_create(yasm_expr_op op, yasm_expr__item *left, ptr->terms[1].type = YASM_EXPR_NONE; if (left) { ptr->terms[0] = *left; /* structure copy */ - z = left-itempool; + z = (unsigned long)(left-itempool); if (z>=31) yasm_internal_error(N_("could not find expritem in pool")); itempool_used &= ~(1<terms[1] = *right; /* structure copy */ - z = right-itempool; + z = (unsigned long)(right-itempool); if (z>=31) yasm_internal_error(N_("could not find expritem in pool")); itempool_used &= ~(1< (long)flt->exponent) norm_amt = (long)flt->exponent; BitVector_Move_Left(flt->mantissa, (N_int)norm_amt); - flt->exponent -= norm_amt; + flt->exponent -= (unsigned short)norm_amt; } /* acc *= op */ @@ -291,7 +291,7 @@ floatnum_mul(yasm_floatnum *acc, const yasm_floatnum *op) if (norm_amt > (long)acc->exponent) norm_amt = (long)acc->exponent; BitVector_Move_Left(product, (N_int)norm_amt); - acc->exponent -= norm_amt; + acc->exponent -= (unsigned short)norm_amt; /* Store the highest bits of the result */ BitVector_Interval_Copy(acc->mantissa, product, 0, MANT_BITS, MANT_BITS); diff --git a/libyasm/intnum.c b/libyasm/intnum.c index 3f06c3b5..3b3ad374 100644 --- a/libyasm/intnum.c +++ b/libyasm/intnum.c @@ -288,7 +288,7 @@ yasm_intnum_create_leb128(const unsigned char *ptr, int sign, ptr++; } - *size = (ptr-ptr_orig)+1; + *size = (unsigned long)(ptr-ptr_orig)+1; if(i > BITVECT_NATIVE_SIZE) yasm_error_set(YASM_ERROR_OVERFLOW, @@ -730,7 +730,7 @@ yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr, /* TODO */ yasm_internal_error(N_("big endian not implemented")); } else - BitVector_Block_Store(op1, ptr, destsize); + BitVector_Block_Store(op1, ptr, (N_int)destsize); /* If not already a bitvect, convert value to be written to a bitvect */ if (intn->type == INTNUM_BV) @@ -744,7 +744,7 @@ yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr, /* Check low bits if right shifting and warnings enabled */ if (warn && rshift > 0) { BitVector_Copy(conv_bv, op2); - BitVector_Move_Left(conv_bv, BITVECT_NATIVE_SIZE-rshift); + BitVector_Move_Left(conv_bv, (N_int)(BITVECT_NATIVE_SIZE-rshift)); if (!BitVector_is_empty(conv_bv)) yasm_warn_set(YASM_WARN_GENERAL, N_("misaligned value, truncating to boundary")); @@ -759,7 +759,7 @@ yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr, } /* Write the new value into the destination bitvect */ - BitVector_Interval_Copy(op1, op2, (unsigned int)shift, 0, valsize); + BitVector_Interval_Copy(op1, op2, (unsigned int)shift, 0, (N_int)valsize); /* Write out the new data */ buf = BitVector_Block_Read(op1, &len); diff --git a/libyasm/md5.c b/libyasm/md5.c index d53ef378..af045fbe 100644 --- a/libyasm/md5.c +++ b/libyasm/md5.c @@ -77,7 +77,7 @@ yasm_md5_init(yasm_md5_context *ctx) */ void yasm_md5_update(yasm_md5_context *ctx, unsigned char const *buf, - unsigned len) + unsigned long len) { unsigned long t; diff --git a/libyasm/md5.h b/libyasm/md5.h index 52559a0d..91be1c55 100644 --- a/libyasm/md5.h +++ b/libyasm/md5.h @@ -21,7 +21,7 @@ typedef struct yasm_md5_context { void yasm_md5_init(yasm_md5_context *context); void yasm_md5_update(yasm_md5_context *context, unsigned char const *buf, - unsigned len); + unsigned long len); void yasm_md5_final(unsigned char digest[16], yasm_md5_context *context); void yasm_md5_transform(unsigned long buf[4], const unsigned char in[64]); diff --git a/libyasm/mergesort.c b/libyasm/mergesort.c index e460a178..87e451d0 100644 --- a/libyasm/mergesort.c +++ b/libyasm/mergesort.c @@ -278,7 +278,8 @@ setup(unsigned char *list1, unsigned char *list2, size_t n, size_t size, { size_t i; unsigned int tmp; - int length, size2, sense; + int length, sense; + size_t size2; unsigned char *f1, *f2, *s, *l2, *last, *p2; size2 = size*2; diff --git a/libyasm/phash.c b/libyasm/phash.c index b828bb65..01941c28 100644 --- a/libyasm/phash.c +++ b/libyasm/phash.c @@ -96,10 +96,11 @@ acceptable. Do NOT use for cryptographic purposes. unsigned long phash_lookup( register const char *sk, /* the key */ - register unsigned long length, /* the length of the key */ + register size_t length, /* the length of the key */ register unsigned long level) /* the previous hash, or an arbitrary value */ { - register unsigned long a,b,c,len; + register unsigned long a,b,c; + register size_t len; register const unsigned char *k = (const unsigned char *)sk; /* Set up the internal state */ @@ -121,7 +122,7 @@ phash_lookup( } /*------------------------------------- handle the last 11 bytes */ - c += length; + c += (ub4)length; switch(len) /* all the case statements fall through */ { case 11: c+=((ub4)k[10]<<24); @@ -192,10 +193,11 @@ is trying to cause collisions. Do NOT use for cryptography. void phash_checksum( register const char *sk, - register unsigned long len, + register size_t len, register unsigned long *state) { - register unsigned long a,b,c,d,e,f,g,h,length; + register unsigned long a,b,c,d,e,f,g,h; + register size_t length; register const unsigned char *k = (const unsigned char *)sk; /* Use the length and level; add in the golden ratio. */ @@ -222,7 +224,7 @@ phash_checksum( } /*------------------------------------- handle the last 31 bytes */ - h += length; + h += (ub4)length; switch(len) { case 31: h+=(k[30]<<24); diff --git a/libyasm/phash.h b/libyasm/phash.h index 5fc44e39..bf4cb47c 100644 --- a/libyasm/phash.h +++ b/libyasm/phash.h @@ -10,6 +10,6 @@ Source is http://burtleburtle.net/bob/c/lookupa.h ------------------------------------------------------------------------------ */ -unsigned long phash_lookup(const char *k, unsigned long length, +unsigned long phash_lookup(const char *k, size_t length, unsigned long level); -void phash_checksum(const char *k, unsigned long length, unsigned long *state); +void phash_checksum(const char *k, size_t length, unsigned long *state); diff --git a/modules/arch/x86/x86bc.c b/modules/arch/x86/x86bc.c index f6072787..a4326d32 100644 --- a/modules/arch/x86/x86bc.c +++ b/modules/arch/x86/x86bc.c @@ -793,7 +793,7 @@ x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, /* Prefixes */ x86_common_tobytes(&insn->common, bufp, - x86_ea ? (x86_ea->ea.segreg>>8) : 0); + x86_ea ? (unsigned int)(x86_ea->ea.segreg>>8) : 0); if (insn->special_prefix != 0) YASM_WRITE_8(*bufp, insn->special_prefix); if (insn->rex != 0xff) { diff --git a/modules/arch/x86/x86expr.c b/modules/arch/x86/x86expr.c index e0dd2141..33d246e0 100644 --- a/modules/arch/x86/x86expr.c +++ b/modules/arch/x86/x86expr.c @@ -53,12 +53,12 @@ x86_expr_checkea_get_reg3264(yasm_expr__item *ei, int *regnum, case X86_REG32: if (data->addrsize != 32) return 0; - *regnum = ei->data.reg & 0xF; + *regnum = (unsigned int)(ei->data.reg & 0xF); break; case X86_REG64: if (data->addrsize != 64) return 0; - *regnum = ei->data.reg & 0xF; + *regnum = (unsigned int)(ei->data.reg & 0xF); break; case X86_RIP: if (data->bits != 64) @@ -103,7 +103,7 @@ x86_expr_checkea_get_reg16(yasm_expr__item *ei, int *regnum, void *d) return 0; /* & 7 for sanity check */ - *regnum = ei->data.reg & 0x7; + *regnum = (unsigned int)(ei->data.reg & 0x7); /* only allow BX, SI, DI, BP */ if (!reg16[*regnum]) diff --git a/modules/arch/x86/x86id.c b/modules/arch/x86/x86id.c index 46474b9b..93c48b45 100644 --- a/modules/arch/x86/x86id.c +++ b/modules/arch/x86/x86id.c @@ -2097,7 +2097,7 @@ static const x86_insn_info xbts_insn[] = { static void x86_finalize_common(x86_common *common, const x86_insn_info *info, - unsigned int mode_bits) + uintptr_t mode_bits) { common->addrsize = 0; common->opersize = info->opersize; @@ -2171,8 +2171,8 @@ x86_finalize_jmp(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, x86_jmp *jmp; int num_info = (int)(data[1]&0xFF); x86_insn_info *info = (x86_insn_info *)data[0]; - unsigned long mod_data = data[1] >> 8; - unsigned char mode_bits = (unsigned char)(data[3] & 0xFF); + unsigned long mod_data = (unsigned long)(data[1] >> 8); + unsigned int mode_bits = (unsigned int)(data[3] & 0xFF); /*unsigned char suffix = (unsigned char)((data[3]>>8) & 0xFF);*/ yasm_insn_operand *op; static const unsigned char size_lookup[] = {0, 8, 16, 32, 64, 80, 128, 0}; @@ -2278,7 +2278,7 @@ x86_finalize_jmp(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc, static const x86_insn_info * x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, - unsigned long cpu, unsigned int mode_bits, unsigned int suffix, + uintptr_t cpu, unsigned int mode_bits, unsigned int suffix, int num_operands, yasm_insn_operand **ops, yasm_insn_operand **rev_ops, const unsigned int *size_lookup, int bypass) @@ -2611,7 +2611,7 @@ x86_find_match(yasm_arch *arch, int num_info, const x86_insn_info *info, static void x86_match_error(yasm_arch *arch, int num_info, const x86_insn_info *info, - unsigned long cpu, unsigned int mode_bits, unsigned int suffix, + uintptr_t cpu, unsigned int mode_bits, unsigned int suffix, int num_operands, yasm_insn_operand **ops, yasm_insn_operand **rev_ops, const unsigned int *size_lookup) { @@ -2679,8 +2679,8 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, x86_insn *insn; int num_info = (int)(data[1]&0xFF); const x86_insn_info *info = (const x86_insn_info *)data[0]; - unsigned long mod_data = data[1] >> 8; - unsigned char mode_bits = (unsigned char)(data[3] & 0xFF); + unsigned long mod_data = (unsigned long)(data[1] >> 8); + unsigned int mode_bits = (unsigned int)(data[3] & 0xFF); unsigned int suffix = (unsigned int)((data[3]>>8) & 0xFF); yasm_insn_operand *op, *ops[4], *rev_ops[4]; /*@null@*/ yasm_expr *imm; @@ -2866,10 +2866,9 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, case OPA_EA: switch (op->type) { case YASM_INSN__OPERAND_REG: - insn->x86_ea = - yasm_x86__ea_create_reg(op->data.reg, - &insn->rex, - mode_bits); + insn->x86_ea = yasm_x86__ea_create_reg( + (unsigned long)op->data.reg, &insn->rex, + mode_bits); break; case YASM_INSN__OPERAND_SEGREG: yasm_internal_error( @@ -2937,9 +2936,9 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, break; case OPA_SpareEA: if (op->type == YASM_INSN__OPERAND_REG) { - insn->x86_ea = yasm_x86__ea_create_reg(op->data.reg, - &insn->rex, - mode_bits); + insn->x86_ea = + yasm_x86__ea_create_reg((unsigned long)op->data.reg, + &insn->rex, mode_bits); if (!insn->x86_ea || yasm_x86__set_rex_from_reg(&insn->rex, &spare, op->data.reg, mode_bits, X86_REX_R)) { diff --git a/modules/dbgfmts/codeview/cv-symline.c b/modules/dbgfmts/codeview/cv-symline.c index 07178c80..65dd02a4 100644 --- a/modules/dbgfmts/codeview/cv-symline.c +++ b/modules/dbgfmts/codeview/cv-symline.c @@ -384,7 +384,7 @@ cv_dbgfmt_add_file(yasm_dbgfmt_cv *dbgfmt_cv, size_t filenum, if (!f) yasm__fatal(N_("codeview: could not open source file")); while ((len = fread(buf, 1, 1024, f)) > 0) - yasm_md5_update(&context, buf, len); + yasm_md5_update(&context, buf, (unsigned long)len); yasm_md5_final(dbgfmt_cv->filenames[filenum].digest, &context); fclose(f); yasm_xfree(buf); @@ -972,11 +972,12 @@ cv_sym_size(const cv_sym *cvs) break; case 'S': len += 1; /* XXX: is this 1 or 2? */ - slen = strlen((const char *)cvs->args[arg++].p); + slen = (unsigned long)strlen((const char *)cvs->args[arg++].p); len += slen <= 0xff ? slen : 0xff; break; case 'Z': - len += strlen((const char *)cvs->args[arg++].p) + 1; + len += + (unsigned long)strlen((const char *)cvs->args[arg++].p) + 1; break; default: yasm_internal_error(N_("unknown sym format character")); diff --git a/modules/dbgfmts/codeview/cv-type.c b/modules/dbgfmts/codeview/cv-type.c index c5d049cb..70620a03 100644 --- a/modules/dbgfmts/codeview/cv-type.c +++ b/modules/dbgfmts/codeview/cv-type.c @@ -597,7 +597,7 @@ cv_leaf_size(const cv_leaf *leaf) break; case 'S': len += 1; /* XXX: is this 1 or 2? */ - slen = strlen((const char *)leaf->args[arg++].p); + slen = (unsigned long)strlen((const char *)leaf->args[arg++].p); len += slen <= 0xff ? slen : 0xff; break; default: diff --git a/modules/dbgfmts/dwarf2/dwarf2-aranges.c b/modules/dbgfmts/dwarf2/dwarf2-aranges.c index dd82e491..f78e1d47 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-aranges.c +++ b/modules/dbgfmts/dwarf2/dwarf2-aranges.c @@ -35,7 +35,7 @@ static void dwarf2_append_arange(yasm_section *debug_aranges, /*@only@*/ yasm_expr *start, - /*@only@*/ yasm_expr *length, size_t sizeof_address) + /*@only@*/ yasm_expr *length, unsigned int sizeof_address) { yasm_datavalhead dvs; yasm_bytecode *bc; diff --git a/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h b/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h index 4f6ad1bc..c60b8f0e 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h +++ b/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h @@ -32,7 +32,7 @@ typedef struct { char *pathname; /* full filename */ char *filename; /* basename of full filename */ - size_t dir; /* index into directories array for relative path; + unsigned long dir; /* index into directories array for relative path; * 0 for current directory. */ } dwarf2_filename; @@ -46,19 +46,19 @@ typedef struct yasm_dbgfmt_dwarf2 { yasm_arch *arch; char **dirs; - size_t dirs_size; - size_t dirs_allocated; + unsigned long dirs_size; + unsigned long dirs_allocated; dwarf2_filename *filenames; - size_t filenames_size; - size_t filenames_allocated; + unsigned long filenames_size; + unsigned long filenames_allocated; enum { DWARF2_FORMAT_32BIT, DWARF2_FORMAT_64BIT } format; - size_t sizeof_address, sizeof_offset, min_insn_len; + unsigned int sizeof_address, sizeof_offset, min_insn_len; } yasm_dbgfmt_dwarf2; /* .loc directive data */ diff --git a/modules/dbgfmts/dwarf2/dwarf2-info.c b/modules/dbgfmts/dwarf2/dwarf2-info.c index 0ae801c7..48923135 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-info.c +++ b/modules/dbgfmts/dwarf2/dwarf2-info.c @@ -235,8 +235,8 @@ dwarf2_add_abbrev_attr(dwarf2_abbrev *abbrev, dwarf_attribute name, } static void -dwarf2_append_expr(yasm_section *sect, /*@only@*/ yasm_expr *expr, size_t size, - int leb) +dwarf2_append_expr(yasm_section *sect, /*@only@*/ yasm_expr *expr, + unsigned int size, int leb) { yasm_datavalhead dvs; yasm_bytecode *bc; diff --git a/modules/dbgfmts/dwarf2/dwarf2-line.c b/modules/dbgfmts/dwarf2/dwarf2-line.c index a95ec574..c5718872 100644 --- a/modules/dbgfmts/dwarf2/dwarf2-line.c +++ b/modules/dbgfmts/dwarf2/dwarf2-line.c @@ -170,12 +170,12 @@ static const yasm_bytecode_callback dwarf2_line_op_bc_callback = { static size_t -dwarf2_dbgfmt_add_file(yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2, size_t filenum, +dwarf2_dbgfmt_add_file(yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2, unsigned long filenum, const char *pathname) { size_t dirlen; const char *filename; - size_t i, dir; + unsigned long i, dir; /* Put the directory into the directory table */ dir = 0; @@ -214,7 +214,7 @@ dwarf2_dbgfmt_add_file(yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2, size_t filenum, /* Realloc table if necessary */ if (filenum >= dbgfmt_dwarf2->filenames_allocated) { - size_t old_allocated = dbgfmt_dwarf2->filenames_allocated; + unsigned long old_allocated = dbgfmt_dwarf2->filenames_allocated; dbgfmt_dwarf2->filenames_allocated = filenum+32; dbgfmt_dwarf2->filenames = yasm_xrealloc(dbgfmt_dwarf2->filenames, sizeof(dwarf2_filename)*dbgfmt_dwarf2->filenames_allocated); @@ -448,7 +448,7 @@ typedef struct dwarf2_line_bc_info { yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2; dwarf2_line_state *state; dwarf2_loc loc; - size_t lastfile; + unsigned long lastfile; } dwarf2_line_bc_info; static int @@ -456,7 +456,7 @@ dwarf2_generate_line_bc(yasm_bytecode *bc, /*@null@*/ void *d) { dwarf2_line_bc_info *info = (dwarf2_line_bc_info *)d; yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2 = info->dbgfmt_dwarf2; - size_t i; + unsigned long i; const char *filename; /*@null@*/ yasm_bytecode *nextbc = yasm_bc__next(bc); @@ -657,7 +657,7 @@ yasm_dwarf2__generate_line(yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2, /* directory list */ for (i=0; idirs_size; i++) - sppbc->len += strlen(dbgfmt_dwarf2->dirs[i])+1; + sppbc->len += (unsigned long)strlen(dbgfmt_dwarf2->dirs[i])+1; sppbc->len++; /* filename list */ @@ -668,7 +668,8 @@ yasm_dwarf2__generate_line(yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2, yasm_errwarn_propagate(errwarns, 0); continue; } - sppbc->len += strlen(dbgfmt_dwarf2->filenames[i].filename) + 1 + + sppbc->len += + (unsigned long)strlen(dbgfmt_dwarf2->filenames[i].filename) + 1 + yasm_size_uleb128(dbgfmt_dwarf2->filenames[i].dir) + 2; } sppbc->len++; @@ -722,7 +723,7 @@ dwarf2_spp_bc_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d, size_t i, len; /* Prologue length (following this field) */ - cval = yasm_intnum_create_uint(bc->len - (buf-*bufp) - + cval = yasm_intnum_create_uint(bc->len - (unsigned long)(buf-*bufp) - dbgfmt_dwarf2->sizeof_offset); yasm_arch_intnum_tobytes(dbgfmt_dwarf2->arch, cval, buf, dbgfmt_dwarf2->sizeof_offset, @@ -966,7 +967,7 @@ yasm_dwarf2__line_directive(yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2, return 0; } else if (yasm__strcasecmp(name, "file") == 0) { /*@dependent@*/ /*@null@*/ const yasm_intnum *file_intn; - size_t filenum; + unsigned long filenum; if (!valparams) { yasm_error_set(YASM_ERROR_SYNTAX, N_("[%s] requires an argument"), @@ -988,7 +989,7 @@ yasm_dwarf2__line_directive(yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2, N_("file number is not a constant")); return 0; } - filenum = (size_t)yasm_intnum_get_uint(file_intn); + filenum = yasm_intnum_get_uint(file_intn); vp = yasm_vps_next(vp); if (!vp || !vp->val) { diff --git a/modules/dbgfmts/stabs/stabs-dbgfmt.c b/modules/dbgfmts/stabs/stabs-dbgfmt.c index 9e2fe271..0df12a6c 100644 --- a/modules/dbgfmts/stabs/stabs-dbgfmt.c +++ b/modules/dbgfmts/stabs/stabs-dbgfmt.c @@ -191,7 +191,7 @@ stabs_dbgfmt_append_bcstr(yasm_section *sect, const char *str) yasm_bytecode *bc; bc = yasm_bc_create_common(&stabs_bc_str_callback, yasm__xstrdup(str), 0); - bc->len = strlen(str)+1; + bc->len = (unsigned long)(strlen(str)+1); bc->offset = yasm_bc_next_offset(yasm_section_bcs_last(sect)); yasm_section_bcs_append(sect, bc); diff --git a/modules/listfmts/nasm/nasm-listfmt.c b/modules/listfmts/nasm/nasm-listfmt.c index c1272303..0e0f24b2 100644 --- a/modules/listfmts/nasm/nasm-listfmt.c +++ b/modules/listfmts/nasm/nasm-listfmt.c @@ -82,7 +82,7 @@ nasm_listfmt_destroy(/*@only@*/ yasm_listfmt *listfmt) static int nasm_listfmt_output_value(yasm_value *value, unsigned char *buf, - size_t destsize, unsigned long offset, + unsigned int destsize, unsigned long offset, yasm_bytecode *bc, int warn, /*@null@*/ void *d) { /*@null@*/ nasm_listfmt_output_info *info = (nasm_listfmt_output_info *)d; diff --git a/modules/objfmts/bin/bin-objfmt.c b/modules/objfmts/bin/bin-objfmt.c index b33c8bc2..e89efaf2 100644 --- a/modules/objfmts/bin/bin-objfmt.c +++ b/modules/objfmts/bin/bin-objfmt.c @@ -129,7 +129,8 @@ bin_objfmt_expr_xform(/*@returned@*/ /*@only@*/ yasm_expr *e, } static int -bin_objfmt_output_value(yasm_value *value, unsigned char *buf, size_t destsize, +bin_objfmt_output_value(yasm_value *value, unsigned char *buf, + unsigned int destsize, /*@unused@*/ unsigned long offset, yasm_bytecode *bc, int warn, /*@null@*/ void *d) { diff --git a/modules/objfmts/coff/coff-objfmt.c b/modules/objfmts/coff/coff-objfmt.c index 4d3684df..efc15c60 100644 --- a/modules/objfmts/coff/coff-objfmt.c +++ b/modules/objfmts/coff/coff-objfmt.c @@ -442,9 +442,9 @@ coff_objfmt_set_section_addr(yasm_section *sect, /*@null@*/ void *d) } static int -coff_objfmt_output_value(yasm_value *value, unsigned char *buf, size_t destsize, - unsigned long offset, yasm_bytecode *bc, int warn, - /*@null@*/ void *d) +coff_objfmt_output_value(yasm_value *value, unsigned char *buf, + unsigned int destsize, unsigned long offset, + yasm_bytecode *bc, int warn, /*@null@*/ void *d) { /*@null@*/ coff_objfmt_output_info *info = (coff_objfmt_output_info *)d; yasm_objfmt_coff *objfmt_coff; @@ -770,7 +770,7 @@ coff_objfmt_output_section(yasm_section *sect, /*@null@*/ void *d) size_t namelen = strlen(yasm_section_get_name(sect)); if (namelen > 8) { csd->strtab_name = info->strtab_offset; - info->strtab_offset += namelen + 1; + info->strtab_offset += (unsigned long)(namelen + 1); } } @@ -1070,7 +1070,7 @@ coff_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) if (len > 8) { YASM_WRITE_32_L(localbuf, 0); /* "zeros" field */ YASM_WRITE_32_L(localbuf, info->strtab_offset); /* strtab offset */ - info->strtab_offset += len+1; + info->strtab_offset += (unsigned long)(len+1); } else { /* <8 chars, so no string table entry needed */ strncpy((char *)localbuf, name, 8); @@ -1098,7 +1098,7 @@ coff_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) if (len > 14) { YASM_WRITE_32_L(localbuf, 0); YASM_WRITE_32_L(localbuf, info->strtab_offset); - info->strtab_offset += len+1; + info->strtab_offset += (unsigned long)(len+1); } else strncpy((char *)localbuf, csymd->aux[0].fname, 14); break; @@ -1977,7 +1977,7 @@ dir_setframe(yasm_objfmt_coff *objfmt_coff, yasm_valparamhead *valparams, } /* Set the frame fields in the unwind info */ - objfmt_coff->unwind->framereg = *reg; + objfmt_coff->unwind->framereg = (unsigned long)(*reg); yasm_value_initialize(&objfmt_coff->unwind->frameoff, off, 8); /* Generate a SET_FPREG unwind code */ diff --git a/modules/objfmts/dbg/dbg-objfmt.c b/modules/objfmts/dbg/dbg-objfmt.c index 33fbdb9e..c346e20c 100644 --- a/modules/objfmts/dbg/dbg-objfmt.c +++ b/modules/objfmts/dbg/dbg-objfmt.c @@ -66,7 +66,7 @@ dbg_objfmt_output(yasm_objfmt *objfmt, FILE *f, int all_syms, yasm_dbgfmt *df, { yasm_objfmt_dbg *objfmt_dbg = (yasm_objfmt_dbg *)objfmt; char buf[1024]; - unsigned int i; + size_t i; /* Copy temp file to real output file */ rewind(objfmt_dbg->dbgfile); diff --git a/modules/objfmts/elf/elf-objfmt.c b/modules/objfmts/elf/elf-objfmt.c index 9473f022..c0ae8416 100644 --- a/modules/objfmts/elf/elf-objfmt.c +++ b/modules/objfmts/elf/elf-objfmt.c @@ -271,8 +271,8 @@ elf_objfmt_output_align(FILE *f, unsigned int align) static int elf_objfmt_output_reloc(yasm_symrec *sym, yasm_bytecode *bc, - unsigned char *buf, size_t destsize, size_t valsize, - int warn, void *d) + unsigned char *buf, unsigned int destsize, + unsigned int valsize, int warn, void *d) { elf_reloc_entry *reloc; elf_objfmt_output_info *info = d; @@ -297,9 +297,9 @@ elf_objfmt_output_reloc(yasm_symrec *sym, yasm_bytecode *bc, } static int -elf_objfmt_output_value(yasm_value *value, unsigned char *buf, size_t destsize, - unsigned long offset, yasm_bytecode *bc, int warn, - /*@null@*/ void *d) +elf_objfmt_output_value(yasm_value *value, unsigned char *buf, + unsigned int destsize, unsigned long offset, + yasm_bytecode *bc, int warn, /*@null@*/ void *d) { /*@null@*/ elf_objfmt_output_info *info = (elf_objfmt_output_info *)d; /*@dependent@*/ /*@null@*/ yasm_intnum *intn; diff --git a/modules/objfmts/elf/elf.c b/modules/objfmts/elf/elf.c index 5961c6a1..12fc58a9 100644 --- a/modules/objfmts/elf/elf.c +++ b/modules/objfmts/elf/elf.c @@ -176,7 +176,7 @@ elf_strtab_entry_set_str(elf_strtab_entry *entry, const char *str) last = entry; entry = STAILQ_NEXT(last, qlink); while (entry) { - entry->index = last->index + strlen(last->str) + 1; + entry->index = last->index + (unsigned long)strlen(last->str) + 1; last = entry; entry = STAILQ_NEXT(last, qlink); } @@ -209,7 +209,7 @@ elf_strtab_append_str(elf_strtab_head *strtab, const char *str) last = STAILQ_LAST(strtab, elf_strtab_entry, qlink); entry = elf_strtab_entry_create(str); - entry->index = last->index + strlen(last->str) + 1; + entry->index = last->index + (unsigned long)strlen(last->str) + 1; STAILQ_INSERT_TAIL(strtab, entry, qlink); return entry; @@ -248,7 +248,7 @@ elf_strtab_output_to_file(FILE *f, elf_strtab_head *strtab) STAILQ_FOREACH(entry, strtab, qlink) { size_t len = 1 + strlen(entry->str); fwrite(entry->str, len, 1, f); - size += len; + size += (unsigned long)len; } return size; } @@ -660,7 +660,7 @@ elf_secthead_name_reloc_section(const char *basesect) } else { - int prepend_length = strlen(elf_march->reloc_section_prefix); + size_t prepend_length = strlen(elf_march->reloc_section_prefix); char *sectname = yasm_xmalloc(prepend_length + strlen(basesect) + 1); strcpy(sectname, elf_march->reloc_section_prefix); strcat(sectname, basesect); diff --git a/modules/objfmts/macho/macho-objfmt.c b/modules/objfmts/macho/macho-objfmt.c index 39884dc3..b0c79bc3 100644 --- a/modules/objfmts/macho/macho-objfmt.c +++ b/modules/objfmts/macho/macho-objfmt.c @@ -424,7 +424,7 @@ macho64_objfmt_create(yasm_object *object, yasm_arch *a) static int macho_objfmt_output_value(yasm_value *value, unsigned char *buf, - size_t destsize, unsigned long offset, + unsigned int destsize, unsigned long offset, yasm_bytecode *bc, int warn, /*@null@*/ void *d) { /*@null@*/ macho_objfmt_output_info *info = (macho_objfmt_output_info *)d; @@ -837,7 +837,9 @@ macho_objfmt_count_sym(yasm_symrec *sym, /*@null@*/ void *d) sym_data->add_uscore = 1; } #endif - sym_data->length = strlen(name) + sym_data->add_uscore + 1; /* name length + delimiter */ + /* name length + delimiter */ + sym_data->length = + (unsigned long)strlen(name) + sym_data->add_uscore + 1; info->strlength += sym_data->length; info->indx++; } diff --git a/modules/objfmts/rdf/rdf-objfmt.c b/modules/objfmts/rdf/rdf-objfmt.c index 4b09a8f9..7ff400bf 100644 --- a/modules/objfmts/rdf/rdf-objfmt.c +++ b/modules/objfmts/rdf/rdf-objfmt.c @@ -198,9 +198,9 @@ rdf_objfmt_create(yasm_object *object, yasm_arch *a) } static int -rdf_objfmt_output_value(yasm_value *value, unsigned char *buf, size_t destsize, - unsigned long offset, yasm_bytecode *bc, int warn, - /*@null@*/ void *d) +rdf_objfmt_output_value(yasm_value *value, unsigned char *buf, + unsigned int destsize, unsigned long offset, + yasm_bytecode *bc, int warn, /*@null@*/ void *d) { /*@null@*/ rdf_objfmt_output_info *info = (rdf_objfmt_output_info *)d; yasm_objfmt_rdf *objfmt_rdf; diff --git a/modules/objfmts/xdf/xdf-objfmt.c b/modules/objfmts/xdf/xdf-objfmt.c index 33aa77ac..5251d525 100644 --- a/modules/objfmts/xdf/xdf-objfmt.c +++ b/modules/objfmts/xdf/xdf-objfmt.c @@ -155,9 +155,9 @@ xdf_objfmt_create(yasm_object *object, yasm_arch *a) } static int -xdf_objfmt_output_value(yasm_value *value, unsigned char *buf, size_t destsize, - unsigned long offset, yasm_bytecode *bc, int warn, - /*@null@*/ void *d) +xdf_objfmt_output_value(yasm_value *value, unsigned char *buf, + unsigned int destsize, unsigned long offset, + yasm_bytecode *bc, int warn, /*@null@*/ void *d) { /*@null@*/ xdf_objfmt_output_info *info = (xdf_objfmt_output_info *)d; yasm_objfmt_xdf *objfmt_xdf; @@ -536,7 +536,7 @@ xdf_objfmt_output_sym(yasm_symrec *sym, /*@null@*/ void *d) YASM_WRITE_32_L(localbuf, scnum); /* section number */ YASM_WRITE_32_L(localbuf, value); /* value */ YASM_WRITE_32_L(localbuf, info->strtab_offset); - info->strtab_offset += len+1; + info->strtab_offset += (unsigned long)(len+1); YASM_WRITE_32_L(localbuf, flags); /* flags */ fwrite(info->buf, 16, 1, info->f); } diff --git a/modules/parsers/gas/gas-parse.c b/modules/parsers/gas/gas-parse.c index f52b9d52..2f0cbb07 100644 --- a/modules/parsers/gas/gas-parse.c +++ b/modules/parsers/gas/gas-parse.c @@ -858,7 +858,7 @@ parse_instr(yasm_parser_gas *parser_gas) } case SEGREG: { - unsigned long segreg = SEGREG_val[0]; + uintptr_t segreg = SEGREG_val[0]; get_next_token(); /* SEGREG */ bc = parse_instr(parser_gas); if (!bc) @@ -977,7 +977,7 @@ parse_memaddr(yasm_parser_gas *parser_gas) int strong = 0; if (curtok == SEGREG) { - unsigned long segreg = SEGREG_val[0]; + uintptr_t segreg = SEGREG_val[0]; get_next_token(); /* SEGREG */ if (!expect(':')) return NULL; get_next_token(); /* ':' */ @@ -1000,7 +1000,8 @@ parse_memaddr(yasm_parser_gas *parser_gas) e1 = NULL; if (curtok == '(') { - unsigned long reg = ULONG_MAX; + int havereg = 0; + uintptr_t reg; yasm_intnum *scale = NULL; get_next_token(); /* '(' */ @@ -1029,6 +1030,7 @@ parse_memaddr(yasm_parser_gas *parser_gas) /* index register */ if (curtok == REG) { reg = REG_val[0]; + havereg = 1; get_next_token(); /* REG */ if (curtok != ',') { scale = yasm_intnum_create_uint(1); @@ -1058,7 +1060,7 @@ done: get_next_token(); /* ')' */ if (scale) { - if (reg == ULONG_MAX) { + if (!havereg) { if (yasm_intnum_get_uint(scale) != 1) yasm_warn_set(YASM_WARN_GENERAL, N_("scale factor of %u without an index register"), @@ -1093,7 +1095,7 @@ parse_operand(yasm_parser_gas *parser_gas) { yasm_effaddr *ea; yasm_insn_operand *op; - unsigned long reg; + uintptr_t reg; switch (curtok) { case REG: diff --git a/modules/parsers/nasm/nasm-parse.c b/modules/parsers/nasm/nasm-parse.c index e03a0a78..0f6fba44 100644 --- a/modules/parsers/nasm/nasm-parse.c +++ b/modules/parsers/nasm/nasm-parse.c @@ -621,7 +621,7 @@ parse_instr(yasm_parser_nasm *parser_nasm) return bc; } case SEGREG: { - unsigned long segreg = SEGREG_val[0]; + uintptr_t segreg = SEGREG_val[0]; yasm_bytecode *bc; get_next_token(); bc = parse_instr(parser_nasm); @@ -686,7 +686,7 @@ parse_operand(yasm_parser_nasm *parser_nasm) } case TARGETMOD: { - unsigned long tmod = TARGETMOD_val[0]; + uintptr_t tmod = TARGETMOD_val[0]; get_next_token(); op = parse_operand(parser_nasm); if (op) @@ -711,7 +711,7 @@ parse_memaddr(yasm_parser_nasm *parser_nasm) switch (curtok) { case SEGREG: { - unsigned long segreg = SEGREG_val[0]; + uintptr_t segreg = SEGREG_val[0]; get_next_token(); if (!expect(':')) { yasm_error_set(YASM_ERROR_SYNTAX, diff --git a/modules/preprocs/nasm/nasm-pp.c b/modules/preprocs/nasm/nasm-pp.c index f2147195..2b65330b 100644 --- a/modules/preprocs/nasm/nasm-pp.c +++ b/modules/preprocs/nasm/nasm-pp.c @@ -422,7 +422,8 @@ static void make_tok_num(Token * tok, yasm_intnum *val); static void error(int severity, const char *fmt, ...); static void *new_Block(size_t size); static void delete_Blocks(void); -static Token *new_Token(Token * next, int type, const char *text, int txtlen); +static Token *new_Token(Token * next, int type, const char *text, + size_t txtlen); static Token *delete_Token(Token * t); /* @@ -709,7 +710,7 @@ read_line(void) continued_count = 0; while (1) { - q = fgets(p, bufsize - (p - buffer), istk->fp); + q = fgets(p, bufsize - (int)(p - buffer), istk->fp); if (!q) break; p += strlen(p); @@ -735,7 +736,7 @@ read_line(void) } if (p - buffer > bufsize - 10) { - long offset = p - buffer; + long offset = (long)(p - buffer); bufsize += BUF_DELTA; buffer = nasm_realloc(buffer, (size_t)bufsize); p = buffer + offset; /* prevent stale-pointer problems */ @@ -920,13 +921,13 @@ tokenise(char *line) /* Handle unterminated string */ if (type == -1) { - *tail = t = new_Token(NULL, TOK_STRING, line, p-line+1); + *tail = t = new_Token(NULL, TOK_STRING, line, (size_t)(p-line)+1); t->text[p-line] = *line; tail = &t->next; } else if (type != TOK_COMMENT) { - *tail = t = new_Token(NULL, type, line, p - line); + *tail = t = new_Token(NULL, type, line, (size_t)(p - line)); tail = &t->next; } line = p; @@ -988,7 +989,7 @@ delete_Blocks(void) * also the mac and next elements to NULL. */ static Token * -new_Token(Token * next, int type, const char *text, int txtlen) +new_Token(Token * next, int type, const char *text, size_t txtlen) { Token *t; int i; @@ -1013,8 +1014,8 @@ new_Token(Token * next, int type, const char *text, int txtlen) { if (txtlen == 0) txtlen = strlen(text); - t->text = nasm_malloc(1 + (size_t)txtlen); - strncpy(t->text, text, (size_t)txtlen); + t->text = nasm_malloc(1 + txtlen); + strncpy(t->text, text, txtlen); t->text[txtlen] = '\0'; } return t; @@ -1039,7 +1040,7 @@ static char * detoken(Token * tlist, int expand_locals) { Token *t; - int len; + size_t len; char *line, *p; len = 0; @@ -1081,7 +1082,7 @@ detoken(Token * tlist, int expand_locals) len += strlen(t->text); } } - p = line = nasm_malloc((size_t)len + 1); + p = line = nasm_malloc(len + 1); for (t = tlist; t; t = t->next) { if (t->type == TOK_WHITESPACE) @@ -1162,7 +1163,7 @@ ppscan(void *private_data, struct tokenval *tokval) { int rn_warn; char q, *r; - int l; + size_t l; r = tline->text; q = *r++; @@ -1238,7 +1239,7 @@ get_ctx(char *name, int all_contexts) { Context *ctx; SMacro *m; - int i; + size_t i; if (!name || name[0] != '%' || name[1] != '$') return NULL; @@ -2909,7 +2910,7 @@ do_directive(Token * tline) macro_start = nasm_malloc(sizeof(*macro_start)); macro_start->next = NULL; make_tok_num(macro_start, - yasm_intnum_create_uint(strlen(t->text) - 2)); + yasm_intnum_create_uint((unsigned long)(strlen(t->text) - 2))); macro_start->mac = NULL; /* diff --git a/modules/preprocs/nasm/nasmlib.c b/modules/preprocs/nasm/nasmlib.c index 5d9ae4d6..268aa287 100644 --- a/modules/preprocs/nasm/nasmlib.c +++ b/modules/preprocs/nasm/nasmlib.c @@ -112,7 +112,7 @@ yasm_intnum *nasm_readnum (char *str, int *error) return intn; } -yasm_intnum *nasm_readstrnum (char *str, int length, int *warn) +yasm_intnum *nasm_readstrnum (char *str, size_t length, int *warn) { char save; yasm_intnum *intn; @@ -193,7 +193,7 @@ void nasm_quote(char **str) char *nasm_strcat(const char *one, const char *two) { char *rslt; - int l1=strlen(one); + size_t l1=strlen(one); rslt = nasm_malloc(l1+strlen(two)+1); strcpy(rslt, one); strcpy(rslt+l1, two); diff --git a/modules/preprocs/nasm/nasmlib.h b/modules/preprocs/nasm/nasmlib.h index 37538f40..a14f64b4 100644 --- a/modules/preprocs/nasm/nasmlib.h +++ b/modules/preprocs/nasm/nasmlib.h @@ -40,7 +40,7 @@ yasm_intnum *nasm_readnum(char *str, int *error); * str points to and length covers the middle of the string, * without the quotes. */ -yasm_intnum *nasm_readstrnum(char *str, int length, int *warn); +yasm_intnum *nasm_readstrnum(char *str, size_t length, int *warn); char *nasm_src_set_fname(char *newname); char *nasm_src_get_fname(void); diff --git a/tools/gap/gap.c b/tools/gap/gap.c index eb96d166..b9069f20 100644 --- a/tools/gap/gap.c +++ b/tools/gap/gap.c @@ -642,7 +642,7 @@ perfect_dir(FILE *out, const char *which, const char *parser, dir_list *dirs) key *k = yasm_xmalloc(sizeof(key)); k->name_k = yasm__xstrdup(d->name); - k->len_k = strlen(d->name); + k->len_k = (ub4)strlen(d->name); k->next_k = keys; keys = k; nkeys++; diff --git a/tools/gap/perfect.c b/tools/gap/perfect.c index 77464c25..c56304f6 100644 --- a/tools/gap/perfect.c +++ b/tools/gap/perfect.c @@ -515,7 +515,7 @@ static int augment( /* add childb to the queue of reachable things */ if (childb) childb->water_b = highwater; tabq[tail].b_q = childb; - tabq[tail].newval_q = i; /* how to make parent (myb) use this hash */ + tabq[tail].newval_q = (ub2)i; /* how to make parent (myb) use this hash */ tabq[tail].oldval_q = myb->val_b; /* need this for rollback */ tabq[tail].parent_q = q; ++tail; -- 2.40.0