|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
06-18-2009, 01:45 AM
|
Developer
|
|
Join Date: Apr 2009
Location: USA
Posts: 478
|
|
Quote:
Originally Posted by KLS
There is no va_copy() on windows.
|
This should work for windows:
va_list apcopy = ap;
From what I was reading, va_copy is just the following define in most cases:
#define va_copy(d,s) ((d) = (s))
|
06-18-2009, 02:41 AM
|
Developer
|
|
Join Date: Apr 2009
Location: USA
Posts: 478
|
|
In fact, it probably would be more efficient to simply create copies of va_lists everywhere instead of reusing va_start and va_end like I did in my patch. I could submit another patch doing that and accounting for va_copy missing under windows if you would like.
|
06-18-2009, 03:44 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
I can get it to compile without bots, but when I activate -DEQBOTS, I get a lot of this;
Code:
/usr/bin/ld: Dwarf Error: Offset (217430) greater than or equal to .debug_str size (1812).
And it eventually crashes.
Hoping you might can help me.
thanks
|
06-18-2009, 10:51 PM
|
Developer
|
|
Join Date: Apr 2009
Location: USA
Posts: 478
|
|
Quote:
Originally Posted by Angelox
I can get it to compile without bots, but when I activate -DEQBOTS, I get a lot of this;
Code:
/usr/bin/ld: Dwarf Error: Offset (217430) greater than or equal to .debug_str size (1812).
And it eventually crashes.
Hoping you might can help me.
thanks
|
I'll need more info. What emu rev are you using. I'll assume this is for 64bit linux or you probably wouldn't have posted to this thread. If that is incorrect, please let me know. What patches have you applied, if any, to the emu code? What gcc version are you using? What is crashing, the compile? One of the programs?
Sorry for all the questions, but the more information you get me, the more likely I'll be able to find the problem. Thanks.
|
|
|
|
06-19-2009, 06:55 AM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
GCC ver is 4.3.2, and is 64 bit - what you have posted here;
https://www.tsahosting.net/svn/eqemu64/trunk/
I just downloaded it and compiled - it appeared to have all the patches posted in this thread.
here's the piece where it crashes;
Code:
[root@marysol zone]# make
gcc -o zone .obj/EQPacket.o .obj/EQStream.o .obj/EQStreamFactory.o .obj/CRC16.o ../common/timer.o ../common/packet_dump.o ../common/packet_functions.o ../common/unix.o ../common/packet_dump_file.o ../common/Mutex.o ../common/MiscFunctions.o zone.o entity.o mob.o client.o client_process.o npc.o net.o spawn2.o attack.o hate_list.o ../common/serverinfo.o ../common/moremath.o worldserver.o spells.o spawngroup.o loottables.o faction.o Map.o watermap.o PlayerCorpse.o petitions.o MobAI.o Object.o ../common/eqtime.o groups.o ../common/classes.o ../common/races.o ../common/TCPConnection.o forage.o ../common/crc32.o ../common/guilds.o ../common/md5.o ../common/dbcore.o ../common/dbasync.o zonedbasync.o parser.o embperl.o embparser.o ../common/EMuShareMem.o ../common/EQEMuError.o ../common/ptimer.o .obj/debug.o .obj/database.o .obj/Item.o .obj/misc.o tribute.o doors.o command.o beacon.o embxs.o AA.o trap.o client_packet.o bonuses.o trading.o spdat.o spell_effects.o aggro.o guild.o inventory.o client_mods.o tradeskills.o waypoints.o pets.o zone_profile.o effects.o perl_client.o perl_entity.o perl_mob.o perl_questitem.o perl_npc.o perl_PlayerCorpse.o perl_groups.o perl_raids.o questmgr.o client_logs.o perlparser.o ../common/rdtsc.o ../common/extprofile.o horse.o exp.o pathing.o fearpath.o special_attacks.o ../common/timeoutmgr.o ../common/Condition.o .obj/opcodemgr.o .obj/emu_opcodes.o ../common/SharedLibrary.o zoning.o titles.o perlpacket.o perl_perlpacket.o zonedb.o ../common/shareddb.o ../common/logsys.o .obj/rulesys.o ../common/logsys_eqemu.o ../common/EQEmuConfig.o ZoneConfig.o ../common/XMLParser.o ../common/tinyxml/tinystr.o ../common/tinyxml/tinyxml.o ../common/tinyxml/tinyxmlerror.o ../common/tinyxml/tinyxmlparser.o ../common/EQStreamProxy.o ../common/patches/patches.o ../common/patches/Client62.o ../common/patches/Titanium.o ../common/patches/Anniversary.o ../common/patches/SoF.o ../common/StructStrategy.o ../common/EQStreamIdent.o ../common/patches/Live.o zone_logsys.o ../common/BasePacket.o ../common/worldconn.o ../common/EmuTCPConnection.o ../common/EmuTCPServer.o ../common/TCPServer.o ../common/guild_base.o guild_mgr.o tasks.o raids.o -fpermissive -Wall -O -Wuninitialized -Wwrite-strings -Wcast-qual -Wno-deprecated -Wcomment -Wcast-align -O -g -pthread -pipe -D_GNU_SOURCE -DINVERSEXY -DFX -DZONE -DEQDEBUG=5 -DCATCH_CRASH -DNO_PIDLOG -DSHAREMEM -DFIELD_ITEMS -DCOMBINED -DAPP_OPCODE_SIZE=2 -Di386 -DEQBOTS -DEMBPERL -DEMBPERL_PLUGIN -DHAS_UNION_SEMUN -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fstack-protector-all -fPIC -fstack-protector -fstack-protector-all -DUNIV_LINUX -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -I/usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE -rdynamic -L. -lstdc++ -ldl -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64/ -lssl -lcrypto -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE -L/usr/local/lib64 -L/usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
client.o: In function `memset':
/usr/include/bits/string3.h:82: warning: memset used with constant zero length parameter; this could be due to transposed parameters
/usr/bin/ld: Dwarf Error: Offset (225072) greater than or equal to .debug_str size (22084).
entity.o: In function `EntityList::GetBotRaidByMob(Mob*)':
/root/eqemu/source/zone/entity.cpp:1612: undefined reference to `BotRaids::IsBotRaidMember(Mob*)'
/usr/bin/ld: Dwarf Error: Offset (220496) greater than or equal to .debug_str size (18580).
npc.o: In function `NPC::Process()':
/root/eqemu/source/zone/npc.cpp:734: undefined reference to `Mob::BOT_Process()'
/root/eqemu/source/zone/npc.cpp:736: undefined reference to `Mob::PET_Process()'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x318): undefined reference to `NPC::Bot_AI_IdleCastCheck()'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x320): undefined reference to `NPC::Bot_AI_EngagedCastCheck()'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x328): undefined reference to `NPC::Bot_AI_PursueCastCheck()'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x330): undefined reference to `NPC::Bot_Command_MezzTarget(Mob*)'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x338): undefined reference to `NPC::Bot_Command_RezzTarget(Mob*)'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x340): undefined reference to `NPC::Bot_Command_Cure(int, int)'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x348): undefined reference to `NPC::BotRaidSpell(unsigned short)'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x350): undefined reference to `NPC::Bot_Command_CalmTarget(Mob*)'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x358): undefined reference to `NPC::Bot_Command_CharmTarget(int, Mob*)'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x360): undefined reference to `NPC::Bot_Command_DireTarget(int, Mob*)'
npc.o:(.data.rel.ro._ZTV3NPC[vtable for NPC]+0x368): undefined reference to `NPC::Bot_Command_Resist(int, int)'
/usr/bin/ld: Dwarf Error: Offset (217430) greater than or equal to .debug_str size (1812).
attack.o: In function `Mob::CheckHitChance(Mob*, SkillType, int)':
/root/eqemu/source/zone/attack.cpp:458: undefined reference to `BotRaids::GetBotMainTank()'
/root/eqemu/source/zone/attack.cpp:458: undefined reference to `BotRaids::GetBotMainTank()'
/root/eqemu/source/zone/attack.cpp:458: undefined reference to `BotRaids::GetBotSecondTank()'
/root/eqemu/source/zone/attack.cpp:458: undefined reference to `BotRaids::GetBotSecondTank()'
attack.o: In function `NPC::Attack(Mob*, int, bool)':
/root/eqemu/source/zone/attack.cpp:2398: undefined reference to `BotRaids::AddBotRaidAggro(Mob*)'
/root/eqemu/source/zone/attack.cpp:2422: undefined reference to `BotRaids::AddBotRaidAggro(Mob*)'
attack.o: In function `Client::Death(Mob*, int, unsigned short, SkillType)':
/root/eqemu/source/zone/attack.cpp:1945: undefined reference to `BotRaids::RemoveRaidBots()'
attack.o: In function `NPC::Death(Mob*, int, unsigned short, SkillType)':
/root/eqemu/source/zone/attack.cpp:2740: undefined reference to `BotRaids::SplitExp(unsigned int, Mob*)'
/root/eqemu/source/zone/attack.cpp:2742: undefined reference to `BotRaids::GetBotMainTarget()'
/root/eqemu/source/zone/attack.cpp:2743: undefined reference to `BotRaids::SetBotMainTarget(Mob*)'
/root/eqemu/source/zone/attack.cpp:2973: undefined reference to `BotRaids::RemoveEmptyBotGroup()'
/root/eqemu/source/zone/attack.cpp:2977: undefined reference to `BotRaids::RaidBotGroupsCount()'
/root/eqemu/source/zone/attack.cpp:2978: undefined reference to `BotRaids::GetRaidBotLeader()'
/root/eqemu/source/zone/attack.cpp:2978: undefined reference to `BotRaids::RemoveClientGroup(Mob*)'
/root/eqemu/source/zone/attack.cpp:2980: undefined reference to `BotRaids::RaidBotGroupsCount()'
/root/eqemu/source/zone/attack.cpp:2981: undefined reference to `BotRaids::DisbandBotRaid()'
/usr/bin/ld: Dwarf Error: Offset (207917) greater than or equal to .debug_str size (1002).
groups.o: In function `Group::DelMember(Mob*, bool)':
/root/eqemu/source/zone/groups.cpp:524: undefined reference to `BotRaids::RemoveRaidBots()'
groups.o: In function `Client::LeaveGroup()':
/root/eqemu/source/zone/groups.cpp:1053: undefined reference to `BotRaids::RemoveRaidBots()'
/usr/bin/ld: Dwarf Error: Offset (271637) greater than or equal to .debug_str size (55798).
command.o: In function `command_bot(Client*, Seperator const*)':
/root/eqemu/source/zone/command.cpp:9195: undefined reference to `BotRaids::GetBotRaidAggro()'
/root/eqemu/source/zone/command.cpp:9474: undefined reference to `BotRaids::BotRaids(Mob*)'
/root/eqemu/source/zone/command.cpp:9482: undefined reference to `BotRaids::AddBotGroup(Group*)'
/root/eqemu/source/zone/command.cpp:9494: undefined reference to `BotRaids::AddBotGroup(Group*)'
/root/eqemu/source/zone/command.cpp:9576: undefined reference to `BotRaids::GetBotRaidAggro()'
/root/eqemu/source/zone/command.cpp:9600: undefined reference to `BotRaids::SaveGroups(Client*)'
/root/eqemu/source/zone/command.cpp:9634: undefined reference to `BotRaids::GetBotRaidAggro()'
/root/eqemu/source/zone/command.cpp:9814: undefined reference to `BotRaids::FollowGuardCmd(Client*, bool)'
/root/eqemu/source/zone/command.cpp:9844: undefined reference to `BotRaids::FollowGuardCmd(Client*, bool)'
/root/eqemu/source/zone/command.cpp:9869: undefined reference to `BotRaids::AddBotRaidAggro(Mob*)'
/root/eqemu/source/zone/command.cpp:10069: undefined reference to `BotRaids::GetBotRaidAggro()'
/root/eqemu/source/zone/command.cpp:10114: undefined reference to `BotRaids::SummonRaidBots(Mob*, bool)'
/root/eqemu/source/zone/command.cpp:10260: undefined reference to `EntityList::ShowSpawnWindow(Client*, int, bool)'
/root/eqemu/source/zone/command.cpp:10264: undefined reference to `EntityList::ShowSpawnWindow(Client*, int, bool)'
/root/eqemu/source/zone/command.cpp:10268: undefined reference to `EntityList::ShowSpawnWindow(Client*, int, bool)'
/root/eqemu/source/zone/command.cpp:10279: undefined reference to `EntityList::ShowSpawnWindow(Client*, int, bool)'
/root/eqemu/source/zone/command.cpp:10286: undefined reference to `EntityList::ShowSpawnWindow(Client*, int, bool)'
/root/eqemu/source/zone/command.cpp:11988: undefined reference to `BotRaids::BotRaidInfo(Client*)'
/root/eqemu/source/zone/command.cpp:12024: undefined reference to `BotRaids::AddBotGroup(Group*)'
/root/eqemu/source/zone/command.cpp:12039: undefined reference to `BotRaids::GetBotRaidAggro()'
/root/eqemu/source/zone/command.cpp:12078: undefined reference to `BotRaids::RaidBotGroupsCount()'
/root/eqemu/source/zone/command.cpp:12096: undefined reference to `BotRaids::AddBotGroup(Group*)'
/root/eqemu/source/zone/command.cpp:12198: undefined reference to `BotRaids::RemoveRaidBots()'
/root/eqemu/source/zone/command.cpp:12238: undefined reference to `BotRaids::SetBotMainTank(Mob*)'
/root/eqemu/source/zone/command.cpp:12253: undefined reference to `BotRaids::SetBotSecondTank(Mob*)'
/root/eqemu/source/zone/command.cpp:12267: undefined reference to `BotRaids::SetBotMainTarget(Mob*)'
/root/eqemu/source/zone/command.cpp:12302: undefined reference to `BotRaids::SetBotGroupTarget(Mob*, Group*)'
/root/eqemu/source/zone/command.cpp:12315: undefined reference to `BotRaids::GroupAssignTask(Group*, int, Mob*)'
/root/eqemu/source/zone/command.cpp:12325: undefined reference to `BotRaids::GroupAssignTask(Group*, int, Mob*)'
/root/eqemu/source/zone/command.cpp:12329: undefined reference to `BotRaids::GroupAssignTask(Group*, int, Group*)'
/root/eqemu/source/zone/command.cpp:12333: undefined reference to `BotRaids::GroupAssignTask(Group*, int, Group*)'
/root/eqemu/source/zone/command.cpp:12336: undefined reference to `BotRaids::RaidDefendEnraged()'
/root/eqemu/source/zone/command.cpp:12010: undefined reference to `BotRaids::BotRaids(Mob*)'
/root/eqemu/source/zone/command.cpp:12272: undefined reference to `BotRaids::SetBotMainTarget(Mob*)'
/root/eqemu/source/zone/command.cpp:12286: undefined reference to `BotRaids::SetBotSecondTarget(Mob*)'
/usr/bin/ld: Dwarf Error: Offset (293649) greater than or equal to .debug_str size (24492).
client_packet.o: In function `Client::Handle_OP_Logout(EQApplicationPacket const*)':
/root/eqemu/source/zone/client_packet.cpp:2514: undefined reference to `BotRaids::RemoveRaidBots()'
/usr/bin/ld: Dwarf Error: Offset (207944) greater than or equal to .debug_str size (166).
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x318): undefined reference to `NPC::Bot_AI_IdleCastCheck()'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x320): undefined reference to `NPC::Bot_AI_EngagedCastCheck()'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x328): undefined reference to `NPC::Bot_AI_PursueCastCheck()'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x330): undefined reference to `NPC::Bot_Command_MezzTarget(Mob*)'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x338): undefined reference to `NPC::Bot_Command_RezzTarget(Mob*)'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x340): undefined reference to `NPC::Bot_Command_Cure(int, int)'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x348): undefined reference to `NPC::BotRaidSpell(unsigned short)'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x350): undefined reference to `NPC::Bot_Command_CalmTarget(Mob*)'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x358): undefined reference to `NPC::Bot_Command_CharmTarget(int, Mob*)'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x360): undefined reference to `NPC::Bot_Command_DireTarget(int, Mob*)'
pets.o:(.data.rel.ro._ZTV3Pet[vtable for Pet]+0x368): undefined reference to `NPC::Bot_Command_Resist(int, int)'
/usr/bin/ld: Dwarf Error: Offset (210230) greater than or equal to .debug_str size (14401).
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x318): undefined reference to `NPC::Bot_AI_IdleCastCheck()'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x320): undefined reference to `NPC::Bot_AI_EngagedCastCheck()'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x328): undefined reference to `NPC::Bot_AI_PursueCastCheck()'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x330): undefined reference to `NPC::Bot_Command_MezzTarget(Mob*)'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x338): undefined reference to `NPC::Bot_Command_RezzTarget(Mob*)'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x340): undefined reference to `NPC::Bot_Command_Cure(int, int)'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x348): undefined reference to `NPC::BotRaidSpell(unsigned short)'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x350): undefined reference to `NPC::Bot_Command_CalmTarget(Mob*)'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x358): undefined reference to `NPC::Bot_Command_CharmTarget(int, Mob*)'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x360): undefined reference to `NPC::Bot_Command_DireTarget(int, Mob*)'
horse.o:(.data.rel.ro._ZTV5Horse[vtable for Horse]+0x368): undefined reference to `NPC::Bot_Command_Resist(int, int)'
/usr/bin/ld: Dwarf Error: Offset (210114) greater than or equal to .debug_str size (629).
special_attacks.o: In function `Mob::Taunt(NPC*, bool)':
/root/eqemu/source/zone/special_attacks.cpp:1553: undefined reference to `BotRaids::GetBotMainTank()'
/root/eqemu/source/zone/special_attacks.cpp:1553: undefined reference to `BotRaids::GetBotMainTank()'
/root/eqemu/source/zone/special_attacks.cpp:1553: undefined reference to `BotRaids::GetBotSecondTank()'
/root/eqemu/source/zone/special_attacks.cpp:1553: undefined reference to `BotRaids::GetBotSecondTank()'
/usr/bin/ld: Dwarf Error: Offset (207620) greater than or equal to .debug_str size (142).
zoning.o: In function `Client::Handle_OP_ZoneChange(EQApplicationPacket const*)':
/root/eqemu/source/zone/zoning.cpp:44: undefined reference to `BotRaids::RemoveRaidBots()'
collect2: ld returned 1 exit status
make: *** [zone] Error 1
[root@marysol zone]#
|
|
|
|
06-19-2009, 11:33 PM
|
Developer
|
|
Join Date: Apr 2009
Location: USA
Posts: 478
|
|
Looks to me like you didn't add the bot object files into zone/makefile.common that are needed for -EQBOTS to work. This patch will do it for you.
Code:
diff -up EQEmuServer/zone/makefile.common.dan EQEmuServer/zone/makefile.common
--- EQEmuServer/zone/makefile.common.dan 2009-06-11 17:43:20.000000000 -0700
+++ EQEmuServer/zone/makefile.common 2009-06-11 17:44:08.000000000 -0700
@@ -31,7 +31,7 @@ SF= .obj/EQPacket.o .obj/EQStream.o .obj
../common/EQStreamIdent.o ../common/patches/Live.o \
zone_logsys.o ../common/BasePacket.o ../common/worldconn.o \
../common/EmuTCPConnection.o ../common/EmuTCPServer.o ../common/TCPServer.o \
- ../common/guild_base.o guild_mgr.o tasks.o raids.o
+ ../common/guild_base.o guild_mgr.o tasks.o raids.o botAI.o botRaids.o petAI.o
all: $(APP)
Let me know if this resolves the problem or if you have other problems after this change.
|
|
|
|
06-22-2009, 03:01 PM
|
Developer
|
|
Join Date: Apr 2009
Location: USA
Posts: 478
|
|
KLS, try this patch for va_lists under windows. It defines va_copy if it is not already defined.
Code:
Index: common/MiscFunctions.cpp
===================================================================
--- common/MiscFunctions.cpp (revision 702)
+++ common/MiscFunctions.cpp (working copy)
@@ -59,6 +59,10 @@
#include <errno.h>
#endif
+#ifndef va_copy
+ #define va_copy(d,s) ((d) = (s))
+#endif
+
void CoutTimestamp(bool ms) {
time_t rawtime;
struct tm* gmt_t;
@@ -147,7 +151,7 @@
int MakeAnyLenString(char** ret, const char* format, ...) {
int buf_len = 128;
int chars = -1;
- va_list argptr;
+ va_list argptr, tmpargptr;
va_start(argptr, format);
while (chars == -1 || chars >= buf_len) {
safe_delete_array(*ret);
@@ -156,7 +160,8 @@
else
buf_len = chars + 1;
*ret = new char[buf_len];
- chars = vsnprintf(*ret, buf_len, format, argptr);
+ va_copy(tmpargptr, argptr);
+ chars = vsnprintf(*ret, buf_len, format, tmpargptr);
}
va_end(argptr);
return chars;
@@ -169,7 +174,7 @@
*strlen = 0;
int chars = -1;
char* oldret = 0;
- va_list argptr;
+ va_list argptr, tmpargptr;
va_start(argptr, format);
while (chars == -1 || chars >= (sint32)(*bufsize-*strlen)) {
if (chars == -1)
@@ -183,7 +188,8 @@
memcpy(*ret, oldret, *strlen);
safe_delete_array(oldret);
}
- chars = vsnprintf(&(*ret)[*strlen], (*bufsize-*strlen), format, argptr);
+ va_copy(tmpargptr, argptr);
+ chars = vsnprintf(&(*ret)[*strlen], (*bufsize-*strlen), format, tmpargptr);
}
va_end(argptr);
*strlen += chars;
Index: common/debug.cpp
===================================================================
--- common/debug.cpp (revision 702)
+++ common/debug.cpp (working copy)
@@ -20,6 +20,10 @@
#endif
#include "../common/MiscFunctions.h"
+#ifndef va_copy
+ #define va_copy(d,s) ((d) = (s))
+#endif
+
static volatile bool logFileValid = false;
static EQEMuLog realLogFile;
EQEMuLog *LogFile = &realLogFile;
@@ -144,13 +148,16 @@
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#endif
- va_list argptr;
+ va_list argptr, tmpargptr;
va_start(argptr, fmt);
- if (dofile)
- vfprintf( fp[id], fmt, argptr );
+ if (dofile) {
+ va_copy(tmpargptr, argptr);
+ vfprintf( fp[id], fmt, tmpargptr );
+ }
if(logCallbackFmt[id]) {
msgCallbackFmt p = logCallbackFmt[id];
- p(id, fmt, argptr );
+ va_copy(tmpargptr, argptr);
+ p(id, fmt, tmpargptr );
}
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
@@ -204,17 +211,21 @@
time( &aclock ); /* Get time in seconds */
newtime = localtime( &aclock ); /* Convert time to struct */
+ va_list tmpargptr;
+
if (dofile) {
#ifndef NO_PIDLOG
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
#else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
#endif
- vfprintf( fp[id], fmt, argptr );
+ va_copy(tmpargptr, argptr);
+ vfprintf( fp[id], fmt, tmpargptr );
}
if(logCallbackPva[id]) {
msgCallbackPva p = logCallbackPva[id];
- p(id, prefix, fmt, argptr );
+ va_copy(tmpargptr, argptr);
+ p(id, prefix, fmt, tmpargptr );
}
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8) {
@@ -295,10 +306,12 @@
}
bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
- va_list argptr;
+ va_list argptr, tmpargptr;
va_start(argptr, fmt);
- if (dofile)
- vfprintf( fp[id], fmt, argptr );
+ if (dofile) {
+ va_copy(tmpargptr, argptr);
+ vfprintf( fp[id], fmt, tmpargptr );
+ }
if (pLogStatus[id] & 2) {
if (pLogStatus[id] & 8)
vfprintf( stderr, fmt, argptr );
|
|
|
|
06-23-2009, 03:59 AM
|
Developer
|
|
Join Date: Apr 2009
Location: USA
Posts: 478
|
|
Somehow a uint16 in the patch was changed to a uint32 in the SVN. The following patch fixes this:
Code:
Index: zone/map.h
===================================================================
--- zone/map.h (revision 706)
+++ zone/map.h (working copy)
@@ -96,7 +96,7 @@
uint8 flags;
union {
- uint32 nodes[4]; //index 0 means NULL, not root
+ uint16 nodes[4]; //index 0 means NULL, not root
struct {
uint32 count;
uint32 offset;
|
|
|
|
06-23-2009, 12:11 PM
|
Developer
|
|
Join Date: Apr 2009
Location: USA
Posts: 478
|
|
If the va_list patch is what is causing the zone.exe crashes under windows, this patch should avoid the problem by using #ifndef WIN32 blocks. This patch should be applied against rev706 or later.
Code:
Index: common/MiscFunctions.cpp
===================================================================
--- common/MiscFunctions.cpp (revision 707)
+++ common/MiscFunctions.cpp (working copy)
@@ -59,10 +59,6 @@
#include <errno.h>
#endif
-#ifndef va_copy
- #define va_copy(d,s) ((d) = (s))
-#endif
-
void CoutTimestamp(bool ms) {
time_t rawtime;
struct tm* gmt_t;
@@ -151,8 +147,12 @@
int MakeAnyLenString(char** ret, const char* format, ...) {
int buf_len = 128;
int chars = -1;
- va_list argptr, tmpargptr;
+ va_list argptr;
va_start(argptr, format);
+#ifndef WIN32
+ va_list tmpargptr;
+ va_copy(tmpargptr, argptr);
+#endif
while (chars == -1 || chars >= buf_len) {
safe_delete_array(*ret);
if (chars == -1)
@@ -160,8 +160,10 @@
else
buf_len = chars + 1;
*ret = new char[buf_len];
- va_copy(tmpargptr, argptr);
- chars = vsnprintf(*ret, buf_len, format, tmpargptr);
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
+ chars = vsnprintf(*ret, buf_len, format, argptr);
}
va_end(argptr);
return chars;
@@ -174,8 +176,12 @@
*strlen = 0;
int chars = -1;
char* oldret = 0;
- va_list argptr, tmpargptr;
+ va_list argptr;
va_start(argptr, format);
+#ifndef WIN32
+ va_list tmpargptr;
+ va_copy(tmpargptr, argptr);
+#endif
while (chars == -1 || chars >= (sint32)(*bufsize-*strlen)) {
if (chars == -1)
*bufsize += 256;
@@ -188,8 +194,10 @@
memcpy(*ret, oldret, *strlen);
safe_delete_array(oldret);
}
- va_copy(tmpargptr, argptr);
- chars = vsnprintf(&(*ret)[*strlen], (*bufsize-*strlen), format, tmpargptr);
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
+ chars = vsnprintf(&(*ret)[*strlen], (*bufsize-*strlen), format, argptr);
}
va_end(argptr);
*strlen += chars;
Index: common/debug.cpp
===================================================================
--- common/debug.cpp (revision 707)
+++ common/debug.cpp (working copy)
@@ -20,10 +20,6 @@
#endif
#include "../common/MiscFunctions.h"
-#ifndef va_copy
- #define va_copy(d,s) ((d) = (s))
-#endif
-
static volatile bool logFileValid = false;
static EQEMuLog realLogFile;
EQEMuLog *LogFile = &realLogFile;
@@ -148,18 +144,29 @@
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
#endif
- va_list argptr, tmpargptr;
+ va_list argptr;
va_start(argptr, fmt);
+#ifndef WIN32
+ va_list tmpargptr;
+ va_copy(tmpargptr, argptr);
+#endif
if (dofile) {
- va_copy(tmpargptr, argptr);
- vfprintf( fp[id], fmt, tmpargptr );
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
+ vfprintf( fp[id], fmt, argptr );
}
if(logCallbackFmt[id]) {
msgCallbackFmt p = logCallbackFmt[id];
- va_copy(tmpargptr, argptr);
- p(id, fmt, tmpargptr );
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
+ p(id, fmt, argptr );
}
if (pLogStatus[id] & 2) {
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
if (pLogStatus[id] & 8) {
fprintf(stderr, "[%s] ", LogNames[id]);
vfprintf( stderr, fmt, argptr );
@@ -211,7 +218,10 @@
time( &aclock ); /* Get time in seconds */
newtime = localtime( &aclock ); /* Convert time to struct */
+#ifndef WIN32
va_list tmpargptr;
+ va_copy(tmpargptr, argptr);
+#endif
if (dofile) {
#ifndef NO_PIDLOG
@@ -219,15 +229,22 @@
#else
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
#endif
- va_copy(tmpargptr, argptr);
- vfprintf( fp[id], fmt, tmpargptr );
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
+ vfprintf( fp[id], fmt, argptr );
}
if(logCallbackPva[id]) {
msgCallbackPva p = logCallbackPva[id];
- va_copy(tmpargptr, argptr);
- p(id, prefix, fmt, tmpargptr );
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
+ p(id, prefix, fmt, argptr );
}
if (pLogStatus[id] & 2) {
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
if (pLogStatus[id] & 8) {
fprintf(stderr, "[%s] %s", LogNames[id], prefix);
vfprintf( stderr, fmt, argptr );
@@ -306,13 +323,22 @@
}
bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
- va_list argptr, tmpargptr;
+ va_list argptr;
va_start(argptr, fmt);
+#ifndef WIN32
+ va_list tmpargptr;
+ va_copy(tmpargptr, argptr);
+#endif
if (dofile) {
- va_copy(tmpargptr, argptr);
- vfprintf( fp[id], fmt, tmpargptr );
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
+ vfprintf( fp[id], fmt, argptr );
}
if (pLogStatus[id] & 2) {
+#ifndef WIN32
+ va_copy(argptr, tmpargptr);
+#endif
if (pLogStatus[id] & 8)
vfprintf( stderr, fmt, argptr );
else
|
|
|
|
06-23-2009, 02:26 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
No crashes for va_lists from windows that I can find.
|
06-23-2009, 04:25 PM
|
Developer
|
|
Join Date: Apr 2009
Location: USA
Posts: 478
|
|
Excellent.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 03:41 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|