santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Pelton" <...@PKC.com>
Subject Minor issue in C++ library
Date Tue, 01 Feb 2005 17:48:06 GMT
utils/winutils/XSECBinHTTPURIInputStream.cpp borrows heavily from
xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp, including a
doubtful practice that leads to linker warnings under some
circumstances.  The fix is trivial.

The problem is that both files in question declare the same set of
global variables, and neither file properly restricts these globals to
file scope.  As a consequence, if Xerces' namespace support is disabled
and the Xerces library is statically linked, the names collide.  (I'm
not sure whether both conditions are necessary; that's just the way I
build.)

To avoid the problem (and be clear about the intended scope of these
variables), the globals in XSECBinHTTPURIInputStream.cpp should be
declared static.  The following lines:

HMODULE gWinsockLib = NULL;
LPFN_GETHOSTBYNAME gWSgethostbyname = NULL;
LPFN_INET_ADDR gWSinet_addr = NULL;
LPFN_GETHOSTBYADDR gWSgethostbyaddr = NULL;
LPFN_HTONS gWShtons = NULL;
LPFN_SOCKET gWSsocket = NULL;
LPFN_CONNECT gWSconnect = NULL;
LPFN_SEND gWSsend = NULL;
LPFN_RECV gWSrecv = NULL;
LPFN_SHUTDOWN gWSshutdown = NULL;
LPFN_CLOSESOCKET gWSclosesocket = NULL;
LPFN_WSACLEANUP gWSACleanup = NULL;

become:

static HMODULE gWinsockLib = NULL;
static LPFN_GETHOSTBYNAME gWSgethostbyname = NULL;
static LPFN_INET_ADDR gWSinet_addr = NULL;
static LPFN_GETHOSTBYADDR gWSgethostbyaddr = NULL;
static LPFN_HTONS gWShtons = NULL;
static LPFN_SOCKET gWSsocket = NULL;
static LPFN_CONNECT gWSconnect = NULL;
static LPFN_SEND gWSsend = NULL;
static LPFN_RECV gWSrecv = NULL;
static LPFN_SHUTDOWN gWSshutdown = NULL;
static LPFN_CLOSESOCKET gWSclosesocket = NULL;
static LPFN_WSACLEANUP gWSACleanup = NULL;

I've made the same suggestion to the Xerces-C crew.  See
http://issues.apache.org/jira/browse/XERCESC-1331.

Mime
View raw message