win32 building of cgicc

Andy Shevchenko <[email protected]> Mon, 8 Sep 2003 12:44:59 +0300
Newsgroups gmane.comp.gcc.cgicc.bugs
Message-ID <[email protected]>
--IJpNTDwzlM2Ie8A6
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline

Hi!

I tyr to compile the cgicc project under windows 2000 by msvc6. However the building
is aborted by errors like this: "atoi not undefined in the
std namespace". I have written patch (see attached file_ 
for resolving the problem. Please, consider it and help me
later (may be i am doing something wrong?_)

Thank you!


Andy.

--IJpNTDwzlM2Ie8A6
Content-Type: text/plain; charset=koi8-r
Content-Disposition: attachment; filename="msvc6.patch"

diff -u -r cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/CgiEnvironment.cpp cgicc-3.2.2/cgicc/CgiEnvironment.cpp
--- cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/CgiEnvironment.cpp	2003-07-13 16:20:36.000000000 +0200
+++ cgicc-3.2.2/cgicc/CgiEnvironment.cpp	2003-09-06 09:58:59.000000000 +0200
@@ -138,7 +138,8 @@
   std::string::const_iterator data_iter;
   
   for(data_iter = data.begin(); data_iter != data.end(); ++data_iter,++wscount)
-    if(std::isspace(*data_iter) == 0)
+    //andy: if(std::isspace(*data_iter) == 0)
+    if(isspace(*data_iter) == 0)
       break;			
   
   // Per RFC 2091, do not unescape the data (thanks to [email protected])
@@ -151,41 +152,45 @@
 // Read in all the environment variables
 void
 cgicc::CgiEnvironment::readEnvironmentVariables(CgiInput *input)
-{
-  fServerSoftware 	= input->getenv("SERVER_SOFTWARE");
-  fServerName 		= input->getenv("SERVER_NAME");
-  fGatewayInterface 	= input->getenv("GATEWAY_INTERFACE");
-  fServerProtocol 	= input->getenv("SERVER_PROTOCOL");
-
-  std::string port 	= input->getenv("SERVER_PORT");
-  fServerPort 		= std::atol(port.c_str());
-
-  fRequestMethod 	= input->getenv("REQUEST_METHOD");
-  fPathInfo 		= input->getenv("PATH_INFO");
-  fPathTranslated 	= input->getenv("PATH_TRANSLATED");
-  fScriptName 		= input->getenv("SCRIPT_NAME");
-  fQueryString 		= input->getenv("QUERY_STRING");
-  fRemoteHost 		= input->getenv("REMOTE_HOST");
-  fRemoteAddr 		= input->getenv("REMOTE_ADDR");
-  fAuthType 		= input->getenv("AUTH_TYPE");
-  fRemoteUser 		= input->getenv("REMOTE_USER");
-  fRemoteIdent 		= input->getenv("REMOTE_IDENT");
-  fContentType 		= input->getenv("CONTENT_TYPE");
-
-  std::string length 	= input->getenv("CONTENT_LENGTH");
-  fContentLength 	= std::atol(length.c_str());
-
-  fAccept 		= input->getenv("HTTP_ACCEPT");
-  fUserAgent 		= input->getenv("HTTP_USER_AGENT");
-  fRedirectRequest 	= input->getenv("REDIRECT_REQUEST");
-  fRedirectURL 		= input->getenv("REDIRECT_URL");
-  fRedirectStatus 	= input->getenv("REDIRECT_STATUS");
-  fReferrer 		= input->getenv("HTTP_REFERER");
-  fCookie 		= input->getenv("HTTP_COOKIE");
+{
+  //andy: many strings are changed
+  // getenv -> _getenv
+  fServerSoftware 	= input->_getenv("SERVER_SOFTWARE");
+  fServerName 		= input->_getenv("SERVER_NAME");
+  fGatewayInterface 	= input->_getenv("GATEWAY_INTERFACE");
+  fServerProtocol 	= input->_getenv("SERVER_PROTOCOL");
+
+  std::string port 	= input->_getenv("SERVER_PORT");
+  ///andy: fServerPort 		= std::atol(port.c_str());
+  fServerPort 		= atol(port.c_str());
+
+  fRequestMethod 	= input->_getenv("REQUEST_METHOD");
+  fPathInfo 		= input->_getenv("PATH_INFO");
+  fPathTranslated 	= input->_getenv("PATH_TRANSLATED");
+  fScriptName 		= input->_getenv("SCRIPT_NAME");
+  fQueryString 		= input->_getenv("QUERY_STRING");
+  fRemoteHost 		= input->_getenv("REMOTE_HOST");
+  fRemoteAddr 		= input->_getenv("REMOTE_ADDR");
+  fAuthType 		= input->_getenv("AUTH_TYPE");
+  fRemoteUser 		= input->_getenv("REMOTE_USER");
+  fRemoteIdent 		= input->_getenv("REMOTE_IDENT");
+  fContentType 		= input->_getenv("CONTENT_TYPE");
+
+  std::string length 	= input->_getenv("CONTENT_LENGTH");
+  //andy: fContentLength 	= std::atol(length.c_str());
+  fContentLength 	= atol(length.c_str());
+
+  fAccept 		= input->_getenv("HTTP_ACCEPT");
+  fUserAgent 		= input->_getenv("HTTP_USER_AGENT");
+  fRedirectRequest 	= input->_getenv("REDIRECT_REQUEST");
+  fRedirectURL 		= input->_getenv("REDIRECT_URL");
+  fRedirectStatus 	= input->_getenv("REDIRECT_STATUS");
+  fReferrer 		= input->_getenv("HTTP_REFERER");
+  fCookie 		= input->_getenv("HTTP_COOKIE");
 
 #ifdef WIN32
   // Win32 bug fix by Peter Goedtkindt
-  std::string https 	= input->getenv("HTTPS");
+  std::string https 	= input->_getenv("HTTPS");
   if(stringsAreEqual(https, "on"))
     fUsingHTTPS = true;
   else
diff -u -r cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/CgiInput.cpp cgicc-3.2.2/cgicc/CgiInput.cpp
--- cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/CgiInput.cpp	2003-07-13 16:20:36.000000000 +0200
+++ cgicc-3.2.2/cgicc/CgiInput.cpp	2003-09-06 10:05:03.000000000 +0200
@@ -43,8 +44,10 @@
 }
 
 std::string
-cgicc::CgiInput::getenv(const char *varName)
+cgicc::CgiInput::_getenv(const char *varName)
 {
-  char *var = std::getenv(varName);
-  return (var == 0) ? std::string("") : var;
+  //andy: char *var = std::getenv(varName);
+  char *var = getenv(varName);
+  //andy: return (var == 0) ? std::string("") : var;
+  return (var == 0) ? std::string("") : std::string(var);
 }
diff -u -r cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/CgiInput.h cgicc-3.2.2/cgicc/CgiInput.h
--- cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/CgiInput.h	2003-07-13 16:20:36.000000000 +0200
+++ cgicc-3.2.2/cgicc/CgiInput.h	2003-09-06 09:59:15.000000000 +0200
@@ -153,7 +153,8 @@
      * \return The value of the requested environment variable, or an empty
      * string if not found.
      */
-    virtual std::string getenv(const char *varName);
+    //andy: virtual std::string getenv(const char *varName);
+    virtual std::string _getenv(const char *varName);
     //@}
   };
   
diff -u -r cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/CgiUtils.cpp cgicc-3.2.2/cgicc/CgiUtils.cpp
--- cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/CgiUtils.cpp	2003-07-13 16:20:36.000000000 +0200
+++ cgicc-3.2.2/cgicc/CgiUtils.cpp	2003-09-05 11:23:14.000000000 +0200
@@ -42,7 +42,8 @@
   std::string::const_iterator l2 = s2.end();
 
   while(p1 != l1 && p2 != l2) {
-    if(std::toupper(*(p1++)) != std::toupper(*(p2++)))
+    //andy: if(std::toupper(*(p1++)) != std::toupper(*(p2++)))
+    if(toupper(*(p1++)) != toupper(*(p2++)))
       return false;
   }
 
@@ -62,7 +63,8 @@
   std::string::const_iterator l2 = good ? (s2.begin() + n) : s2.end();
 
   while(p1 != l1 && p2 != l2) {
-    if(std::toupper(*(p1++)) != std::toupper(*(p2++)))
+    //andy: if(std::toupper(*(p1++)) != std::toupper(*(p2++)))
+    if(toupper(*(p1++)) != toupper(*(p2++)))
       return false;
   }
   
diff -u -r cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/FormEntry.cpp cgicc-3.2.2/cgicc/FormEntry.cpp
--- cgicc-3.2.2.orig/cgicc-3.2.2/cgicc/FormEntry.cpp	2003-07-13 16:20:36.000000000 +0200
+++ cgicc-3.2.2/cgicc/FormEntry.cpp	2003-09-05 11:21:59.000000000 +0200
@@ -43,7 +43,8 @@
 cgicc::FormEntry::getIntegerValue(long min, 
 				  long max) 		const
 {
-  long value = std::atol(fValue.c_str());
+  //andy: long value = std::atol(fValue.c_str());
+  long value = atol(fValue.c_str());
 
   if(value > max)
     value = max;
@@ -58,7 +59,8 @@
 				  long max,
 				  bool& bounded) 	const
 {
-  long value = std::atol(fValue.c_str());
+  //andy: long value = std::atol(fValue.c_str());
+  long value = atol(fValue.c_str());
 
   bounded = false;
 
@@ -78,7 +80,8 @@
 cgicc::FormEntry::getDoubleValue(double min, 
 				  double max) 		const
 {
-  double value = std::atof(fValue.c_str());
+  //andy: double value = std::atof(fValue.c_str());
+  double value = atof(fValue.c_str());
   if(value > max)
     value = max;
   else if(value < min)
@@ -92,7 +95,8 @@
 				 double max,
 				 bool& bounded) 	const
 {
-  double value = std::atof(fValue.c_str());
+  //andy: double value = std::atof(fValue.c_str());
+  double value = atof(fValue.c_str());
 
   bounded = false;
 
diff -u -r cgicc-3.2.2.orig/cgicc-3.2.2/example/example.cpp cgicc-3.2.2/example/example.cpp
--- cgicc-3.2.2.orig/cgicc-3.2.2/example/example.cpp	2002-12-04 18:04:08.000000000 +0100
+++ cgicc-3.2.2/example/example.cpp	2003-09-05 12:35:12.000000000 +0200
@@ -46,9 +46,12 @@
     cout << body() << html();
   }
   
-  catch(const exception& e) {
-    // handle error condition
-  }
+  //catch(const exception& e) {
+    // handle error condition
+  //}
+  catch(...) {
+    // handle error condition
+  }
   
   return 0;
 }
Only in cgicc-3.2.2/win: Debug
diff -u -r cgicc-3.2.2.orig/cgicc-3.2.2/win/cgicc.dsp cgicc-3.2.2/win/cgicc.dsp
--- cgicc-3.2.2.orig/cgicc-3.2.2/win/cgicc.dsp	2002-03-17 22:12:58.000000000 +0100
+++ cgicc-3.2.2/win/cgicc.dsp	2003-09-06 09:47:47.000000000 +0200
@@ -69,7 +69,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CGICC_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CGICC_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CGICC_EXPORTS" /FR /YX /FD /GZ /c
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
Only in cgicc-3.2.2/win: cgicc.ncb
Only in cgicc-3.2.2/win: cgicc.opt
Only in cgicc-3.2.2/win: cgicc.plg
Only in cgicc-3.2.2/win: example.dsw
Only in cgicc-3.2.2/win: example.ncb
Only in cgicc-3.2.2/win: example.opt
Only in cgicc-3.2.2/win: example.plg
Only in cgicc-3.2.2/win: example___Win32_Debug
Only in cgicc-3.2.2/win: test___Win32_Debug

--IJpNTDwzlM2Ie8A6
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
bug-cgicc mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/bug-cgicc

--IJpNTDwzlM2Ie8A6--