SWRiP200 Compiling Error - cast from 'char*' to 'int' loses precision

Posted by Chaoscayne on Sat 29 Nov 2008 07:08 PM — 8 posts, 34,367 views.

#0
When I go to compile the code (swrip200) i got from swrip.net i get this odd error and i can't seem to figure out how to fix it.

OS : GNU bash, version 3.2.33(1)-release (x86_64-pc-linux-gnu)

Errors I'm Receiving:

handler.c: In function 'OBJ_DATA* group_object(OBJ_DATA*, OBJ_DATA*)':
handler.c:3553: error: cast from 'char*' to 'int' loses precision
handler.c:3553: error: cast from 'char*' to 'int' loses precision
handler.c:3554: error: cast from 'char*' to 'int' loses precision
handler.c:3554: error: cast from 'char*' to 'int' loses precision
handler.c:3555: error: cast from 'char*' to 'int' loses precision
handler.c:3555: error: cast from 'char*' to 'int' loses precision
handler.c:3556: error: cast from 'char*' to 'int' loses precision
handler.c:3556: error: cast from 'char*' to 'int' loses precision

Offending Lines of Code:

line:3553: && QUICKMATCH( obj1->name, obj2->name )
line:3554: && QUICKMATCH( obj1->short_descr, obj2->short_descr )
line:3555: && QUICKMATCH( obj1->description, obj2->description )
line:3556: && QUICKMATCH( obj1->action_desc, obj2->action_desc )


I'm just a bit confused and can't figure out what to do. did a make -k and got to see all the other files that have similar erros.....i see this in several of the files "cast from 'char*' to 'int' loses precision"
Amended on Sat 29 Nov 2008 07:58 PM by Chaoscayne
USA #1
Look into this:
http://www.smaugmuds.org/index.php?a=topic&t=1782

I would also recommend using FUSS versions.
Amended on Sat 29 Nov 2008 08:13 PM by Zeno
#2
Well that definatly fixed that error but i'm still getting the
cast from '<insertname>*' to 'int' loses precision
line during compile on several files.
USA #3
The same lines?
#4
fixed the other QUICKMATCH errors i was getting

Current lines and files i get errors on:

hashstr.c: In function 'void hash_dump(int)':
hashstr.c:180: error: cast from 'hashstr_data*' to 'int' loses precision
hashstr.c: In function 'void show_high_hash(int)':
hashstr.c:248: error: cast from 'hashstr_data*' to 'int' loses precision

165:void hash_dump( int hash )
166:{
167: struct hashstr_data *ptr;
168: char *str;
169: int c, psize;

171: if ( hash > STR_HASH_SIZE || hash < 0 )
172: {
173: fprintf( stderr, "hash_dump: invalid hash size\n\r" );
174: return;
175: }
176: psize = sizeof(struct hashstr_data);
178: for ( c=0, ptr = string_hash[hash]; ptr; ptr = ptr->next, c++ )
179: {
180: str = (char *) (((int) ptr) + psize);
181: fprintf( stderr, "Len:%4d Lnks:%5d Str: %s\n\r",
182: ptr->length, ptr->links, str );
183: }
184: fprintf( stderr, "Total strings in hash %d: %d\n\r", hash, c );
185:}

reset.c: In function 'void do_reset(CHAR_DATA*, char*)':
reset.c:996: error: cast from 'char*' to 'int' loses precision
reset.c: In function 'void do_rreset(CHAR_DATA*, char*)':
reset.c:1052: error: cast from 'char*' to 'int' loses precision
reset.c: In function 'void reset_area(AREA_DATA*)':
reset.c:1290: error: cast from 'char*' to 'int' loses precision

line 996 offending chunk of code:
{
AREA_DATA *tmp;

985: for ( tmp = first_build; tmp; tmp = tmp->next )
986: if ( tmp == pArea )
987: break;
988: if ( !tmp )
989: for ( tmp = first_area; tmp; tmp = tmp->next )
990: if ( tmp == pArea )
991: break;
992: if ( !tmp )
993: {
994: send_to_char("Your area pointer got lost. Reset mode off.\n\r", ch);
995: bug("do_reset: %s's dest_buf points to invalid area",
996: (int)ch->name);
997: ch->substate = SUB_NONE;
998: DISPOSE(ch->dest_buf);
999: return;
1000: }
Amended on Sat 29 Nov 2008 09:37 PM by Chaoscayne
USA #5
Which is line 996 in that chunk?
#6
added line numbers to previous message
#7
got it now.....simple stuff once my brain kicked in
thanks for the help file