]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
MSVC fixup:
authorserassio <>
Thu, 6 Jan 2005 20:16:38 +0000 (20:16 +0000)
committerserassio <>
Thu, 6 Jan 2005 20:16:38 +0000 (20:16 +0000)
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

include/splay.h
src/ESICustomParser.cc
src/ESIVarState.cc
src/auth/basic/auth_basic.cc
src/client.cc
src/fd.cc
src/fs/coss/store_dir_coss.cc
src/fs/ufs/ufscommon.cc
src/http.cc
src/int.cc
src/squid.h

index 854c40926d3f1b0057cb8fd2cab882c24f4db935..49100d7d89bf87840b3620dc9cb5075ae8c631bd 100644 (file)
@@ -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<V>::size() const
 }
 
 template <class V>
-typename Splay<V>::const_iterator
+const SplayConstIterator<V>
 Splay<V>::begin() const
 {
     return const_iterator(head);
 }
 
 template <class V>
-typename Splay<V>::const_iterator
+const SplayConstIterator<V>
 Splay<V>::end() const
 {
     return const_iterator(NULL);
index 0183f260c366d397c5ed8e4a2b044388d62ff775..35d49051e51cf80759c80d819ae5a33adf6f6a16 100644 (file)
@@ -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<char *>(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<char *>(tag), w_space);
 
                 if (endofName > tagEnd)
                     endofName = const_cast<char *>(tagEnd);
@@ -139,7 +139,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool
 
                 Vector<char *>attributes;
 
-                char *attribute = endofName + 1;
+                char *attribute = const_cast<char *>(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<char *>(tag), w_space);
 
                 if (endofName > tagEnd)
                     endofName = const_cast<char *>(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<char *>(tag), "-->");
 
                 if (!commentEnd) {
                     error = "missing end of comment";
index ca6cf6205c6319e4d4369db5e738cc9b3302e86b..8c82fcbdad1a2aebc6d74e904e586ecbfbc71008 100644 (file)
@@ -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;
index a7e3aefe295308c6016b1218b7d7052c154394d3..e454e1e8cbbb97444790de0d276c0130cf27d93a 100644 (file)
@@ -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());
 }
index 5d43b717f2b23fe9b475bd6a04ce642c73ecb8a9..572ba6d29c13ed3dc653a0f7f1f56fbb4a84c0f1 100644 (file)
@@ -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) {
index 1c1243bada7f3aac85ed4b811783b01b2e7e591c..f2fbf5e9796e169567818e44e2a19531be8defd0 100644 (file)
--- 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
index 79c28998e39eb9af834300cc3b3f5deea65fb6c3..22905fee39fb040eb3e103d61433e3daf106494c 100644 (file)
@@ -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<double>(++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);
 
index 075901823c260696a3ffaa25933a5b6f7ac7171a..67d3b1c97a21231218a12b0e87a815c41e9a8df0 100644 (file)
@@ -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<double>(++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",
index de58e352e5cc424ac14e8107a4c9141739e08a16..66ab3807bb313e34b2c0699f7ea717ad0bb08c72 100644 (file)
@@ -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",
index 9e0b94c14e72d2e2ad8afc6c140af099b511cea2..9cdc2b3e1accdc78cd075715b41d528a494e22b8 100644 (file)
@@ -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<double>(count)) / log(10.0);
 
     if (0.0 != x - (double) (int) x)
         return 0;
index af75e9b7efcf995a8a77fd33b19c22ae6030547a..644eadfd57011bc437b4aca89f7e455038773095 100644 (file)
@@ -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