--------------------- PatchSet 1178 Date: 2005/01/09 10:21:48 Author: serassio Branch: nt Tag: (none) Log: Added handling of CRT invalid parameters Members: src/win32.cc:1.4.2.13->1.4.2.14 Index: squid3/src/win32.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/win32.cc,v retrieving revision 1.4.2.13 retrieving revision 1.4.2.14 diff -u -r1.4.2.13 -r1.4.2.14 --- squid3/src/win32.cc 7 Jan 2005 09:30:28 -0000 1.4.2.13 +++ squid3/src/win32.cc 9 Jan 2005 10:21:48 -0000 1.4.2.14 @@ -1,6 +1,6 @@ /* - * $Id: win32.cc,v 1.4.2.13 2005/01/07 09:30:28 serassio Exp $ + * $Id: win32.cc,v 1.4.2.14 2005/01/09 10:21:48 serassio Exp $ * * * * * * * * * Legal stuff * * * * * * * * @@ -49,6 +49,9 @@ #include #endif #include +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#include +#endif #endif #include @@ -65,6 +68,9 @@ /* The following code section is part of an EXPERIMENTAL native */ /* Windows NT/2000 Squid port - Compiles only on MS Visual C++ */ #if defined(_SQUID_MSWIN_) +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +void Squid_Win32InvalidParameterHandler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t); +#endif static int Win32SockInit(void); static void Win32SockCleanup(void); SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex; @@ -423,6 +429,10 @@ WIN32_Subsystem_Init() #endif { +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ + _invalid_parameter_handler oldHandler, newHandler; +#endif + WIN32_OS_version = GetOSVersion(); if ((WIN32_OS_version == _WIN_OS_UNKNOWN) || (WIN32_OS_version == _WIN_OS_WIN32S)) @@ -431,6 +441,14 @@ if (atexit(WIN32_Exit) != 0) return 1; +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ + newHandler = Squid_Win32InvalidParameterHandler; + oldHandler = _set_invalid_parameter_handler(newHandler); + _CrtSetReportMode(_CRT_ASSERT, 0); + +#endif + + #if USE_WIN32_SERVICE if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) @@ -1071,15 +1089,17 @@ return; } - -int Win32__WSAFDIsSet(int fd, fd_set* set - ) +int Win32__WSAFDIsSet(int fd, fd_set* set) { fde *F = &fd_table[fd]; SOCKET s = F->win32.handle; - return ::__WSAFDIsSet(s, (fd_set FAR *)(set - )); + return __WSAFDIsSet(s, (fd_set FAR *)set); +} + +void Squid_Win32InvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved) +{ + return; } #endif /* End native Windows NT EXPERIMENTAL PORT */