Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Sep 2002 11:07:42 -0400
From:      Craig Rodrigues <rodrigc@attbi.com>
To:        ijliao@freebsd.org
Cc:        freebsd-ports@freebsd.org
Subject:   archivers/zipio++ fixes for new compiler
Message-ID:  <20020907110742.A44438@attbi.com>

next in thread | raw e-mail | index | archive | help

--gBBFr7Ir9EOA20Yy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

Please accept this patch for archivers/zipio++.  It fixes
C++ compilation problems with GCC 3.2.

-- 
Craig Rodrigues        
http://www.gis.net/~craigr    
rodrigc@attbi.com

--gBBFr7Ir9EOA20Yy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-aa

diff -r -u ./src/deflateoutputstreambuf.cpp ../zipios++-0.1.5/src/deflateoutputstreambuf.cpp
--- ./src/deflateoutputstreambuf.cpp	Fri Aug 25 15:03:42 2000
+++ ../zipios++-0.1.5/src/deflateoutputstreambuf.cpp	Sat Sep  7 10:46:20 2002
@@ -7,6 +7,7 @@
 
 #include "zipios++/fcollexceptions.h"
 #include "zipios++/deflateoutputstreambuf.h"
+#include "outputstringstream.h"
 
 namespace zipios {
 
diff -r -u ./src/directory.h ../zipios++-0.1.5/src/directory.h
--- ./src/directory.h	Fri Aug  4 09:26:00 2000
+++ ../zipios++-0.1.5/src/directory.h	Sat Sep  7 10:46:20 2002
@@ -89,7 +89,7 @@
 			
 			class proxy
 			{
-				friend dir_it;
+				friend class dir_it;
 				proxy(std::string const &ent): entry(ent) {}
 			public:
 				std::string operator*() const { return entry; }
@@ -296,31 +296,33 @@
 
 		class unknown_uid: public std::invalid_argument
 		{
-		public:
-			unknown_uid(uid_t u): std::invalid_argument("unknown user ID"), m_uid(u) {}
-			uid_t uid() const { return m_uid; }
 		private:
 			uid_t m_uid;
+		public:
+			unknown_uid(uid_t u) throw() : std::invalid_argument("unknown user ID"), m_uid(u) {}
+			~unknown_uid() throw() {}
+			uid_t uid() const { return m_uid; }
 		};
 		struct uid { typedef uid_t value_type; };
 		template<> uid_t get<uid>(dir_it const &);
 		template<> void set<uid>(dir_it const &, uid_t);
-		class unknown_uname: public invalid_argument
+		class unknown_uname: public std::invalid_argument
 		{
-		public:
-			unknown_uname(string u): std::invalid_argument("unknown user name"), m_uname(u) {}
-			string uname() const { return m_uname; }
 		private:
-			string m_uname;
+			std::string m_uname;
+		public:
+			unknown_uname(std::string u) throw() : std::invalid_argument("unknown user name"), m_uname(u) {}
+			~unknown_uname() throw () {}
+			std::string uname() const { return m_uname; }
 		};
-		struct uname { typedef string value_type; };
-		template<> string get<uname>(dir_it const &);
-		template<> void set<uname>(dir_it const &, string );
+		struct uname { typedef std::string value_type; };
+		template<> std::string get<uname>(dir_it const &);
+		template<> void set<uname>(dir_it const &, std::string );
 
-		class unknown_gid: public invalid_argument
+		class unknown_gid: public std::invalid_argument
 		{
 		public:
-			unknown_gid(gid_t g): std::invalid_argument("unknown group ID"), m_gid(g) {}
+			unknown_gid(gid_t g) throw() : std::invalid_argument("unknown group ID"), m_gid(g) {}
 			gid_t gid() const { return m_gid; }
 		private:
 			gid_t m_gid;
@@ -328,17 +330,18 @@
 		struct gid { typedef gid_t value_type; };
 		template<> gid_t get<gid>(dir_it const &);
 		template<> void set<gid>(dir_it const &, gid_t);
-		class unknown_gname: public invalid_argument
+		class unknown_gname: public std::invalid_argument
 		{
 		public:
-			unknown_gname(string g): std::invalid_argument("unknown group name"), m_gname(g) {}
-			string gname() const { return m_gname; }
+			unknown_gname(std::string g) throw() : std::invalid_argument("unknown group name"), m_gname(g) {}
+			~unknown_gname() throw() {}
+			std::string gname() const { return m_gname; }
 		private:
-			string m_gname;
+			std::string m_gname;
 		};
-		struct gname { typedef string value_type; };
-		template<> string get<gname>(dir_it const &);
-		template<> void set<gname>(dir_it const &, string );
+		struct gname { typedef std::string value_type; };
+		template<> std::string get<gname>(dir_it const &);
+		template<> void set<gname>(dir_it const &, std::string );
 
 #endif
 
@@ -352,9 +355,9 @@
 	{
 	public:
 		typedef ptrdiff_t          difference_type;
-		typedef string             value_type;
-		typedef string             *pointer;
-		typedef string             &reference;
+		typedef std::string             value_type;
+		typedef std::string             *pointer;
+		typedef std::string             &reference;
 		typedef input_iterator_tag iterator_category;
 	};
 } // namespace std
diff -r -u ./src/zipios_common.h ../zipios++-0.1.5/src/zipios_common.h
--- ./src/zipios_common.h	Fri Aug  4 09:26:00 2000
+++ ../zipios++-0.1.5/src/zipios_common.h	Sat Sep  7 10:46:20 2002
@@ -13,7 +13,7 @@
 
 template< class Type >
 void operator += ( vector< Type > &v1, const vector< Type > &v2 ) {
-  std::vector<Type>::const_iterator cit ;
+  typename std::vector<Type>::const_iterator cit ;
   for ( cit = v2.begin() ; cit != v2.end() ; cit++ )
     v1.push_back( *cit ) ;
 }
diff -r -u ./tests/test_simplesmartptr.cpp ../zipios++-0.1.5/tests/test_simplesmartptr.cpp
--- ./tests/test_simplesmartptr.cpp	Sun Jul 15 15:51:14 2001
+++ ../zipios++-0.1.5/tests/test_simplesmartptr.cpp	Sat Sep  7 10:46:20 2002
@@ -26,8 +26,8 @@
   Bogus(bool &isAlive) : _isAlive(isAlive) {}
   ~Bogus() { _isAlive = false; }
 protected:
-  friend SimpleSmartPointer< Bogus > ;
-  friend SimpleSmartPointer< const Bogus > ;
+  friend class SimpleSmartPointer< Bogus > ;
+  friend class SimpleSmartPointer< const Bogus > ;
 
   void           ref() const { _refcount.ref() ;          }
   unsigned int unref() const { return _refcount.unref() ; }
diff -r -u ./zipios++/fileentry.h ../zipios++-0.1.5/zipios++/fileentry.h
--- ./zipios++/fileentry.h	Wed Aug 23 14:30:30 2000
+++ ../zipios++-0.1.5/zipios++/fileentry.h	Sat Sep  7 10:46:20 2002
@@ -166,8 +166,8 @@
   class MatchName ;
   class MatchFileName ;
 protected:
-  friend SimpleSmartPointer< FileEntry > ;
-  friend SimpleSmartPointer< const FileEntry > ;
+  friend class SimpleSmartPointer< FileEntry > ;
+  friend class SimpleSmartPointer< const FileEntry > ;
   void           ref() const { _refcount.ref() ;          }
   unsigned int unref() const { return _refcount.unref() ; }
 
diff -r -u ./zipios++/simplesmartptr.h ../zipios++-0.1.5/zipios++/simplesmartptr.h
--- ./zipios++/simplesmartptr.h	Sun Jul 15 15:42:34 2001
+++ ../zipios++-0.1.5/zipios++/simplesmartptr.h	Sat Sep  7 10:46:20 2002
@@ -99,13 +99,14 @@
 class ReferenceCount {
   /** SimpleSmartPointer needs to be a friend to invoke the private
       ref() and unref() methods.  */
-  friend SimpleSmartPointer< Type > ;
-  friend SimpleSmartPointer< const Type > ;
+  friend class SimpleSmartPointer< Type > ;
+  friend class SimpleSmartPointer< const Type > ;
   /** Type also needs to be a friend to invoke the private ref() and
       unref() methods, in case Type doesn't want to inherit
       ReferenceCount and thus needs to invoke ref() and unref()
       through forwarding member functions. */
-  friend Type ;
+  /* Note: template parameters cannot be friends */
+  //friend Type ;
 public:
   /** Constructor intializes count to zero. */
   ReferenceCount() : _ref_count( 0 ) {}
@@ -117,7 +118,6 @@
   /** The assignment operator doesn't copy the reference count, it
       leaves it unchanged.  */
   const ReferenceCount &operator= ( const ReferenceCount &src ) {}
-private:
 
   /** Increases the reference count. */
   void ref() const           { ++_ref_count ;        }
@@ -127,6 +127,8 @@
 
   /** Returns the reference count - For debugging purposes. */
   unsigned int getReferenceCount() const { return _ref_count; }
+
+private:
 
   /** Holds the actual reference count */
   mutable unsigned short _ref_count ;

--gBBFr7Ir9EOA20Yy--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020907110742.A44438>