< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate] Namespace pollution from Contents.hxx


Hi,

Can somebody nuke the "using namespace std;" line from Contents.hxx?  It 
unnecessarily brings std into the global namespace when using resiprocate.

I've attached a patch that does this, and fixes up the following affected 
files that were missing the std:: for vector, endl and the like:

Contents.hxx
SipMessage.hxx
MultipartMixedContents.hxx
SdpContents.hxx
Helper.cxx
TransactionState.cxx
SipStack.cxx
dum/InviteSession.hxx

Thanks,
~Scott
Index: resiprocate/Contents.hxx
===================================================================
--- resiprocate/Contents.hxx	(revision 3646)
+++ resiprocate/Contents.hxx	(working copy)
@@ -12,7 +12,6 @@
 #include "resiprocate/os/Data.hxx"
 #include "resiprocate/os/HashMap.hxx"
 
-using namespace std;
 
 namespace resip
 {

Index: resiprocate/SipMessage.hxx
===================================================================
--- resiprocate/SipMessage.hxx	(revision 3646)
+++ resiprocate/SipMessage.hxx	(working copy)
@@ -281,7 +281,7 @@
       
       SipMessage& mergeUri(const Uri& source);      
 
-      void setSecurityAttributes(auto_ptr<SecurityAttributes>) const;
+      void setSecurityAttributes(std::auto_ptr<SecurityAttributes>) const;
       const SecurityAttributes* getSecurityAttributes() const { return mSecurityAttributes.get(); }
 
    protected:
@@ -347,7 +347,7 @@
       // domain associated with this message for tls cert
       Data mTlsDomain;
 
-      mutable auto_ptr<SecurityAttributes> mSecurityAttributes;
+      mutable std::auto_ptr<SecurityAttributes> mSecurityAttributes;
 
       friend class TransportSelector;
 };
Index: resiprocate/MultipartMixedContents.hxx
===================================================================
--- resiprocate/MultipartMixedContents.hxx	(revision 3646)
+++ resiprocate/MultipartMixedContents.hxx	(working copy)
@@ -28,7 +28,7 @@
       virtual std::ostream& encodeParsed(std::ostream& str) const;
       virtual void parse(ParseBuffer& pb);
 
-      typedef list<Contents*> Parts;
+      typedef std::list<Contents*> Parts;
       Parts& parts() {checkParsed(); return mContents;}
       const Parts& parts() const {checkParsed(); return mContents;}
 
Index: resiprocate/SdpContents.hxx
===================================================================
--- resiprocate/SdpContents.hxx	(revision 3646)
+++ resiprocate/SdpContents.hxx	(working copy)
@@ -25,8 +25,8 @@
       AttributeHelper& operator=(const AttributeHelper& rhs);
       
       bool exists(const Data& key) const;
-      const vector<Data>& getValues(const Data& key) const;
-      ostream& encode(ostream& s) const;
+      const std::vector<Data>& getValues(const Data& key) const;
+      std::ostream& encode(std::ostream& s) const;
       void parse(ParseBuffer& pb);
       void addAttribute(const Data& key, const Data& value = Data::Empty);
       void clearAttribute(const Data& key);
@@ -384,7 +384,7 @@
                   const Encryption& encryption() const {return mEncryption;}
                   Encryption& encryption() {return mEncryption;}
                   bool exists(const Data& key) const;
-                  const vector<Data>& getValues(const Data& key) const;
+                  const std::vector<Data>& getValues(const Data& key) const;
                   void clearAttribute(const Data& key);
 
                private:
@@ -396,7 +396,7 @@
                   unsigned long mMulticast;
                   Data mProtocol;
                   mutable std::vector<Data> mFormats;
-                  mutable vector<Codec> mCodecs;
+                  mutable std::vector<Codec> mCodecs;
                   Data mTransport;
                   Data mInformation;
                   std::vector<Connection> mConnections;
@@ -455,7 +455,7 @@
             void clearAttribute(const Data& key);
             void addAttribute(const Data& key, const Data& value = Data::Empty);
             bool exists(const Data& key) const;
-            const vector<Data>& getValues(const Data& key) const;
+            const std::vector<Data>& getValues(const Data& key) const;
 
          private:            
             int mVersion;
Index: resiprocate/Helper.cxx
===================================================================
--- resiprocate/Helper.cxx	(revision 3646)
+++ resiprocate/Helper.cxx	(working copy)
@@ -977,7 +977,7 @@
                                          sep.size() + 1 
                                          + aor.size() ) % 8))
                                % 8));
-   auto_ptr <unsigned char> out(new unsigned char[token.size()]);
+   std::auto_ptr <unsigned char> out(new unsigned char[token.size()]);
    BF_cbc_encrypt((const unsigned char*)token.data(),
                   out.get(),
                   token.size(),
@@ -1017,7 +1017,7 @@
 
    const Data decoded = gruu.base64decode();
 
-   auto_ptr <unsigned char> out(new unsigned char[gruuUserPart.size()+1]);
+   std::auto_ptr <unsigned char> out(new unsigned char[gruuUserPart.size()+1]);
    BF_cbc_encrypt((const unsigned char*)decoded.data(),
                   out.get(),
                   decoded.size(),
Index: resiprocate/TransactionState.cxx
===================================================================
--- resiprocate/TransactionState.cxx	(revision 3646)
+++ resiprocate/TransactionState.cxx	(working copy)
@@ -698,7 +698,7 @@
 
          case Timer::TimerCleanUp:
             // !ah! Cancelled Invite Cleanup Timer fired.
-            StackLog (<< "Timer::TimerCleanUp: " << *this << endl << *mMsgToRetransmit);
+            StackLog (<< "Timer::TimerCleanUp: " << *this << std::endl << *mMsgToRetransmit);
             if (mState == Proceeding)
             {
                assert(mMsgToRetransmit && mMsgToRetransmit->header(h_RequestLine).getMethod() == INVITE);
Index: resiprocate/SipStack.cxx
===================================================================
--- resiprocate/SipStack.cxx	(revision 3646)
+++ resiprocate/SipStack.cxx	(working copy)
@@ -366,21 +366,21 @@
 {
    Lock lock(mAppTimerMutex);
    strm << "SipStack: " << (this->mStrictRouting ? "strict router " : "loose router ")
-        << endl
+        << std::endl
         << "domains: " << Inserter(this->mDomains)
-        << endl
-        << " TUFifo size=" << this->mTUFifo.size() << endl
-        << " Timers size=" << this->mTransactionController.mTimers.size() << endl
-        << " AppTimers size=" << this->mAppTimers.size() << endl
-        << " ServerTransactionMap size=" << this->mTransactionController.mServerTransactionMap.size() << endl
-        << " ClientTransactionMap size=" << this->mTransactionController.mClientTransactionMap.size() << endl
-        << " Exact Transports=" << Inserter(this->mTransactionController.mTransportSelector.mExactTransports) << endl
-        << " Any Transports=" << Inserter(this->mTransactionController.mTransportSelector.mAnyInterfaceTransports) << endl;
+        << std::endl
+        << " TUFifo size=" << this->mTUFifo.size() << std::endl
+        << " Timers size=" << this->mTransactionController.mTimers.size() << std::endl
+        << " AppTimers size=" << this->mAppTimers.size() << std::endl
+        << " ServerTransactionMap size=" << this->mTransactionController.mServerTransactionMap.size() << std::endl
+        << " ClientTransactionMap size=" << this->mTransactionController.mClientTransactionMap.size() << std::endl
+        << " Exact Transports=" << Inserter(this->mTransactionController.mTransportSelector.mExactTransports) << std::endl
+        << " Any Transports=" << Inserter(this->mTransactionController.mTransportSelector.mAnyInterfaceTransports) << std::endl;
    return strm;
 }
 
 std::ostream& 
-resip::operator<<(ostream& strm, const SipStack& stack) 
+resip::operator<<(std::ostream& strm, const SipStack& stack) 
 {
    return stack.dump(strm);
 }
Index: resiprocate/dum/InviteSession.hxx
===================================================================
--- resiprocate/dum/InviteSession.hxx	(revision 3646)
+++ resiprocate/dum/InviteSession.hxx	(working copy)
@@ -61,7 +61,7 @@
       const SdpContents* getLocalSdp() const;
       const SdpContents* getRemoteSdp() const;
 
-      virtual SipMessage& makeInfo(auto_ptr<Contents> contents);
+      virtual SipMessage& makeInfo(std::auto_ptr<Contents> contents);
 
    public:
       virtual void dispatch(const SipMessage& msg);
@@ -134,7 +134,7 @@
       SipMessage mLastResponse;
       SipMessage mLastNit;      
 
-      typedef map<int, SipMessage> CSeqToMessageMap;
+      typedef std::map<int, SipMessage> CSeqToMessageMap;
       CSeqToMessageMap mAckMap;
       CSeqToMessageMap mFinalResponseMap;