Package: xevil Severity: normal Tags: patch When building 'xevil' on amd64 with gcc-4.0, I get the following error:
g++ -O2 -DX11=1 -DUSE_RANDOM -DXEVIL_KEYSET=UIlinux -DUSE_UINT_NET_LENGTH -I../cmn -I../x11 -I../x11/bitmaps -I/usr/X11R6/include -o ../x11/release/utils.o -c utils.cpp utils.cpp: In member function 'void PtrList::write(OutStream*) const': utils.cpp:600: error: cast from 'void*' to 'int' loses precision utils.cpp: In static member function 'static int HashTable::defaultHash(void*, int)': utils.cpp:939: error: cast from 'void*' to 'unsigned int' loses precision make[6]: *** [../x11/release/utils.o] Error 1 make[6]: Leaving directory `/xevil-2.02r2/cmn' With the attached patch 'xevil' can be compiled on amd64 using gcc-4.0. Regards Andreas Jochens diff -urN ../tmp-orig/xevil-2.02r2/cmn/actual.cpp ./cmn/actual.cpp --- ../tmp-orig/xevil-2.02r2/cmn/actual.cpp 2005-03-03 11:15:33.707232087 +0100 +++ ./cmn/actual.cpp 2005-03-03 11:09:28.000000000 +0100 @@ -1534,7 +1534,7 @@ void *closure) { // notThis is used to prevent transmogifying into the same class an object // already is. - ClassId notThis = (ClassId)closure; + ClassId notThis = (long)closure; if (pc->classId == notThis) { return False; } diff -urN ../tmp-orig/xevil-2.02r2/cmn/game_style.cpp ./cmn/game_style.cpp --- ../tmp-orig/xevil-2.02r2/cmn/game_style.cpp 2005-03-03 11:15:33.711231315 +0100 +++ ./cmn/game_style.cpp 2005-03-03 11:13:00.000000000 +0100 @@ -2667,7 +2667,7 @@ HumanP human = locator->get_human(n); if (human) { // previous depth - int depthOld = (int)human->get_data(); + long depthOld = (long)human->get_data(); Id id = human->get_id(); // Get physical for intelligence diff -urN ../tmp-orig/xevil-2.02r2/cmn/physical.cpp ./cmn/physical.cpp --- ../tmp-orig/xevil-2.02r2/cmn/physical.cpp 2005-03-03 11:15:33.716230350 +0100 +++ ./cmn/physical.cpp 2005-03-03 11:11:57.000000000 +0100 @@ -1845,7 +1845,7 @@ } // Use the pixmap resource id as the base. - u_int cmnBitsId = (unsigned int)mc->pixmapBits[baseDir][animNum]; + u_int cmnBitsId = (unsigned long)mc->pixmapBits[baseDir][animNum]; // It is ok to call OneTransform::compute_key() even if there is no // transformation, will just return 0x0. diff -urN ../tmp-orig/xevil-2.02r2/cmn/utils.cpp ./cmn/utils.cpp --- ../tmp-orig/xevil-2.02r2/cmn/utils.cpp 2005-03-03 11:15:33.719229771 +0100 +++ ./cmn/utils.cpp 2005-03-03 11:08:51.000000000 +0100 @@ -597,7 +597,7 @@ // Not tested. out->write_int(len); for (int n = 0; n < len; n++) { - out->write_int((int)data[n]); + out->write_int((long)data[n]); } } @@ -936,7 +936,7 @@ // Pretty crappy hash function, I know. // Careful if bucketsNum is a power of 2. int HashTable::defaultHash(void* key,int bucketsNum) { - return ((unsigned int)key) % bucketsNum; + return ((unsigned long)key) % bucketsNum; } diff -urN ../tmp-orig/xevil-2.02r2/cmn/xetp.cpp ./cmn/xetp.cpp --- ../tmp-orig/xevil-2.02r2/cmn/xetp.cpp 2005-03-03 11:15:33.720229578 +0100 +++ ./cmn/xetp.cpp 2005-03-03 11:10:01.763303390 +0100 @@ -161,7 +161,7 @@ for (n = 0; n < physicals.length(); n++) { PhysicalP p = (PhysicalP)physicals.get(n); // computing object_length twice, but who cares. - _send_object(out,p,turn,(TickType)tickTypes.get(n), + _send_object(out,p,turn,(long)tickTypes.get(n), compute_object_length(p)); } diff -urN ../tmp-orig/xevil-2.02r2/x11/ui.cpp ./x11/ui.cpp --- ../tmp-orig/xevil-2.02r2/x11/ui.cpp 2005-03-03 11:15:33.703232859 +0100 +++ ./x11/ui.cpp 2005-03-03 11:15:10.014805162 +0100 @@ -932,7 +932,7 @@ UiP ui = (UiP)closure; ui->settingsChanges |= UIenemiesRefill; // SGI compiler says you can't cast void* to Boolean. - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; ui->settings.enemiesRefill = val; } @@ -941,7 +941,7 @@ void Ui::menu_controls_CB(void* value,Viewport* vPort,void* closure) { UiP ui = (UiP)closure; int dpyNum = vPort->get_dpy_num(); - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; if (val) { XMapWindow(ui->xvars.dpy[dpyNum],ui->xdata.controls[dpyNum]); } @@ -957,7 +957,7 @@ Viewport* vPort,void* closure) { UiP ui = (UiP)closure; int dpyNum = vPort->get_dpy_num(); - Boolean active = (Boolean)(int)value; + Boolean active = (Boolean)(long)value; if (active) { ui->lControls[dpyNum].input = ui->lControls[dpyNum].key = @@ -995,7 +995,7 @@ void Ui::menu_scenarios_CB(void* value,Viewport*,void* closure) { UiP ui = (UiP)closure; - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; if (val) { ui->settingsChanges |= UIstyle; ui->settings.style = SCENARIOS; @@ -1006,7 +1006,7 @@ void Ui::menu_levels_CB(void* value,Viewport*,void* closure) { UiP ui = (UiP)closure; - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; if (val) { ui->settingsChanges |= UIstyle; ui->settings.style = LEVELS; @@ -1017,7 +1017,7 @@ void Ui::menu_kill_CB(void* value,Viewport*,void* closure) { UiP ui = (UiP)closure; - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; if (val) { ui->settingsChanges |= UIstyle; ui->settings.style = KILL; @@ -1028,7 +1028,7 @@ void Ui::menu_duel_CB(void* value,Viewport*,void* closure) { UiP ui = (UiP)closure; - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; if (val) { ui->settingsChanges |= UIstyle; ui->settings.style = DUEL; @@ -1039,7 +1039,7 @@ void Ui::menu_extended_CB(void* value,Viewport*,void* closure) { UiP ui = (UiP)closure; - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; if (val) { ui->settingsChanges |= UIstyle; ui->settings.style = EXTENDED; @@ -1050,7 +1050,7 @@ void Ui::menu_training_CB(void* value,Viewport*,void* closure) { UiP ui = (UiP)closure; - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; if (val) { ui->settingsChanges |= UIstyle; ui->settings.style = TRAINING; @@ -1071,7 +1071,7 @@ void Ui::menu_cooperative_CB(void* value,Viewport*,void* closure) { UiP ui = (UiP)closure; ui->settingsChanges |= UIcooperative; - Boolean val = (Boolean)(int)value; + Boolean val = (Boolean)(long)value; ui->settings.cooperative = val; } @@ -1080,7 +1080,7 @@ void Ui::menu_help_CB(void* value,Viewport* vPort,void* closure) { UiP ui = (UiP)closure; int dpyNum = vPort->get_dpy_num(); - Boolean active = (Boolean)(int)value; + Boolean active = (Boolean)(long)value; if (active) { XMapWindow(ui->xvars.dpy[dpyNum],ui->xdata.help[dpyNum]); @@ -1095,7 +1095,7 @@ void Ui::status_weapon_CB(void* value,Viewport* vPort,void*) { // Some mouse controls. // UiP ui = (UiP)closure; - int button = (int)value; + long button = (long)value; switch (button) { case Button1: @@ -1114,7 +1114,7 @@ void Ui::status_item_CB(void* value,Viewport* vPort,void*) { // UiP ui = (UiP)closure; - int button = (int)value; + long button = (long)value; switch (button) { case Button1: diff -urN ../tmp-orig/xevil-2.02r2/x11/viewport.cpp ./x11/viewport.cpp --- ../tmp-orig/xevil-2.02r2/x11/viewport.cpp 2005-03-03 11:15:33.704232666 +0100 +++ ./x11/viewport.cpp 2005-03-03 11:14:00.000000000 +0100 @@ -1624,7 +1624,7 @@ // Would be much better to put the radio-button logic in the Panel classes. if (pClosure->radio) { // SGI compiler says you can't cast void* to Boolean. - Boolean bValue = (Boolean)(int)value; + Boolean bValue = (Boolean)(long)value; if (!bValue) { ((TogglePanel*)panel)->set_value(True); } -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]