diff --git a/Changes b/Changes index d900118fa..8a8101156 100644 --- a/Changes +++ b/Changes @@ -1137,3 +1137,7 @@ VHP will stay supported though... so it's not mandatory to switch over. - Fixed set::maxdccallow setting to <=0 still allowing one entry to be set, reported by RSCruiser (#0002883). +- Fixed Microsoft Visual Studio 2005 (8.x) unable to compile, and, after fixing that, causing + a lot of crashes. Both are now fixed. Reported by Zell, Yamake, and others (#2875, #2704). + Fix provided by Xuefer. This also gets rid of some annoying and useless compile warnings + as well. diff --git a/include/h.h b/include/h.h index 9b309fe26..774421267 100644 --- a/include/h.h +++ b/include/h.h @@ -217,11 +217,11 @@ extern MODFUNC char *sock_strerror(int); extern int dgets(int, char *, int); extern char *inetntoa(char *); -#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) -/* #ifndef _WIN32 XXX why was this?? -- Syzop. */ +#ifndef HAVE_SNPRINTF extern int snprintf (char *str, size_t count, const char *fmt, ...); +#endif +#ifndef HAVE_VSNPRINTF extern int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); -/* #endif */ #endif #ifdef _WIN32 diff --git a/include/win32/setup.h b/include/win32/setup.h index 5fd1c605e..4b2550e2d 100644 --- a/include/win32/setup.h +++ b/include/win32/setup.h @@ -43,6 +43,12 @@ #undef TIMES_2 #undef GETRUSAGE_2 #define HAVE_ALLOCA +/* vc 2005 */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define HAVE_VSNPRINTF +# define HAVE_SNPRINTF +# define snprintf _snprintf +#endif #define SPATH "." #define DPATH "." #define DOMAINNAME "irc.net" diff --git a/makefile.win32 b/makefile.win32 index ab2bc9b6a..ab53e2500 100644 --- a/makefile.win32 +++ b/makefile.win32 @@ -54,11 +54,19 @@ RC=rc # ######### END SSL ######## -###### RELEASE BUILD ##### -#To make a release build comment out the next line a release build -#does not contain debugging symbols and can not be used to locate -#the source of a crash or bug -DEBUG=1 +###### _EXTRA_ DEBUGGING ##### +# We always build releases with debugging information, since otherwise +# we cannot trace the source of a crash. Plus we do not mind the extra +# performance hit caused by not enabling super-optimization, tracing +# crashes properly is more important. +# You can choose (at your own risk) to enable EVEN MORE debugging, +# note that this causes /MDd to be used instead of /MD which can make +# libraries incompatible, plus all the other side-effects such as +# requiring a different dll we do not ship (and maybe you are not even +# allowed to ship due to license agreements), etc... +# In any case, this probably should not be used, unless debugging a +# problem locally, in which case it can be useful. +DEBUGEXTRA=0 # # #### END RELEASE BUILD ### @@ -100,25 +108,26 @@ OPENSSL_LIB=/LIBPATH:"$(OPENSSL_LIB_DIR)" !ENDIF !ENDIF -!IFDEF DEBUG -DBGCFLAG=/MD /Zi -DBGLFLAG=/debug /debugtype:BOTH -MODDBGCFLAG=/LDd /MD /Zi +!IFDEF DEBUGEXTRA +DBGCFLAG=/MDd /Zi /Od +DBGLFLAG=/debug +MODDBGCFLAG=/LDd /MDd /Zi !ELSE -DBGCFLAG=/MD /O2 /G5 -MODDBGCFLAG=/LD /MD +DBGCFLAG=/MD /Zi +DBGLFLAG=/debug +MODDBGCFLAG=/LDd /MD /Zi !ENDIF FD_SETSIZE=/D FD_SETSIZE=16384 CFLAGS=$(DBGCFLAG) $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) /J /I ./INCLUDE /I ./INCLUDE/WIN32/ARES /Fosrc/ /nologo \ - $(ZIPCFLAGS) $(CURLCFLAGS) $(FD_SETSIZE) $(SSLCFLAGS) $(NS_ADDRESS) /D NOSPOOF=1 /c + $(ZIPCFLAGS) $(CURLCFLAGS) $(FD_SETSIZE) $(SSLCFLAGS) $(NS_ADDRESS) /D NOSPOOF=1 /c /D _CRT_SECURE_NO_DEPRECATE /D _USE_32BIT_TIME_T LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib ws2_32.lib advapi32.lib \ dbghelp.lib oldnames.lib comctl32.lib comdlg32.lib $(ZLIB_LIB) $(ZIPLIB) \ $(OPENSSL_LIB) $(SSLLIBS) $(LIBCURL_LIB) $(CURLLIB) /def:wircd.def /implib:wircd.lib \ /nologo $(DBGLFLAG) /out:WIRCD.EXE MODCFLAGS=$(MODDBGCFLAG) $(SSLCFLAGS) $(ZIPCFLAGS) $(CURLCFLAGS) /J /Fesrc/modules/ \ /Fosrc/modules/ /nologo $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) /I ./INCLUDE /D \ - DYNAMIC_LINKING /D NOSPOOF /D MODULE_COMPILE + DYNAMIC_LINKING /D NOSPOOF /D MODULE_COMPILE /D _CRT_SECURE_NO_DEPRECATE /D _USE_32BIT_TIME_T MODLFLAGS=/link /def:src/modules/module.def wircd.lib $(OPENSSL_LIB) $(SSLLIBS) \ $(ZLIB_LIB) $(ZIPLIB) $(LIBCURL_LIB) $(CURLLIB) @@ -242,10 +251,10 @@ CONF: ./WIRCD.EXE: $(OBJ_FILES) SRC/win32/WIN32.RES $(LINK) $(LFLAGS) $(OBJ_FILES) SRC/win32/WIN32.RES SRC/WIN32/TRE.LIB SRC/WIN32/ARESLIB.LIB /MAPINFO:LINES /MAP -@erase src\win32\win32.res -!IFNDEF DEBUG - @echo Non Debug version built +!IFNDEF DEBUGEXTRA + @echo Standard version built !ELSE - @echo Debug version built ... + @echo Extra-Debug version built ... !ENDIF #Source files @@ -458,7 +467,8 @@ MODULES: $(DLL_FILES) src/modules/commands.dll: $(MOD_FILES) $(INCLUDES) $(CC) $(MODDBGCFLAG) $(LIBCURL_INC) $(ZLIB_INC) $(OPENSSL_INC) /nologo \ $(SSLCFLAGS) $(ZIPCFLAGS) $(CURLCFLAGS) /Fosrc/modules/ \ - /I ./INCLUDE /D NOSPOOF /D MODULE_COMPILE $(MOD_FILES) \ + /I ./INCLUDE /D NOSPOOF /D MODULE_COMPILE /D _CRT_SECURE_NO_DEPRECATE \ + /D _USE_32BIT_TIME_T $(MOD_FILES) \ $(MODLFLAGS) src/win32/tre.lib /OUT:src/modules/commands.dll src/modules/m_chghost.dll: src/modules/m_chghost.c $(INCLUDES)