From: serassio <> Date: Thu, 6 Jan 2005 20:16:38 +0000 (+0000) Subject: MSVC fixup: X-Git-Tag: SQUID_3_0_PRE4~914 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=411c6ea30229377b5c2c8fef22619c68111bd3f9;p=thirdparty%2Fsquid.git MSVC fixup: Changes developed during latest code sprint allowing the build with MS Visual Studio 2005 beta 1: - log() needs type casting - abs() needs type casting - Splay<> template fix - type casting for ESI tag - getpagesize() prototype is not defined in all Windows build environment - Windows specific type casting for recv() and send() - strchr() on Windows doesn't like username() as argument --- diff --git a/include/splay.h b/include/splay.h index 854c40926d..49100d7d89 100644 --- a/include/splay.h +++ b/include/splay.h @@ -1,5 +1,5 @@ /* - * $Id: splay.h,v 1.27 2004/08/30 05:12:29 robertc Exp $ + * $Id: splay.h,v 1.28 2005/01/06 13:16:38 serassio Exp $ */ #ifndef SQUID_SPLAY_H @@ -361,14 +361,14 @@ Splay::size() const } template -typename Splay::const_iterator +const SplayConstIterator Splay::begin() const { return const_iterator(head); } template -typename Splay::const_iterator +const SplayConstIterator Splay::end() const { return const_iterator(NULL); diff --git a/src/ESICustomParser.cc b/src/ESICustomParser.cc index 0183f260c3..35d49051e5 100644 --- a/src/ESICustomParser.cc +++ b/src/ESICustomParser.cc @@ -1,6 +1,6 @@ /* - * $Id: ESICustomParser.cc,v 1.4 2003/08/04 22:14:40 robertc Exp $ + * $Id: ESICustomParser.cc,v 1.5 2005/01/06 13:16:38 serassio Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -113,7 +113,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool case ESITAG: { ++openESITags; - char *tagEnd = strchr(tag, '>'); + char *tagEnd = strchr(const_cast(tag), '>'); if (!tagEnd) { error = "Could not find end ('>') of tag"; @@ -128,7 +128,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool if (*(tagEnd - 1) == '/') --openESITags; - char * endofName = strpbrk(tag, w_space); + char * endofName = strpbrk(const_cast(tag), w_space); if (endofName > tagEnd) endofName = const_cast(tagEnd); @@ -139,7 +139,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool Vectorattributes; - char *attribute = endofName + 1; + char *attribute = const_cast(endofName + 1); while (attribute > tag && attribute < tagEnd) { /* leading spaces */ @@ -213,7 +213,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool if (tagEnd - tag > (ssize_t)remainingCount) return false; - char * endofName = strpbrk(tag, w_space); + char * endofName = strpbrk(const_cast(tag), w_space); if (endofName > tagEnd) endofName = const_cast(tagEnd); @@ -240,7 +240,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool /* Comments must not be nested, without CDATA * and we don't support CDATA */ - char *commentEnd = strstr (tag, "-->"); + char *commentEnd = strstr (const_cast(tag), "-->"); if (!commentEnd) { error = "missing end of comment"; diff --git a/src/ESIVarState.cc b/src/ESIVarState.cc index ca6cf6205c..8c82fcbdad 100644 --- a/src/ESIVarState.cc +++ b/src/ESIVarState.cc @@ -1,6 +1,6 @@ /* - * $Id: ESIVarState.cc,v 1.3 2003/08/04 22:14:40 robertc Exp $ + * $Id: ESIVarState.cc,v 1.4 2005/01/06 13:16:39 serassio Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -239,8 +239,8 @@ ESIVariableQuery::ESIVariableQuery(char const *uri) : query (NULL), query_sz (0) n = 0; while (query_pos) { - char *next = strchr (query_pos, '&'); - char *div = strchr (query_pos, '='); + char const *next = strchr (query_pos, '&'); + char const *div = strchr (query_pos, '='); if (next) ++next; diff --git a/src/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index a7e3aefe29..e454e1e8cb 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -1,5 +1,5 @@ /* - * $Id: auth_basic.cc,v 1.35 2004/12/24 01:03:39 hno Exp $ + * $Id: auth_basic.cc,v 1.36 2005/01/06 13:16:39 serassio Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -400,13 +400,15 @@ BasicUser::extractUsername() debug(29, 9) ("authenticateBasicDecodeAuth: cleartext = '%s'\n", cleartext); - username(xstrndup(cleartext, USER_IDENT_SZ)); + char * tempusername = xstrndup(cleartext, USER_IDENT_SZ); xfree(cleartext); /* terminate the username string */ - if ((cleartext = strchr(username(), ':')) != NULL) + if ((cleartext = strchr(tempusername, ':')) != NULL) *(cleartext)++ = '\0'; + username (tempusername); + if (!basicConfig.casesensitive) Tolower((char *)username()); } diff --git a/src/client.cc b/src/client.cc index 5d43b717f2..572ba6d29c 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1,6 +1,6 @@ /* - * $Id: client.cc,v 1.107 2004/04/03 15:10:56 hno Exp $ + * $Id: client.cc,v 1.108 2005/01/06 13:16:39 serassio Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived @@ -427,7 +427,7 @@ main(int argc, char *argv[]) /* Send the HTTP request */ #ifdef _SQUID_MSWIN_ - bytesWritten = send(conn, msg, strlen(msg), 0); + bytesWritten = send(conn, (const void *) msg, strlen(msg), 0); #else @@ -471,7 +471,7 @@ main(int argc, char *argv[]) #ifdef _SQUID_MSWIN_ setmode(1, O_BINARY); - while ((len = recv(conn, buf, sizeof(buf), 0)) > 0) { + while ((len = recv(conn, (void *) buf, sizeof(buf), 0)) > 0) { #else while ((len = myread(conn, buf, sizeof(buf))) > 0) { diff --git a/src/fd.cc b/src/fd.cc index 1c1243bada..f2fbf5e979 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -1,6 +1,6 @@ /* - * $Id: fd.cc,v 1.51 2004/12/27 10:25:32 robertc Exp $ + * $Id: fd.cc,v 1.52 2005/01/06 13:16:39 serassio Exp $ * * DEBUG: section 51 Filedescriptor Functions * AUTHOR: Duane Wessels @@ -111,7 +111,7 @@ fd_close(int fd) int socket_read_method(int fd, char *buf, int len) { - return (recv(fd, buf, len, 0)); + return (recv(fd, (void *) buf, len, 0)); } int @@ -123,7 +123,7 @@ file_read_method(int fd, char *buf, int len) int socket_write_method(int fd, const char *buf, int len) { - return (send(fd, buf, len, 0)); + return (send(fd, (const void *) buf, len, 0)); } int diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index 79c28998e3..22905fee39 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.57 2005/01/03 16:08:27 robertc Exp $ + * $Id: store_dir_coss.cc,v 1.58 2005/01/06 13:16:39 serassio Exp $ * vim: set et : * * DEBUG: section 47 Store COSS Directory Routines @@ -444,9 +444,10 @@ storeCossRebuildFromSwapLog(void *data) continue; } else { - x = log(++rb->counts.bad_log_op) / log(10.0); + x = log(static_cast(++rb->counts.bad_log_op)) / log(10.0); - if (0.0 == x - (double) (int) x) + if (0.0 == x - (double) + (int) x) debug(47, 1) ("WARNING: %d invalid swap log entries found\n", rb->counts.bad_log_op); diff --git a/src/fs/ufs/ufscommon.cc b/src/fs/ufs/ufscommon.cc index 075901823c..67d3b1c97a 100644 --- a/src/fs/ufs/ufscommon.cc +++ b/src/fs/ufs/ufscommon.cc @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.3 2005/01/03 16:08:27 robertc Exp $ + * $Id: ufscommon.cc,v 1.4 2005/01/06 13:16:39 serassio Exp $ * vim: set et : * * DEBUG: section 47 Store Directory Routines @@ -400,7 +400,7 @@ RebuildState::rebuildFromSwapLog() continue; } else { - x = ::log(++counts.bad_log_op) / ::log(10.0); + x = ::log(static_cast(++counts.bad_log_op)) / ::log(10.0); if (0.0 == x - (double) (int) x) debug(47, 1) ("WARNING: %d invalid swap log entries found\n", diff --git a/src/http.cc b/src/http.cc index de58e352e5..66ab3807bb 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.442 2005/01/03 16:08:26 robertc Exp $ + * $Id: http.cc,v 1.443 2005/01/06 13:16:39 serassio Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -801,7 +801,7 @@ no_cache: _peer->stats.n_keepalives_recv++; if (entry->getReply()->date > -1 && !_peer) { - int skew = abs(entry->getReply()->date - squid_curtime); + int skew = abs((int)(entry->getReply()->date - squid_curtime)); if (skew > 86400) debug(11, 3) ("%s's clock is skewed by %d seconds!\n", diff --git a/src/int.cc b/src/int.cc index 9e0b94c14e..9cdc2b3e1a 100644 --- a/src/int.cc +++ b/src/int.cc @@ -1,6 +1,6 @@ /* - * $Id: int.cc,v 1.2 2003/02/21 22:50:09 robertc Exp $ + * $Id: int.cc,v 1.3 2005/01/06 13:16:39 serassio Exp $ * * DEBUG: section 21 Integer functions * AUTHOR: Harvest Derived @@ -37,7 +37,7 @@ int isPowTen(int count) { - double x = log(count) / log(10.0); + double x = log(static_cast(count)) / log(10.0); if (0.0 != x - (double) (int) x) return 0; diff --git a/src/squid.h b/src/squid.h index af75e9b7ef..644eadfd57 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.244 2005/01/03 16:08:26 robertc Exp $ + * $Id: squid.h,v 1.245 2005/01/06 13:16:39 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -267,6 +267,13 @@ struct rusage #define getpagesize( ) sysconf(_SC_PAGE_SIZE) #endif +#if defined(_SQUID_MSWIN_) +/* Windows may lack getpagesize() prototype */ +#ifndef getpagesize +SQUIDCEXTERN size_t getpagesize(void); +#endif +#endif /* _SQUID_MSWIN_ */ + #ifndef BUFSIZ #define BUFSIZ 4096 /* make reasonable guess */ #endif