Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2009, 08:52 PM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

I needed to add this header include to ucs/clientlist.cpp to compile on my system. I do not know if this is a 64bit problem or just my version of gcc.

Code:
Index: ucs/clientlist.cpp
===================================================================
--- ucs/clientlist.cpp  (revision 37)
+++ ucs/clientlist.cpp  (revision 38)
@@ -31,6 +31,7 @@
 #include "../common/EmuTCPServer.h"
 #include <list>
 #include <vector>
+#include <algorithm>
 #include <string>
 #include <cstdlib>
Reply With Quote
  #2  
Old 06-10-2009, 09:51 PM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

Just realized I hadn't given credit to ndnet for his work on the patch that fixed the missing augments. He is the one who found that fix.
Reply With Quote
  #3  
Old 06-15-2009, 02:00 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I'll try to get to this stuff in the next few days, sorry I almost forgot about it.
Reply With Quote
  #4  
Old 06-15-2009, 02:35 AM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

No worries. I just figured they could be done one at a time as time permits. Thanks.
Reply With Quote
  #5  
Old 06-17-2009, 08:22 PM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

Quote:
Originally Posted by gaeorn View Post
I needed to add this header include to ucs/clientlist.cpp to compile on my system. I do not know if this is a 64bit problem or just my version of gcc.

Code:
Index: ucs/clientlist.cpp
===================================================================
--- ucs/clientlist.cpp  (revision 37)
+++ ucs/clientlist.cpp  (revision 38)
@@ -31,6 +31,7 @@
 #include "../common/EmuTCPServer.h"
 #include <list>
 #include <vector>
+#include <algorithm>
 #include <string>
 #include <cstdlib>
You can ignore this patch as Derision already updated the SVN with a fix.
Reply With Quote
  #6  
Old 06-18-2009, 12:58 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I was gonna commit some of this tonight but I ran into some issues; not entirely your fault.

Some comments:

There is no va_copy() on windows.
I also don't believe socklen_t is defined type on windows, though I didn't look into it further.
Reply With Quote
  #7  
Old 06-18-2009, 01:23 AM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

The va_copy() probably could be replaced with a memcpy. The socklen_t could be inside an #ifdef.

Feel free to do whatever you think is best. And fyi, I know C much better than I know C++, so if there are better ways of doing things, change it
Reply With Quote
  #8  
Old 06-18-2009, 01:36 AM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

Here is another patch. This one fixes loading the regular and water map files.

Code:
Index: zone/map.h
===================================================================
--- zone/map.h  (revision 687)
+++ zone/map.h  (working copy)
@@ -56,11 +56,11 @@
 }FACE, *PFACE;

 typedef struct _mapHeader {
-       unsigned long version;
+       uint32 version;
 //     unsigned long vertex_count;
-       unsigned long face_count;
-       unsigned short node_count;
-       unsigned long facelist_count;
+       uint32 face_count;
+       uint16 node_count;
+       uint32 facelist_count;
 } mapHeader;

 /*
@@ -95,12 +95,12 @@
        float maxx;
        float maxy;

-       unsigned char flags;
+       uint8 flags;
        union {
-               unsigned short nodes[4];        //index 0 means NULL, not root
+               uint16 nodes[4];        //index 0 means NULL, not root
                struct {
-                       unsigned long count;
-                       unsigned long offset;
+                       uint32 count;
+                       uint32 offset;
                } faces;
        };
 } nodeHeader, NODE, *PNODE;
@@ -111,7 +111,7 @@
 #define NODE_NONE 65534
 #define MAP_ROOT_NODE 0

-typedef unsigned short NodeRef;
+typedef uint16 NodeRef;

 /*typedef struct _node {
        nodeHeader head;
@@ -145,7 +145,7 @@
        bool LineIntersectsZone(VERTEX start, VERTEX end, float step, VERTEX *result, FACE **on = NULL) const;

 //     inline unsigned int             GetVertexNumber( ) {return m_Vertex; }
-       inline unsigned int             GetFacesNumber( ) const { return m_Faces; }
+       inline uint32                   GetFacesNumber( ) const { return m_Faces; }
 //     inline PVERTEX  GetVertex( int _idx ) {return mFinalVertex + _idx;      }
        inline PFACE            GetFace( int _idx) {return mFinalFaces + _idx;          }
        inline PFACE            GetFaceFromlist( int _idx) {return &mFinalFaces[ mFaceLists[_idx] ];    }
@@ -161,13 +161,13 @@
        bool LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, VERTEX *result, FACE **on);
 private:
 //     unsigned long m_Vertex;
-       unsigned long m_Faces;
-       unsigned long m_Nodes;
-       unsigned long m_FaceLists;
+       uint32 m_Faces;
+       uint32 m_Nodes;
+       uint32 m_FaceLists;
 //     PVERTEX mFinalVertex;
        PFACE mFinalFaces;
        PNODE mNodes;
-       unsigned long *mFaceLists;
+       uint32 *mFaceLists;


        int mCandFaces[100];
Index: zone/Map.cpp
===================================================================
--- zone/Map.cpp        (revision 687)
+++ zone/Map.cpp        (working copy)
@@ -119,11 +119,11 @@
        if(head.version != MAP_VERSION) {
                //invalid version... if there really are multiple versions,
                //a conversion routine could be possible.
-               printf("Invalid map version 0x%lx\n", head.version);
+               printf("Invalid map version 0x%lx\n", (unsigned long)head.version);
                return(false);
        }

-       printf("Map header: %lu faces, %u nodes, %lu facelists\n", head.face_count, head.node_count, head.facelist_count);
+       printf("Map header: %lu faces, %u nodes, %lu facelists\n", (unsigned long)head.face_count, (unsigned int)head.node_count, (unsigned long)head.facelist_count);

        m_Faces = head.face_count;
        m_Nodes = head.node_count;
@@ -134,24 +134,24 @@
 //     mFinalVertex = new VERTEX[m_Vertex];
        mFinalFaces = new FACE  [m_Faces];
        mNodes = new NODE[m_Nodes];
-       mFaceLists = new unsigned long[m_FaceLists];
+       mFaceLists = new uint32[m_FaceLists];

 //     fread(mFinalVertex, m_Vertex, sizeof(VERTEX), fp);

        //this was changed to this loop from the single read because valgrind was
        //hanging on this read otherwise... I dont pretend to understand it.
 #ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
-       unsigned long r;
+       uint32 r;
        for(r = 0; r < m_Faces; r++) {
                if(fread(mFinalFaces+r, sizeof(FACE), 1, fp) != 1) {
-                       printf("Unable to read %lu faces from map file, got %lu.\n", m_Faces, r);
+                       printf("Unable to read %lu faces from map file, got %lu.\n", (unsigned long)m_Faces, (unsigned long)r);
                        return(false);
                }
        }
 #else
-       unsigned long count;
+       uint32 count;
        if((count=fread(mFinalFaces, sizeof(FACE), m_Faces , fp)) != m_Faces) {
-               printf("Unable to read %lu face bytes from map file, got %lu.\n", m_Faces, count);
+               printf("Unable to read %lu face bytes from map file, got %lu.\n", (unsigned long)m_Faces, (unsigned long)count);
                return(false);
        }
 #endif
@@ -159,27 +159,27 @@
 #ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
        for(r = 0; r < m_Nodes; r++) {
                if(fread(mNodes+r, sizeof(NODE), 1, fp) != 1) {
-                       printf("Unable to read %lu nodes from map file, got %lu.\n", m_Nodes, r);
+                       printf("Unable to read %lu nodes from map file, got %lu.\n", (unsigned long)m_Nodes, (unsigned long)r);
                        return(false);
                }
        }
 #else
        if(fread(mNodes, sizeof(NODE), m_Nodes, fp) != m_Nodes) {
-               printf("Unable to read %lu nodes from map file.\n", m_Nodes);
+               printf("Unable to read %lu nodes from map file.\n", (unsigned long)m_Nodes);
                return(false);
        }
 #endif

 #ifdef SLOW_AND_CRAPPY_MAKES_VALGRIND_HAPPY
        for(r = 0; r < m_FaceLists; r++) {
-               if(fread(mFaceLists+r, sizeof(unsigned long), 1, fp) != 1) {
-                       printf("Unable to read %lu face lists from map file, got %lu.\n", m_FaceLists, r);
+               if(fread(mFaceLists+r, sizeof(uint32), 1, fp) != 1) {
+                       printf("Unable to read %lu face lists from map file, got %lu.\n", (unsigned long)m_FaceLists, (unsigned long)r);
                        return(false);
                }
        }
 #else
-       if(fread(mFaceLists, sizeof(unsigned long), m_FaceLists, fp) != m_FaceLists) {
-               printf("Unable to read %lu face lists from map file.\n", m_FaceLists);
+       if(fread(mFaceLists, sizeof(uint32), m_FaceLists, fp) != m_FaceLists) {
+               printf("Unable to read %lu face lists from map file.\n", (unsigned long)m_FaceLists);
                return(false);
        }
 #endif
@@ -188,7 +188,7 @@
 /*     mRoot = new NODE();
        RecLoadNode(mRoot, fp );*/

-       unsigned long i;
+       uint32 i;
        float v;
        for(i = 0; i < m_Faces; i++) {
                v = Vmax3(x, mFinalFaces[i].a, mFinalFaces[i].b, mFinalFaces[i].c);
@@ -210,7 +210,7 @@
                if(v < _minz)
                        _minz = v;
        }
-       printf("Loaded map: %lu vertices, %lu faces\n", m_Faces*3, m_Faces);
+       printf("Loaded map: %lu vertices, %lu faces\n", (unsigned long)m_Faces*3, (unsigned long)m_Faces);
        printf("Map BB: (%.2f -> %.2f, %.2f -> %.2f, %.2f -> %.2f)\n", _minx, _maxx, _miny, _maxy, _minz, _maxz);
        return(true);
 }
@@ -454,7 +454,7 @@
        unsigned long i;

        PFACE cur;
-       const unsigned long *cfl = mFaceLists + _node->faces.offset;
+       const uint32 *cfl = mFaceLists + _node->faces.offset;

        for(i = 0; i < _node->faces.count; i++) {
                if(*cfl > m_Faces)
@@ -508,7 +508,7 @@
        //
        for(zAttempt=1; zAttempt<=2; zAttempt++) {

-               const unsigned long *cfl = mFaceLists + _node->faces.offset;
+               const uint32 *cfl = mFaceLists + _node->faces.offset;

 #ifdef DEBUG_BEST_Z
 printf("Start finding best Z...\n");
Index: zone/watermap.h
===================================================================
--- zone/watermap.h     (revision 687)
+++ zone/watermap.h     (working copy)
@@ -22,11 +22,11 @@

 #pragma pack(1)
 typedef struct ZBSP_Node {
-        long node_number;
+        sint32 node_number;
         float normal[3], splitdistance;
-        long region;
-        int special;
-        long left, right;
+        sint32 region;
+        sint32 special;
+        sint32 left, right;
 } ZBSP_Node;
 #pragma pack()

@@ -43,7 +43,7 @@

 public:
        static WaterMap*  LoadWaterMapfile(const char* in_zonename, const char *directory = NULL);
-        WaterRegionType BSPReturnRegionType(long node_number, float y, float x, float z) const;
+        WaterRegionType BSPReturnRegionType(sint32 node_number, float y, float x, float z) const;
         bool InWater(float y, float x, float z) const;
         bool InLava(float y, float x, float z) const;

Index: zone/watermap.cpp
===================================================================
--- zone/watermap.cpp   (revision 687)
+++ zone/watermap.cpp   (working copy)
@@ -41,7 +41,7 @@
 }


-WaterRegionType WaterMap::BSPReturnRegionType(long node_number, float y, float x, float z) const
+WaterRegionType WaterMap::BSPReturnRegionType(sint32 node_number, float y, float x, float z) const
 {
        float distance;
Reply With Quote
  #9  
Old 06-18-2009, 01:45 AM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

Quote:
Originally Posted by KLS View Post
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))
Reply With Quote
  #10  
Old 06-18-2009, 02:41 AM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

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.
Reply With Quote
  #11  
Old 06-18-2009, 03:44 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

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
Reply With Quote
  #12  
Old 06-18-2009, 10:51 PM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

Quote:
Originally Posted by Angelox View Post
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.
Reply With Quote
  #13  
Old 06-22-2009, 03:01 PM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

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 );
Reply With Quote
  #14  
Old 06-23-2009, 03:59 AM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

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;
Reply With Quote
  #15  
Old 06-23-2009, 12:11 PM
gaeorn
Developer
 
Join Date: Apr 2009
Location: USA
Posts: 478
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:40 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3