28 Feb, 2008, Zastko wrote in the 1st comment:
Votes: 0
So I'm trying to run an SWR 2.0 (Yes I know there buggy as hell, but I've coded out most of the bugs.)

Now I'm stuck on something else, I keep get this error when compiling:

make -s swr
Compiling o/act_info.o….
Compiling o/act_move.o….
Compiling o/act_obj.o….
Compiling o/act_wiz.o….
Compiling o/boards.o….
Compiling o/build.o….
Compiling o/clans.o….
Compiling o/comm.o….
cc1plus: warnings being treated as errors
comm.c:60: warning: overflow in implicit constant conversion
comm.c:60: warning: overflow in implicit constant conversion
comm.c:61: warning: overflow in implicit constant conversion
comm.c:61: warning: overflow in implicit constant conversion
comm.c:62: warning: overflow in implicit constant conversion
comm.c:62: warning: overflow in implicit constant conversion
make[1]: *** [o/comm.o] Error 1
make: *** [all] Error 2



Line 60, 61, and 62 of comm.c =

const char echo_off_str [] = { IAC, WILL, TELOPT_ECHO, '\0' };
const char echo_on_str [] = { IAC, WONT, TELOPT_ECHO, '\0' };
const char go_ahead_str [] = { IAC, GA, '\0' };
28 Feb, 2008, Guest wrote in the 2nd comment:
Votes: 0
I'm not entirely sure why this was, but the following changes resolved the error for FUSS:

const char echo_off_str[] = { ( char )IAC, ( char )WILL, TELOPT_ECHO, '\0' };
const char echo_on_str[] = { ( char )IAC, ( char )WONT, TELOPT_ECHO, '\0' };
const char go_ahead_str[] = { ( char )IAC, ( char )GA, '\0' };


For some reason the values with (char) in front had to be cast that way to get the compiler to ignore the warning.
28 Feb, 2008, David Haley wrote in the 3rd comment:
Votes: 0
Well, it makes sense, right… storing an unsigned char that is greater than the signed char range into a signed char will result in an overflow, no?
28 Feb, 2008, Guest wrote in the 4th comment:
Votes: 0
Well, since you put it that way, yeah. It makes perfect sense :P ( how long is it acceptable to have a brain fart? )

So if the array were changed to be a const unsigned char that would also solve the problem, yes? And be properly handled? :)
28 Feb, 2008, Zastko wrote in the 5th comment:
Votes: 0
Ok that fixed the comm.c problem next there was the fight.c error:

make -s swr
Compiling o/comm.o….
Compiling o/const.o….
Compiling o/db.o….
Compiling o/fight.o….
fight.c: In function âvoid violence_update()â:
fight.c:234: error: cast from âCHAR_DATA*â to âintâ loses precision
fight.c:234: error: cast from âROOM_INDEX_DATA*â to âintâ loses precision
fight.c:234: error: cast from âCHAR_DATA*â to âintâ loses precision
fight.c:234: error: cast from âCHAR_DATA*â to âintâ loses precision
fight.c:239: error: cast from âCHAR_DATA*â to âintâ loses precision
fight.c:239: error: cast from âCHAR_DATA*â to âintâ loses precision
fight.c:239: error: cast from âCHAR_DATA*â to âintâ loses precision
make[1]: *** [o/fight.o] Error 1
make: *** [all] Error 2

lines 234, and 239 (in bold):

(int) ch, (int) ch->in_room, (int) ch->prev, (int) ch->next );
log_string( buf );
log_string( lastplayercmd );
if ( lst_ch )
sprintf( buf, "lst_ch: %d lst_ch->prev: %d lst_ch->next: %d",
(int) lst_ch, (int) lst_ch->prev, (int) lst_ch->next );
28 Feb, 2008, Guest wrote in the 6th comment:
Votes: 0
The (int) in those lines should be changed to (size_t). The reason being that on your particular system ( likely 64 bit ) the size of a pointer fits into a long but that code is trying to cast it into an int. size_t tells the compiler to use whatever the type is configured for on that machine.

The %d tags also need to become %zd tags so the sprintf knows to use the size_t when dealing with them.
28 Feb, 2008, Zastko wrote in the 7th comment:
Votes: 0
Won't support that printf length modifier

cc1plus: warnings being treated as errors
fight.c: In function âvoid violence_update()â:
fight.c:234: warning: ISO C++ does not support the âzâ printf length modifier
fight.c:234: warning: ISO C++ does not support the âzâ printf length modifier
fight.c:234: warning: ISO C++ does not support the âzâ printf length modifier
fight.c:234: warning: ISO C++ does not support the âzâ printf length modifier
fight.c:239: warning: ISO C++ does not support the âzâ printf length modifier
fight.c:239: warning: ISO C++ does not support the âzâ printf length modifier
fight.c:239: warning: ISO C++ does not support the âzâ printf length modifier
make[1]: *** [o/fight.o] Error 1
make: *** [all] Error 2

log_string( "violence_update: bad ch record! (Shortcutting.)" );
sprintf( buf, "ch: %zd ch->in_room: %zd ch->prev: %zd ch->next: %zd",
(size_t) ch, (size_t) ch->in_room, (size_t) ch->prev, (size_t) ch->next );
log_string( buf );
log_string( lastplayercmd );
if ( lst_ch )
sprintf( buf, "lst_ch: %zd lst_ch->prev: %zd lst_ch->next: %zd",
(size_t) lst_ch, (size_t) lst_ch->prev, (size_t) lst_ch->next );
else
strcpy( buf, "lst_ch: NULL" );
log_string( buf );
gch_prev = NULL;
continue;
28 Feb, 2008, Guest wrote in the 8th comment:
Votes: 0
Well that's weird. What version of gcc are you using? I've never had it tell me %zd isn't supported. I'm not sure how else they'd expect to be able to printf with a size_t.

You can get around it for now though by switching to long instead of size_t and using %ld instead of %zd
28 Feb, 2008, Zastko wrote in the 9th comment:
Votes: 0
Samson said:
Well that's weird. What version of gcc are you using? I've never had it tell me %zd isn't supported. I'm not sure how else they'd expect to be able to printf with a size_t.

You can get around it for now though by switching to long instead of size_t and using %ld instead of %zd


Funny thing I just realized, I'm looking in my Virtual Server details and your the one that created my server for me haha (I'm using arthmoor)

But anyway, it fixed Fight.c and now what do ya know a new error! :mad:


make -s swr
Compiling o/fight.o….
Compiling o/handler.o….
handler.c: In function âOBJ_DATA* group_object(OBJ_DATA*, OBJ_DATA*)â:
handler.c:2839: error: cast from âchar*â to âintâ loses precision
handler.c:2839: error: cast from âchar*â to âintâ loses precision
handler.c:2840: error: cast from âchar*â to âintâ loses precision
handler.c:2840: error: cast from âchar*â to âintâ loses precision
handler.c:2841: error: cast from âchar*â to âintâ loses precision
handler.c:2841: error: cast from âchar*â to âintâ loses precision
handler.c:2842: error: cast from âchar*â to âintâ loses precision
handler.c:2842: error: cast from âchar*â to âintâ loses precision
make[1]: *** [o/handler.o] Error 1
make: *** [all] Error 2

lines 2839 - 2842:
&& QUICKMATCH( obj1->name, obj2->name )
&& QUICKMATCH( obj1->short_descr, obj2->short_descr )
&& QUICKMATCH( obj1->description, obj2->description )
&& QUICKMATCH( obj1->action_desc, obj2->action_desc )
28 Feb, 2008, kiasyn wrote in the 10th comment:
Votes: 0
Samson said:
Well that's weird. What version of gcc are you using? I've never had it tell me %zd isn't supported. I'm not sure how else they'd expect to be able to printf with a size_t.

You can get around it for now though by switching to long instead of size_t and using %ld instead of %zd


why not %p for pointer
28 Feb, 2008, David Haley wrote in the 11th comment:
Votes: 0
Because they're size_t, not pointer, and you might not want it printed in hex. :tongue:

Zastko, those are caused by problems in the hashing macros… you might be able to get away with just not casting pointers to ints, although I'm not sure about that; you'd have to look at what exactly QUICKMATCH is doing.
0.0/11