diff --git a/Envy/AlbumFolder.cpp b/Envy/AlbumFolder.cpp index 0226ff3..337c549 100644 --- a/Envy/AlbumFolder.cpp +++ b/Envy/AlbumFolder.cpp @@ -1,7 +1,7 @@ // // AlbumFolder.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -1347,7 +1347,7 @@ void CAlbumFolder::Serialize(CArchive& ar, int nVersion) while ( nCount-- > 0 ) { - auto_ptr< CAlbumFolder > pFolder( new CAlbumFolder( this, NULL, (LPCTSTR)1 ) ); + unique_ptr< CAlbumFolder > pFolder( new CAlbumFolder( this, NULL, (LPCTSTR)1 ) ); pFolder->Serialize( ar, nVersion ); m_pFolders.AddTail( pFolder.release() ); } diff --git a/Envy/Augment/Augment.hpp b/Envy/Augment/Augment.hpp deleted file mode 100644 index 8c33f92..0000000 --- a/Envy/Augment/Augment.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// Augment/Augment.hpp -// -// This file is part of Envy (getenvy.com) © 2016 -// Portions copyright PeerProject 2008-2010 and Shareaza 2002-2007 -// -// Envy is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation (fsf.org); -// either version 3 of the License, or later version (at your option). -// -// Envy is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// See the GNU General Public License for more details. -// (http://www.gnu.org/licenses/gpl.html) -// -// - -#pragma once - -namespace augment -{ - - template - T implicit_cast(U u) - { - return u; - } - -} // namespace augment - -#include "auto_ptr.hpp" -#include "auto_array.hpp" -#include "IUnknownImplementation.hpp" diff --git a/Envy/Augment/auto_ptr.hpp b/Envy/Augment/auto_ptr.hpp deleted file mode 100644 index c1c6299..0000000 --- a/Envy/Augment/auto_ptr.hpp +++ /dev/null @@ -1,168 +0,0 @@ -// -// Augment/auto_ptr.hpp -// -// This file is part of Envy (getenvy.com) © 2016 -// Portions copyright PeerProject 2008-2014 and Shareaza 2002-2007 -// -// Envy is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation (fsf.org); -// either version 3 of the License, or later version (at your option). -// -// Envy is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// See the GNU General Public License for more details. -// (http://www.gnu.org/licenses/gpl.html) -// -// - -#pragma once - -//#if defined(_MSC_VER) && (_MSC_FULL_VER > 150030000) // VS2008 SP1 for tr1, VS2012 for std -#include // std::tr1::is_same<> - -//#include // Use tr1 above -//#include // Was boost::checked_delete() - - -namespace augment -{ - - // delete, with compile-time type check, from boost::checked_delete.hpp: - template inline void checked_delete(T * x) - { -#ifdef _DEBUG - // Intentionally complex, simplification causes regressions - typedef char type_must_be_complete[ sizeof(T) ? 1 : -1 ]; - (void) sizeof(type_must_be_complete); -#endif - delete x; - } - - template - class auto_ptr_ref - { - template friend class auto_ptr; - explicit auto_ptr_ref(const void** ref, element_type* ptr) throw() - : ref_( ref ), ptr_( ptr ) - {} - element_type* release() throw() - { - *ref_ = NULL; - return ptr_; - } - const void** ref_; - element_type* ptr_; - }; - - template - class auto_ptr_ref< element_type, true > - { - template friend class auto_ptr; - explicit auto_ptr_ref(const void** ref, element_type*) throw() - : ref_( ref ) - {} - element_type* release() throw() - { - element_type* ptr = const_cast< element_type* >( - static_cast< const element_type* >( *ref_ ) ); - *ref_ = NULL; - return ptr; - } - const void** ref_; - }; - - // ToDo: Is this still necessary? - // Replacement for std::auto_ptr - // Avoids bugs in the standard library of vc++7.1 and vc++8.0, namely: - // - undefined behaviour if used for upcasts in the presence of multiple or virtual inheritance - // - vc++7.1 does not allow upcasts from rvalues - // - vc++8.0 allows implicit creation of auto_ptr_ref from arbitray pointers in certain situations, - // but those auto_ptr_ref do not refer to auto_ptr - template - class auto_ptr - { - public: - typedef T element_type; - explicit auto_ptr(element_type* ptr = NULL) throw() - : ptr_( ptr ) - {} - auto_ptr(auto_ptr& other) throw() - : ptr_( other.release() ) - {} - template - auto_ptr(auto_ptr< source_element_type >& other) throw() - : ptr_( implicit_cast< element_type* >( other.release() ) ) - {} - auto_ptr(auto_ptr_ref< element_type, false > other) throw() - : ptr_( other.release() ) - {} - auto_ptr(auto_ptr_ref< element_type, true > other) throw() - : ptr_( other.release() ) - {} - ~auto_ptr() throw() - { - if ( get() != NULL ) - checked_delete( get() ); // Was boost::checked_delete - }; - - auto_ptr& operator=(auto_ptr& other) throw() - { - reset( other.release() ); - return *this; - } - template - auto_ptr& operator=(auto_ptr< source_element_type >& other) throw() - { - reset( other.release() ); - return *this; - } - auto_ptr& operator=(auto_ptr_ref< element_type, false > other) throw() - { - reset( other.release() ); - return *this; - } - auto_ptr& operator=(auto_ptr_ref< element_type, true > other) throw() - { - reset( other.release() ); - return *this; - } - - element_type* get() const throw() - { - return const_cast< element_type* >( static_cast< const element_type* >( ptr_ ) ); - } - element_type& operator*() const throw() - { - return *get(); - } - element_type* operator->() const throw() - { - return get(); - } - element_type* release() throw() - { - element_type* ptr = get(); - ptr_ = NULL; - return ptr; - } - void reset(element_type* ptr = NULL) throw() - { - if ( ptr != get() && get() != NULL ) - checked_delete( get() ); // Was boost::checked_delete - ptr_ = ptr; - } - - template - operator auto_ptr_ref< target_element_type, - std::tr1::is_same< target_element_type, element_type >::value >() throw() - { - return auto_ptr_ref< target_element_type, - std::tr1::is_same< target_element_type, element_type >::value >( &ptr_, get() ); - } - private: - const void* ptr_; - }; - -} // namespace augment diff --git a/Envy/BENode.cpp b/Envy/BENode.cpp index c30c290..bf56e70 100644 --- a/Envy/BENode.cpp +++ b/Envy/BENode.cpp @@ -1,7 +1,7 @@ // // BENode.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -114,7 +114,7 @@ CBENode* CBENode::Add(LPCBYTE pKey, size_t nKey) break; } -// auto_ptr< CBENode > pNew( new CBENode ); +// unique_ptr< CBENode > pNew( new CBENode ); // CBENode* pNew_ = pNew.get(); CAutoPtr< CBENode > pNew( new CBENode ); diff --git a/Envy/BTInfo.cpp b/Envy/BTInfo.cpp index 60161ee..601fcc2 100644 --- a/Envy/BTInfo.cpp +++ b/Envy/BTInfo.cpp @@ -1,7 +1,7 @@ // // BTInfo.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -685,7 +685,7 @@ BOOL CBTInfo::CheckInfoData() if ( ! m_pSource.m_nLength ) return FALSE; - auto_ptr< CBENode > pNode ( CBENode::Decode( &m_pSource ) ); + unique_ptr< CBENode > pNode ( CBENode::Decode( &m_pSource ) ); if ( ! pNode.get() ) return FALSE; @@ -717,7 +717,7 @@ BOOL CBTInfo::CheckInfoData() BOOL CBTInfo::LoadTorrentBuffer(const CBuffer* pBuffer) { - auto_ptr< CBENode > pNode ( CBENode::Decode( pBuffer ) ); + unique_ptr< CBENode > pNode ( CBENode::Decode( pBuffer ) ); if ( ! pNode.get() ) { theApp.Message( MSG_ERROR, L"[BT] Failed to decode torrent data: %s", pBuffer->ReadString( (size_t)-1 ) ); diff --git a/Envy/BTPacket.h b/Envy/BTPacket.h index 69c3e09..b80191b 100644 --- a/Envy/BTPacket.h +++ b/Envy/BTPacket.h @@ -1,7 +1,7 @@ // // BTPacket.h // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -132,7 +132,7 @@ class CBTPacket : public CPacket public: BYTE m_nType; BYTE m_nExtension; // Extension type if packet type is a BT_PACKET_EXTENSION - auto_ptr< CBENode > m_pNode; // Extension decoded data + unique_ptr< CBENode > m_pNode; // Extension decoded data public: virtual void Reset(); diff --git a/Envy/CollectionFile.cpp b/Envy/CollectionFile.cpp index 927c2c7..eb7a2ae 100644 --- a/Envy/CollectionFile.cpp +++ b/Envy/CollectionFile.cpp @@ -1,7 +1,7 @@ // // CollectionFile.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -191,10 +191,10 @@ BOOL CCollectionFile::LoadCollection(LPCTSTR pszFile) if ( pZIP.GetCount() == 1 ) // xml-only m_nType = SimpleCollection; - auto_ptr< CBuffer > pBuffer ( pFile->Decompress() ); + unique_ptr< CBuffer > pBuffer ( pFile->Decompress() ); if ( ! pBuffer.get() ) return FALSE; - auto_ptr< CXMLElement > pXML ( CXMLElement::FromString( pBuffer->ReadString( pBuffer->m_nLength, CP_UTF8 ), TRUE ) ); + unique_ptr< CXMLElement > pXML ( CXMLElement::FromString( pBuffer->ReadString( pBuffer->m_nLength, CP_UTF8 ), TRUE ) ); if ( ! pXML.get() ) return FALSE; if ( ! pXML->IsNamed( L"collection" ) ) return FALSE; @@ -209,7 +209,7 @@ BOOL CCollectionFile::LoadCollection(LPCTSTR pszFile) CXMLElement* pElement = pContents->GetNextElement( pos ); if ( pElement->IsNamed( L"file" ) ) { - auto_ptr< File > pNewFile( new File( this ) ); + unique_ptr< File > pNewFile( new File( this ) ); if ( pNewFile.get() && pNewFile->Parse( pElement ) ) m_pFiles.AddTail( pNewFile.release() ); } @@ -289,7 +289,7 @@ BOOL CCollectionFile::LoadEMule(LPCTSTR pszFile) { for ( DWORD i = 0 ; i < nFileCount ; ++i ) { - auto_ptr< File > pCollectionFile( new File( this ) ); + unique_ptr< File > pCollectionFile( new File( this ) ); if ( pCollectionFile.get() && pCollectionFile->Parse( pFile ) ) m_pFiles.AddTail( pCollectionFile.release() ); else @@ -332,7 +332,7 @@ BOOL CCollectionFile::LoadDC(LPCTSTR pszFile) if ( ! pBuffer.UnBZip() ) return FALSE; // Decompression error - auto_ptr< CXMLElement > pXML ( CXMLElement::FromString( pBuffer.ReadString( pBuffer.m_nLength, CP_UTF8 ), TRUE ) ); + unique_ptr< CXMLElement > pXML ( CXMLElement::FromString( pBuffer.ReadString( pBuffer.m_nLength, CP_UTF8 ), TRUE ) ); if ( ! pXML.get() ) return FALSE; // XML decoding error @@ -363,7 +363,7 @@ void CCollectionFile::LoadDC(CXMLElement* pRoot) { // - auto_ptr< File > pNewFile( new File( this ) ); + unique_ptr< File > pNewFile( new File( this ) ); if ( pNewFile.get() && pNewFile->Parse( pElement ) ) m_pFiles.AddTail( pNewFile.release() ); } @@ -396,7 +396,7 @@ BOOL CCollectionFile::LoadText(LPCTSTR pszFile) if ( ! pFile.ReadString( strText ) ) break; // End of file - auto_ptr< File > pCollectionFile( new File( this ) ); + unique_ptr< File > pCollectionFile( new File( this ) ); if ( ! pCollectionFile.get() ) break; // Out of memory diff --git a/Envy/ComboListCtrl.cpp b/Envy/ComboListCtrl.cpp index 90bc6af..190506b 100644 --- a/Envy/ComboListCtrl.cpp +++ b/Envy/ComboListCtrl.cpp @@ -1,7 +1,7 @@ // // ComboListCtrl.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2012 and Shareaza 2008 // // Envy is free software. You may redistribute and/or modify it @@ -19,158 +19,160 @@ // This file is not used. // (Extra features not needed by PageTorrentFiles) -#include "StdAfx.h" -#include "Settings.h" -#include "Envy.h" -#include "ComboListCtrl.h" - - -IMPLEMENT_DYNAMIC(CComboListCtrl, CListCtrl) - -CComboListCtrl::CComboListCtrl() - : m_iSelectedItem ( -1 ) - , m_iSelectedSubItem( -1 ) - , m_pCombo ( NULL ) -{ - EnableActiveAccessibility(); -} - -CComboListCtrl::~CComboListCtrl() -{ -} - -int CComboListCtrl::GetColumnData(int iItem, int iColumn) const -{ - CIntIntMap::const_iterator i = m_oData[ iItem ].find( iColumn ); - return (*i).second; -} - -void CComboListCtrl::SetColumnData(int iItem, int iColumn, int iData) -{ - if ( iItem >= (int)m_oData.size() ) - m_oData.resize( iItem + 1 ); - m_oData[ iItem ].insert( CIntIntMap::value_type( iColumn, iData ) ); - - CIntIntStringMapMap::const_iterator column = m_oColumns.find( iColumn ); - CIntStringMap::const_iterator value = (*column).second.find( iData ); - SetItemText( iItem, iColumn, (*value).second ); -} - -void CComboListCtrl::SetColumnValues(int iColumn, const CIntStringMap& oValues) -{ - m_oColumns.insert( CIntIntStringMapMap::value_type( iColumn, oValues ) ); -} - +//#include "StdAfx.h" +//#include "Settings.h" +//#include "Envy.h" +//#include "ComboListCtrl.h" +// +// +//IMPLEMENT_DYNAMIC(CComboListCtrl, CListCtrl) +// +//CComboListCtrl::CComboListCtrl() +// : m_iSelectedItem ( -1 ) +// , m_iSelectedSubItem( -1 ) +// , m_pCombo ( NULL ) +//{ +// EnableActiveAccessibility(); +//} +// +//CComboListCtrl::~CComboListCtrl() +//{ +//} +// +//int CComboListCtrl::GetColumnData(int iItem, int iColumn) const +//{ +// CIntIntMap::const_iterator i = m_oData[ iItem ].find( iColumn ); +// return (*i).second; +//} +// +//void CComboListCtrl::SetColumnData(int iItem, int iColumn, int iData) +//{ +// if ( iItem >= (int)m_oData.size() ) +// m_oData.resize( iItem + 1 ); +// m_oData[ iItem ].insert( CIntIntMap::value_type( iColumn, iData ) ); +// +// CIntIntStringMapMap::const_iterator column = m_oColumns.find( iColumn ); +// CIntStringMap::const_iterator value = (*column).second.find( iData ); +// SetItemText( iItem, iColumn, (*value).second ); +//} +// +//void CComboListCtrl::SetColumnValues(int iColumn, const CIntStringMap& oValues) +//{ +// m_oColumns.insert( CIntIntStringMapMap::value_type( iColumn, oValues ) ); +//} +// /////////////////////////////////////////////////////////////////////////////// -// DISABLED: Priority Column Dropdown Boxes, and Custom Hover ToolTips - -BEGIN_MESSAGE_MAP(CComboListCtrl, CListCtrl) - ON_NOTIFY_REFLECT(NM_CLICK, &CComboListCtrl::OnNMClick) - ON_WM_MOUSEMOVE() -END_MESSAGE_MAP() - -// CComboListCtrl message handlers - -void CComboListCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult) -{ - LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast( pNMHDR ); - *pResult = 0; - - Hide(); - - int iItem = HitTest( pNMItemActivate->ptAction ); - if ( iItem >= 0 && pNMItemActivate->iSubItem > 0 ) - Show( iItem, pNMItemActivate->iSubItem ); -} - -int CComboListCtrl::HitTest(const CPoint& ptAction) -{ - CPoint pt( 16, ptAction.y ); - UINT flags = 0; - return CListCtrl::HitTest( pt, &flags ); -} - -void CComboListCtrl::OnMouseMove(UINT nFlags, CPoint point) -{ - if ( m_pCombo ) - { - if ( m_pTip.get() ) m_pTip->Hide(); - - CPoint pt; - GetCursorPos( &pt ); - CRect rc; - m_pCombo->GetWindowRect( rc ); - if ( ! rc.PtInRect( pt ) ) - Hide(); - } - else if ( m_pTip.get() ) - { - int iItem = HitTest( point ); - if ( iItem >= 0 ) - m_pTip->Show( (CEnvyFile*)GetItemData( iItem ) ); - else - m_pTip->Hide(); - } - CListCtrl::OnMouseMove(nFlags, point); -} - -void CComboListCtrl::Show(int iItem, int iSubItem) -{ - CIntIntStringMapMap::const_iterator column = m_oColumns.find( iSubItem ); - if ( column != m_oColumns.end() ) - { - CIntIntMap::const_iterator data = m_oData[ iItem ].find( iSubItem ); - - CRect rc; - if ( GetSubItemRect( iItem, iSubItem, LVIR_BOUNDS, rc ) ) - { - m_pCombo = new CComboBox(); - m_pCombo->Create( WS_CHILD | WS_VISIBLE | WS_BORDER | CBS_DROPDOWNLIST, rc, this, 100 ); - m_pCombo->SetFont( GetFont() ); - - int n = 0, nSelected = 0; - for ( CIntStringMap::const_iterator i = (*column).second.begin() ; - i != (*column).second.end() ; ++i, ++n ) - { - m_pCombo->AddString( (*i).second ); - if ( (*i).first == (*data).second ) - nSelected = n; - } - m_pCombo->SetCurSel( nSelected ); - m_pCombo->SetFocus(); - m_pCombo->ShowDropDown(); - m_iSelectedItem = iItem; - m_iSelectedSubItem = iSubItem; - } - } -} - -void CComboListCtrl::Hide() -{ - if ( m_pCombo ) - { - CIntIntStringMapMap::const_iterator column = - m_oColumns.find( m_iSelectedSubItem ); - CIntStringMap::const_iterator value = (*column).second.begin(); - const int nSelected = m_pCombo->GetCurSel(); - for ( int i = 0 ; i != nSelected ; ++value, ++i ); - - m_oData[ m_iSelectedItem ].erase( m_iSelectedSubItem ); - m_oData[ m_iSelectedItem ].insert( - CIntIntMap::value_type( m_iSelectedSubItem, (*value).first ) ); - - SetItemText( m_iSelectedItem, m_iSelectedSubItem, (*value).second ); - - m_pCombo->DestroyWindow(); - delete m_pCombo; - m_pCombo = NULL; - - m_iSelectedItem = -1; - m_iSelectedSubItem = -1; - } -} - -void CComboListCtrl::EnableTips(auto_ptr< CLibraryTipCtrl > pTip) -{ - m_pTip = pTip; -} +//// DISABLED: Priority Column Dropdown Boxes, and Custom Hover ToolTips +// +//BEGIN_MESSAGE_MAP(CComboListCtrl, CListCtrl) +// ON_NOTIFY_REFLECT(NM_CLICK, &CComboListCtrl::OnNMClick) +// ON_WM_MOUSEMOVE() +//END_MESSAGE_MAP() +// +//// CComboListCtrl message handlers +// +//void CComboListCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult) +//{ +// LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast( pNMHDR ); +// *pResult = 0; +// +// Hide(); +// +// int iItem = HitTest( pNMItemActivate->ptAction ); +// if ( iItem >= 0 && pNMItemActivate->iSubItem > 0 ) +// Show( iItem, pNMItemActivate->iSubItem ); +//} +// +//int CComboListCtrl::HitTest(const CPoint& ptAction) +//{ +// CPoint pt( 16, ptAction.y ); +// UINT flags = 0; +// return CListCtrl::HitTest( pt, &flags ); +//} +// +//void CComboListCtrl::OnMouseMove(UINT nFlags, CPoint point) +//{ +// if ( m_pCombo ) +// { +// if ( m_pTip.get() ) m_pTip->Hide(); +// +// CPoint pt; +// GetCursorPos( &pt ); +// CRect rc; +// m_pCombo->GetWindowRect( rc ); +// if ( ! rc.PtInRect( pt ) ) +// Hide(); +// } +// else if ( m_pTip.get() ) +// { +// int iItem = HitTest( point ); +// if ( iItem >= 0 ) +// m_pTip->Show( (CEnvyFile*)GetItemData( iItem ) ); +// else +// m_pTip->Hide(); +// } +// CListCtrl::OnMouseMove(nFlags, point); +//} +// +//void CComboListCtrl::Show(int iItem, int iSubItem) +//{ +// CIntIntStringMapMap::const_iterator column = m_oColumns.find( iSubItem ); +// if ( column != m_oColumns.end() ) +// { +// CIntIntMap::const_iterator data = m_oData[ iItem ].find( iSubItem ); +// +// CRect rc; +// if ( GetSubItemRect( iItem, iSubItem, LVIR_BOUNDS, rc ) ) +// { +// m_pCombo = new CComboBox(); +// m_pCombo->Create( WS_CHILD | WS_VISIBLE | WS_BORDER | CBS_DROPDOWNLIST, rc, this, 100 ); +// m_pCombo->SetFont( GetFont() ); +// +// int n = 0, nSelected = 0; +// for ( CIntStringMap::const_iterator i = (*column).second.begin() ; +// i != (*column).second.end() ; ++i, ++n ) +// { +// m_pCombo->AddString( (*i).second ); +// if ( (*i).first == (*data).second ) +// nSelected = n; +// } +// m_pCombo->SetCurSel( nSelected ); +// m_pCombo->SetFocus(); +// m_pCombo->ShowDropDown(); +// m_iSelectedItem = iItem; +// m_iSelectedSubItem = iSubItem; +// } +// } +//} +// +//void CComboListCtrl::Hide() +//{ +// if ( m_pCombo ) +// { +// CIntIntStringMapMap::const_iterator column = m_oColumns.find( m_iSelectedSubItem ); +// CIntStringMap::const_iterator value = (*column).second.begin(); +// const int nSelected = m_pCombo->GetCurSel(); +// for ( int i = 0 ; i != nSelected ; ++value, ++i ); +// +// m_oData[ m_iSelectedItem ].erase( m_iSelectedSubItem ); +// m_oData[ m_iSelectedItem ].insert( CIntIntMap::value_type( m_iSelectedSubItem, (*value).first ) ); +// +// SetItemText( m_iSelectedItem, m_iSelectedSubItem, (*value).second ); +// +// m_pCombo->DestroyWindow(); +// delete m_pCombo; +// m_pCombo = NULL; +// +// m_iSelectedItem = -1; +// m_iSelectedSubItem = -1; +// } +//} +// +//void CComboListCtrl::EnableTips(unique_ptr< CLibraryTipCtrl > pTip) +//{ +//#if !defined(_MSC_VER) || (_MSC_VER >= 1600) // VS2010+ +// m_pTip = std::move( pTip ); +//#else // VS2008 +// m_pTip = pTip; +//#endif +//} diff --git a/Envy/ComboListCtrl.h b/Envy/ComboListCtrl.h index fe8d97b..24ca23d 100644 --- a/Envy/ComboListCtrl.h +++ b/Envy/ComboListCtrl.h @@ -18,53 +18,53 @@ // Note: This file is not currently used. -#pragma once - -#include "CtrlLibraryTip.h" - - -class CComboListCtrl : public CListCtrl -{ - DECLARE_DYNAMIC(CComboListCtrl) - -public: - CComboListCtrl(); - virtual ~CComboListCtrl(); - -public: - typedef std::map< int, CString > CIntStringMap; - typedef std::map< int, int > CIntIntMap; - typedef std::vector< CIntIntMap > CIntIntMapVector; - typedef std::map< int, CIntStringMap > CIntIntStringMapMap; - - int GetColumnData(int iItem, int iColumn) const; - void SetColumnData(int iItem, int iColumn, int iData); - void SetColumnValues(int iColumn, const CIntStringMap& oValues); - void EnableTips(auto_ptr< CLibraryTipCtrl > pTip); - -protected: - auto_ptr< CLibraryTipCtrl > m_pTip; - CComboBox* m_pCombo; - int m_iSelectedItem; - int m_iSelectedSubItem; - CIntIntMapVector m_oData; - CIntIntStringMapMap m_oColumns; - - int HitTest(const CPoint& ptAction); - void Show(int iItem, int iSubItem); - void Hide(); - - afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - - DECLARE_MESSAGE_MAP() -}; - -#define BEGIN_COLUMN_MAP() \ - { CComboListCtrl::CIntStringMap x; - -#define COLUMN_MAP(nValue, nString) \ - x.insert( CComboListCtrl::CIntStringMap::value_type( (nValue), (nString) ) ); - -#define END_COLUMN_MAP(oWnd, nColumn) \ - (oWnd).SetColumnValues( (nColumn), x ); } +//#pragma once +// +//#include "CtrlLibraryTip.h" +// +// +//class CComboListCtrl : public CListCtrl +//{ +// DECLARE_DYNAMIC(CComboListCtrl) +// +//public: +// CComboListCtrl(); +// virtual ~CComboListCtrl(); +// +//public: +// typedef std::map< int, CString > CIntStringMap; +// typedef std::map< int, int > CIntIntMap; +// typedef std::vector< CIntIntMap > CIntIntMapVector; +// typedef std::map< int, CIntStringMap > CIntIntStringMapMap; +// +// int GetColumnData(int iItem, int iColumn) const; +// void SetColumnData(int iItem, int iColumn, int iData); +// void SetColumnValues(int iColumn, const CIntStringMap& oValues); +// void EnableTips(unique_ptr< CLibraryTipCtrl > pTip); +// +//protected: +// unique_ptr< CLibraryTipCtrl > m_pTip; +// CComboBox* m_pCombo; +// int m_iSelectedItem; +// int m_iSelectedSubItem; +// CIntIntMapVector m_oData; +// CIntIntStringMapMap m_oColumns; +// +// int HitTest(const CPoint& ptAction); +// void Show(int iItem, int iSubItem); +// void Hide(); +// +// afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult); +// afx_msg void OnMouseMove(UINT nFlags, CPoint point); +// +// DECLARE_MESSAGE_MAP() +//}; +// +//#define BEGIN_COLUMN_MAP() \ +// { CComboListCtrl::CIntStringMap x; +// +//#define COLUMN_MAP(nValue, nString) \ +// x.insert( CComboListCtrl::CIntStringMap::value_type( (nValue), (nString) ) ); +// +//#define END_COLUMN_MAP(oWnd, nColumn) \ +// (oWnd).SetColumnValues( (nColumn), x ); } diff --git a/Envy/DiscoveryServices.cpp b/Envy/DiscoveryServices.cpp index f0808f2..9cbda98 100644 --- a/Envy/DiscoveryServices.cpp +++ b/Envy/DiscoveryServices.cpp @@ -1,7 +1,7 @@ // // DiscoveryServices.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -575,7 +575,7 @@ void CDiscoveryServices::Serialize(CArchive& ar) for ( DWORD_PTR nCount = ar.ReadCount() ; nCount > 0 ; nCount-- ) { - auto_ptr< CDiscoveryService > pService( new CDiscoveryService() ); + unique_ptr< CDiscoveryService > pService( new CDiscoveryService() ); try { pService->Serialize( ar, nVersion ); diff --git a/Envy/Download.cpp b/Envy/Download.cpp index feb0086..9aba091 100644 --- a/Envy/Download.cpp +++ b/Envy/Download.cpp @@ -1,7 +1,7 @@ // // Download.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2016 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -747,7 +747,7 @@ BOOL CDownload::SeedTorrent() ASSERT( m_pTorrent.GetCount() ); - auto_ptr< CFragmentedFile > pFragmentedFile( new CFragmentedFile ); + unique_ptr< CFragmentedFile > pFragmentedFile( new CFragmentedFile ); if ( ! pFragmentedFile.get() ) return FALSE; // Out of memory @@ -761,7 +761,7 @@ BOOL CDownload::SeedTorrent() if ( IsSingleFileTorrent() ) { - // Refill missed hashes for single-file torrent + // Refill missing hashes for single-file torrent const CBTInfo::CBTFile* pBTFile = m_pTorrent.m_pFiles.GetHead(); if ( ! m_pTorrent.m_oSHA1 && pBTFile->m_oSHA1 ) m_pTorrent.m_oSHA1 = pBTFile->m_oSHA1; @@ -785,7 +785,7 @@ BOOL CDownload::SeedTorrent() } } - // Refill missed hashes + // Refill missng hashes if ( ! m_oSHA1 && m_pTorrent.m_oSHA1 ) m_oSHA1 = m_pTorrent.m_oSHA1; if ( ! m_oTiger && m_pTorrent.m_oTiger ) @@ -1235,7 +1235,7 @@ void CDownload::Serialize(CArchive& ar, int nVersion) // DOWNLOAD_SER_VERSION // // if ( nVersion >= 3 && ar.ReadCount() ) // { -// auto_ptr< CXMLElement > pXML( new CXMLElement() ); +// unique_ptr< CXMLElement > pXML( new CXMLElement() ); // pXML->Serialize( ar ); // MergeMetadata( pXML.get() ); // } diff --git a/Envy/Download.h b/Envy/Download.h index dff5f43..5a70fd0 100644 --- a/Envy/Download.h +++ b/Envy/Download.h @@ -26,7 +26,7 @@ // 33 - added m_sSearchKeyword to CDownloadBase (CyberBob) // 34 - added m_bSeeding and m_sServingFileName to CDownloadWithTorrent (Rolandas) // 35 - added m_sCountry to CDownloadSource (dcat) -// 36 - nothing (Rolandas) (Shareaza 2.2.4.0?) +// 36 - nothing (Rolandas) (Shareaza 2.2.4.0) // 37 - added m_oBTH to CDownloadBase, m_bBTH and m_bMD5 to CDownloadSource (Ryo-oh-ki) // 38 - added m_sCountryName to CDownloadSource (dcat) // 39 - added m_bClientExtended to CDownloadSource (Ryo-oh-ki) diff --git a/Envy/DownloadWithFile.h b/Envy/DownloadWithFile.h index f5cf397..09b61a7 100644 --- a/Envy/DownloadWithFile.h +++ b/Envy/DownloadWithFile.h @@ -1,7 +1,7 @@ // // DownloadWithFile.h // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -32,7 +32,7 @@ class CDownloadWithFile : public CDownloadWithTransfers TRISTATE m_bVerify; // Verify status (TRI_TRUE verified, TRI_FALSE failed, TRI_UNKNOWN not yet) DWORD m_tReceived; private: - auto_ptr< CFragmentedFile > m_pFile; // File(s) + unique_ptr< CFragmentedFile > m_pFile; // File(s) DWORD m_nFileError; // Last file/disk error CString m_sFileError; // More info about error diff --git a/Envy/DownloadWithTorrent.cpp b/Envy/DownloadWithTorrent.cpp index 35ad0d5..1a4431d 100644 --- a/Envy/DownloadWithTorrent.cpp +++ b/Envy/DownloadWithTorrent.cpp @@ -1,7 +1,7 @@ // // DownloadWithTorrent.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -245,7 +245,7 @@ void CDownloadWithTorrent::Serialize(CArchive& ar, int nVersion) // // // Create a bunch of new empty files // ClearFile(); // Close old files - // auto_ptr< CFragmentedFile > pFragFile = GetFile(); + // unique_ptr< CFragmentedFile > pFragFile = GetFile(); // if ( ! pFragFile.get() ) // AfxThrowMemoryException(); // if ( ! pFragFile->Open( m_pTorrent, ! IsSeeding() ) ) @@ -496,7 +496,7 @@ void CDownloadWithTorrent::RunTorrent(DWORD tNow) if ( pDownload && pDownload->GetVolumeRemaining() == m_nSize ) // First load only { - auto_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); + unique_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); if ( pFragFile.get() ) { const DWORD nCount = pFragFile->GetCount(); diff --git a/Envy/Envy.cpp b/Envy/Envy.cpp index fcf2d1c..d960f48 100644 --- a/Envy/Envy.cpp +++ b/Envy/Envy.cpp @@ -1,7 +1,7 @@ // // Envy.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2016 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -164,7 +164,7 @@ void CAppCommandLineInfo::ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLa m_sTask = pszParam + 4; return; } - if ( _tcsicmp( pszParam, L"help" ) == 0 || *pszParam == '?' ) + if ( _tcsicmp( pszParam, L"help" ) == 0 || *pszParam == L'?' ) { m_bHelp = TRUE; return; @@ -1178,7 +1178,7 @@ BOOL CEnvyApp::OpenInternetShortcut(LPCTSTR lpszFileName) BOOL CEnvyApp::OpenTorrent(LPCTSTR lpszFileName) { // Test torrent - //auto_ptr< CBTInfo > pTorrent( new CBTInfo() ); + //unique_ptr< CBTInfo > pTorrent( new CBTInfo() ); //if ( ! pTorrent.get() ) return FALSE; //if ( ! pTorrent->LoadTorrentFile( lpszFileName ) ) return FALSE; @@ -3339,7 +3339,7 @@ CString LoadRichHTML(UINT nResourceID, CString& strResponse, CEnvyFile* pFile) bWindowsEOL = false; } strResponse = strBody.Left( nBreak + ( bWindowsEOL ? 2 : 1 ) ); - strBody = strBody.Mid( nBreak + ( bWindowsEOL ? 2 : 1 ) ); + strBody = strBody.Mid( nBreak + ( bWindowsEOL ? 2 : 1 ) ); for ( ;; ) { diff --git a/Envy/Envy.h b/Envy/Envy.h index 5d55c97..ab5e316 100644 --- a/Envy/Envy.h +++ b/Envy/Envy.h @@ -1,7 +1,7 @@ // // Envy.h // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2016 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -209,7 +209,7 @@ class CEnvyApp : public CWinApp CString GetAppDataFolder() const; CString GetLocalAppDataFolder() const; - CDatabase* GetDatabase(BYTE nType = 0) const; // Get SQLite (thumbs) database handler, must be freed by "delete" operator (or auto_ptr). + CDatabase* GetDatabase(BYTE nType = 0) const; // Get SQLite (thumbs) database handler, must be freed by "delete" operator. (unique_ptr?) void OnRename(LPCTSTR strSource, LPCTSTR pszTarget = (LPCTSTR)1); // pszTarget: 0 = delete file, 1 = release file. diff --git a/Envy/Envy.vcproj b/Envy/Envy.vcproj index 69c642c..101b437 100644 --- a/Envy/Envy.vcproj +++ b/Envy/Envy.vcproj @@ -4251,18 +4251,10 @@ - - - - diff --git a/Envy/Envy.vcxproj b/Envy/Envy.vcxproj index 5c8fbde..c701d1e 100644 --- a/Envy/Envy.vcxproj +++ b/Envy/Envy.vcxproj @@ -1593,11 +1593,9 @@ - - - + diff --git a/Envy/Envy.vcxproj.filters b/Envy/Envy.vcxproj.filters index 1c48f19..d9293cb 100644 --- a/Envy/Envy.vcxproj.filters +++ b/Envy/Envy.vcxproj.filters @@ -2813,15 +2813,9 @@ Header Files\Hash Algorithms\Policies - - Header Files\Augment - Header Files\Augment - - Header Files\Augment - Header Files\Augment diff --git a/Envy/EnvyDataSource.cpp b/Envy/EnvyDataSource.cpp index 7511bae..546561e 100644 --- a/Envy/EnvyDataSource.cpp +++ b/Envy/EnvyDataSource.cpp @@ -1,7 +1,7 @@ // // EnvyDataSource.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -505,7 +505,7 @@ BOOL CEnvyDataSource::DropToFolder(IDataObject* pIDataObject, DWORD grfKeyState, size < sizeof( DROPFILES ) || size > 10000000 ) return FALSE; - auto_ptr pAFOP( new AsyncFileOperationParams ); + unique_ptr pAFOP( new AsyncFileOperationParams ); if ( ! pAFOP.get() ) return FALSE; diff --git a/Envy/FragmentedFile.h b/Envy/FragmentedFile.h index cbb7bb1..3a62df7 100644 --- a/Envy/FragmentedFile.h +++ b/Envy/FragmentedFile.h @@ -1,7 +1,7 @@ // // FragmentedFile.h // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -34,7 +34,6 @@ class CFragmentedFile : public CObject public: CFragmentedFile(); -protected: virtual ~CFragmentedFile(); public: @@ -337,10 +336,21 @@ class CFragmentedFile : public CObject // } }; -// For auto_ptr< CFragmentedFile > -// Defined in Augment/auto_ptr.hpp, was boost::checked_delete + +// delete, with compile-time type check, from boost::checked_delete.hpp: +template inline void checked_delete(T * x) +{ +#ifdef _DEBUG + // Intentionally complex, simplification causes regressions + typedef char type_must_be_complete[sizeof(T) ? 1 : -1]; + (void) sizeof(type_must_be_complete); +#endif + delete x; +} + +// For unique_ptr< CFragmentedFile > - was boost::checked_delete template<> -inline void augment::checked_delete< CFragmentedFile >(CFragmentedFile* x) +inline void checked_delete< CFragmentedFile >(CFragmentedFile* x) { if ( x ) x->Release(); } diff --git a/Envy/GGEP.cpp b/Envy/GGEP.cpp index 0451104..d5c9979 100644 --- a/Envy/GGEP.cpp +++ b/Envy/GGEP.cpp @@ -1,7 +1,7 @@ // // GGEP.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2012 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -170,7 +170,7 @@ CGGEPItem* CGGEPBlock::ReadItem(BYTE nFlags) } szID[ nIDLen ] = 0; - auto_ptr< CGGEPItem > pItem( new CGGEPItem( szID ) ); + unique_ptr< CGGEPItem > pItem( new CGGEPItem( szID ) ); if ( ! pItem.get() ) return NULL; // Error: Out of memory diff --git a/Envy/HostBrowser.cpp b/Envy/HostBrowser.cpp index 8f5b7d4..e2c2769 100644 --- a/Envy/HostBrowser.cpp +++ b/Envy/HostBrowser.cpp @@ -1,7 +1,7 @@ // // HostBrowser.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -457,7 +457,7 @@ BOOL CHostBrowser::LoadDC(LPCTSTR pszFile, CQueryHit*& pHits) if ( ! pBuffer.UnBZip() ) return FALSE; // Decompression error - auto_ptr< CXMLElement > pXML ( CXMLElement::FromString( pBuffer.ReadString( pBuffer.m_nLength, CP_UTF8 ), TRUE ) ); + unique_ptr< CXMLElement > pXML ( CXMLElement::FromString( pBuffer.ReadString( pBuffer.m_nLength, CP_UTF8 ), TRUE ) ); if ( ! pXML.get() ) return FALSE; // XML decoding error @@ -741,11 +741,8 @@ BOOL CHostBrowser::ReadContent() if ( ! StreamPacketsG1() ) return FALSE; break; //case PROTOCOL_ED2K: - // // Skip - // break; //case PROTOCOL_DC: - // // Skip - // break; + // break; // Skip //default: // theApp.Message( MSG_ERROR, L"CHostBrowser::ReadContent(): Unknown Browse Protocol" ); } diff --git a/Envy/HostCache.cpp b/Envy/HostCache.cpp index a479e11..3b71d7a 100644 --- a/Envy/HostCache.cpp +++ b/Envy/HostCache.cpp @@ -1,7 +1,7 @@ // // HostCache.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -887,7 +887,7 @@ int CHostCache::ImportHubList(CFile* pFile) return 0; // Decompression error CString strEncoding; - auto_ptr< CXMLElement > pHublist ( CXMLElement::FromString( + unique_ptr< CXMLElement > pHublist ( CXMLElement::FromString( pBuffer.ReadString( pBuffer.m_nLength ), TRUE, &strEncoding ) ); if ( strEncoding.CompareNoCase( L"utf-8" ) == 0 ) // Reload as UTF-8 pHublist.reset( CXMLElement::FromString( diff --git a/Envy/Images.cpp b/Envy/Images.cpp index bcc5605..eda4f83 100644 --- a/Envy/Images.cpp +++ b/Envy/Images.cpp @@ -1,7 +1,7 @@ // // Images.cpp // -// This file is part of Envy (getenvy.com) © 2010-2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // All work here is original and released as-is under Persistent Public Domain [PPD] // @@ -273,7 +273,7 @@ void CImages::Load() SkinImage( &m_bmToolbarSeparator, L"CCoolbar.Separator" ) || SkinImage( &m_bmToolbarSeparator, L"ToolbarSeparator" ); - SkinImage( &m_bmToolbar, L"System.Toolbars" ) || + SkinImage( &m_bmToolbar, L"System.Toolbars" ) || // FALSE disallow transparency? SkinImage( &m_bmToolbar, L"CCoolbar" ) || SkinImage( &m_bmToolbar, L"Toolbar" ); diff --git a/Envy/LibraryBuilder.cpp b/Envy/LibraryBuilder.cpp index 5681faa..0b267d4 100644 --- a/Envy/LibraryBuilder.cpp +++ b/Envy/LibraryBuilder.cpp @@ -1,7 +1,7 @@ // // LibraryBuilder.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -539,7 +539,7 @@ bool CLibraryBuilder::HashFile(LPCTSTR szPath, HANDLE hFile) nSizeHigh = (DWORD)( nFileBase >> 32 ); SetFilePointer( hFile, nSizeLow, (PLONG)&nSizeHigh, FILE_BEGIN ); - auto_ptr< CFileHash > pFileHash( new CFileHash( nFileSize ) ); + unique_ptr< CFileHash > pFileHash( new CFileHash( nFileSize ) ); if ( ! pFileHash.get() ) return false; // Out of memory @@ -706,7 +706,7 @@ int CLibraryBuilder::SubmitMetadata(DWORD nIndex, LPCTSTR pszSchemaURI, CXMLElem } // Validate schema - auto_ptr< CXMLElement > pBase( pSchema->Instantiate( true ) ); + unique_ptr< CXMLElement > pBase( pSchema->Instantiate( true ) ); pBase->AddElement( pXML ); if ( ! pSchema->Validate( pBase.get(), true ) ) return 0; diff --git a/Envy/LibraryBuilderInternals.cpp b/Envy/LibraryBuilderInternals.cpp index bb3f144..7e449dd 100644 --- a/Envy/LibraryBuilderInternals.cpp +++ b/Envy/LibraryBuilderInternals.cpp @@ -1,7 +1,7 @@ // // LibraryBuilderInternals.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -602,7 +602,7 @@ bool CLibraryBuilderInternals::ReadID3v1(DWORD nIndex, HANDLE hFile) if ( strncmp( pInfo.szTag, ID3V1_TAG, 3 ) != 0 ) return false; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); CopyID3v1Field( pXML.get(), L"title", CString( pInfo.szSongname, 30 ) ); CopyID3v1Field( pXML.get(), L"artist", CString( pInfo.szArtist, 30 ) ); @@ -735,7 +735,7 @@ bool CLibraryBuilderInternals::ReadID3v2(DWORD nIndex, HANDLE hFile) nBuffer -= pExtended->nSize; } - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); // 4-Char ID3 FrameTag: (http://en.wikipedia.org/wiki/ID3) SwitchMap( Tag ) @@ -1183,7 +1183,7 @@ bool CLibraryBuilderInternals::ReadMP3Frames(DWORD nIndex, HANDLE hFile) { SetFilePointer( hFile, 0, NULL, FILE_BEGIN ); - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); if ( ! ScanMP3Frame( pXML.get(), hFile, 0 ) ) return false; @@ -1397,7 +1397,7 @@ bool CLibraryBuilderInternals::ScanMP3Frame(CXMLElement* pXML, HANDLE hFile, DWO bool CLibraryBuilderInternals::ReadVersion(DWORD nIndex, LPCTSTR pszPath) { - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"application" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"application" ) ); if ( ! pXML.get() ) return false; @@ -1606,7 +1606,7 @@ bool CLibraryBuilderInternals::ReadMSI(DWORD nIndex, LPCTSTR pszPath) if ( nError != ERROR_SUCCESS ) return false; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"application" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"application" ) ); pXML->AddAttribute( L"os", L"Windows" ); @@ -1743,7 +1743,7 @@ bool CLibraryBuilderInternals::ReadJPEG(DWORD nIndex, HANDLE hFile) strComment.SetAt( nChar, '?' ); } - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"image" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"image" ) ); CString strItem; strItem.Format( L"%lu", nWidth ); @@ -1787,9 +1787,9 @@ bool CLibraryBuilderInternals::ReadGIF(DWORD nIndex, HANDLE hFile) if ( ! ReadFile( hFile, &nHeight, 2, &nRead, NULL ) || nRead != 2 || nHeight == 0 ) return false; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"image" ) ); - CString strItem; + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"image" ) ); + CString strItem; strItem.Format( L"%lu", nWidth ); pXML->AddAttribute( L"width", strItem ); strItem.Format( L"%lu", nHeight ); @@ -1856,7 +1856,7 @@ bool CLibraryBuilderInternals::ReadPNG(DWORD nIndex, HANDLE hFile) if ( ! ReadFile( hFile, &nColors, 1, &nRead, NULL ) || nRead != 1 ) return false; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"image" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"image" ) ); CString strItem; strItem.Format( L"%lu", nWidth ); @@ -1891,7 +1891,7 @@ bool CLibraryBuilderInternals::ReadBMP(DWORD nIndex, HANDLE hFile) if ( nRead != sizeof( pBIH ) || pBIH.biSize != sizeof( pBIH ) ) return false; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"image" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"image" ) ); CString strItem; strItem.Format( L"%d", pBIH.biWidth ); @@ -2534,7 +2534,7 @@ bool CLibraryBuilderInternals::ReadASF(DWORD nIndex, HANDLE hFile) SetFilePointer( hFile, dwPosition + (DWORD)nSize, NULL, FILE_BEGIN ); } - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, bVideo ? L"video" : L"audio" ) ); CString strItem; @@ -2625,7 +2625,7 @@ bool CLibraryBuilderInternals::ReadMPEG(DWORD nIndex, HANDLE hFile) if ( nHeader != 7 ) return false; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"video" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"video" ) ); CString strItem; DWORD nWidth, nHeight; @@ -2656,7 +2656,7 @@ bool CLibraryBuilderInternals::ReadMPEG(DWORD nIndex, HANDLE hFile) //{ // // ToDo: http://www.matroska.org/technical/specs/index.html // -// auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"video" ) ); +// unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"video" ) ); // // LibraryBuilder.SubmitMetadata( nIndex, CSchema::uriVideo, pXML.release() ); // @@ -2716,7 +2716,7 @@ bool CLibraryBuilderInternals::ReadOGG(DWORD nIndex, HANDLE hFile) pOGG += 4; nOGG -= 4; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); for ( ; nComments && nOGG > 4 ; nComments-- ) { @@ -2915,7 +2915,7 @@ bool CLibraryBuilderInternals::ReadAPE(DWORD nIndex, HANDLE hFile, bool bPreferF DWORD nRead; APE_TAG_FOOTER pFooter; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"audio" ) ); SetFilePointer( hFile, -(LONG)sizeof( pFooter ), NULL, FILE_END ); ReadFile( hFile, &pFooter, sizeof( pFooter ), &nRead, NULL ); @@ -3427,7 +3427,7 @@ bool CLibraryBuilderInternals::ReadAVI(DWORD nIndex, HANDLE hFile) return false; bool bMoviFound = false, bInfoFound = false; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"video" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"video" ) ); do { @@ -3843,7 +3843,7 @@ bool CLibraryBuilderInternals::ReadPDF(DWORD nIndex, HANDLE hFile, LPCTSTR pszPa // Collect author, title if file name contains "book" keyword bool bBook = ( _tcsistr( pszPath, L"book" ) != NULL ); - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, bBook ? L"book" : L"wordprocessing" ) ); if ( LPCTSTR pszName = _tcsrchr( pszPath, '\\' ) ) @@ -4517,7 +4517,7 @@ bool CLibraryBuilderInternals::ReadCHM(DWORD nIndex, HANDLE hFile, LPCTSTR pszPa CString strLine; bool bBook = ( _tcsistr( pszPath, L"book" ) != NULL ); - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, bBook ? L"book" : L"wordprocessing" ) ); if ( LPCTSTR pszName = _tcsrchr( pszPath, '\\' ) ) @@ -4792,7 +4792,7 @@ bool CLibraryBuilderInternals::ReadCollection(DWORD nIndex, LPCTSTR pszPath) { if ( _tcslen( pszPath ) < 9 || _tcsicmp( pszPath + _tcslen( pszPath ) - 8, L".xml.bz2" ) != 0 ) { - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"archive" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"archive" ) ); LibraryBuilder.SubmitMetadata( nIndex, CSchema::uriArchive, pXML.release() ); return true; } @@ -4831,7 +4831,7 @@ bool CLibraryBuilderInternals::ReadTorrent(DWORD nIndex, HANDLE /*hFile*/, LPCTS if ( ! oTorrent.LoadTorrentFile( pszPath ) ) return false; - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"torrent" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"torrent" ) ); CString str; str.Format( L"%i", oTorrent.GetCount() ); @@ -4871,8 +4871,8 @@ bool CLibraryBuilderInternals::ReadTorrent(DWORD nIndex, HANDLE /*hFile*/, LPCTS bool CLibraryBuilderInternals::ReadSkin(DWORD nIndex) { // .PSK Library inclusion workaround - auto_ptr< CXMLElement > pXMLApp( new CXMLElement( NULL, L"application" ) ); // Set Schema - auto_ptr< CXMLElement > pXMLArchive( new CXMLElement( NULL, L"archive" ) ); // Set Schema + unique_ptr< CXMLElement > pXMLApp( new CXMLElement( NULL, L"application" ) ); // Set Schema + unique_ptr< CXMLElement > pXMLArchive( new CXMLElement( NULL, L"archive" ) ); // Set Schema pXMLApp->AddAttribute( L"company", L"Envy" ); // Hackish workaround: Invalid skin schema item so dual schema works. (SkinScan metadata) return LibraryBuilder.SubmitMetadata( nIndex, CSchema::uriApplication, pXMLApp.release() ) != 0 && LibraryBuilder.SubmitMetadata( nIndex, CSchema::uriArchive, pXMLArchive.release() ) != 0; @@ -4880,7 +4880,7 @@ bool CLibraryBuilderInternals::ReadSkin(DWORD nIndex) bool CLibraryBuilderInternals::ReadBook(DWORD nIndex, CString strPath) { - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"book" ) ); // Set Schema + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"book" ) ); // Set Schema strPath = PathFindFileName( strPath ); if ( strPath.GetLength() > 16 ) @@ -4914,7 +4914,7 @@ bool CLibraryBuilderInternals::ReadBook(DWORD nIndex, CString strPath) bool CLibraryBuilderInternals::ReadText(DWORD nIndex, CString /*strPath*/) { - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"wordprocessing" ) ); // Set Schema + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"wordprocessing" ) ); // Set Schema //pXML->AddAttribute( L"path", strPath ); // No metadata return LibraryBuilder.SubmitMetadata( nIndex, CSchema::uriDocument, pXML.release() ) != 0; } diff --git a/Envy/LibraryBuilderPlugins.cpp b/Envy/LibraryBuilderPlugins.cpp index de313d1..9f594dc 100644 --- a/Envy/LibraryBuilderPlugins.cpp +++ b/Envy/LibraryBuilderPlugins.cpp @@ -1,7 +1,7 @@ // // LibraryBuilderPlugins.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -60,7 +60,7 @@ bool CLibraryBuilderPlugins::ExtractPluginMetadata(DWORD nIndex, const CString& if ( ! pPlugin ) break; - auto_ptr< CXMLElement > pXML( new CXMLElement() ); + unique_ptr< CXMLElement > pXML( new CXMLElement() ); CComPtr< ISXMLElement > pISXMLElement; pISXMLElement.Attach( (ISXMLElement*)CXMLCOM::Wrap( pXML.get(), IID_ISXMLElement ) ); HRESULT hr = SafeProcess( pPlugin, CComBSTR( strPath ), pISXMLElement ); diff --git a/Envy/LibraryFolders.h b/Envy/LibraryFolders.h index 9bbe426..cb286bb 100644 --- a/Envy/LibraryFolders.h +++ b/Envy/LibraryFolders.h @@ -27,15 +27,16 @@ class CXMLElement; enum XmlType { xmlDefault, // Default +// xmlPassKey, // Private Share xmlDC // DC++ file listing }; // ToDo: Support Private Share Key -//enum ShareType +//enum ShowType //{ -// ShareAll, // bSharedOnly FALSE -// SharePublic, // bSharedOnly TRUE -// SharePrivate // Passcode +// ShowAll, // bSharedOnly FALSE +// ShowPublic, // bSharedOnly TRUE +// ShowPrivate // Passkey //}; diff --git a/Envy/LocalSearch.cpp b/Envy/LocalSearch.cpp index da90c94..fc7c21d 100644 --- a/Envy/LocalSearch.cpp +++ b/Envy/LocalSearch.cpp @@ -1,7 +1,7 @@ // // LocalSearch.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -128,20 +128,20 @@ bool CLocalSearch::IsValidForHit< CLibraryFile >(const CLibraryFile* pFile) cons } } - // Note IsValidForHit for PROTOCOL_G1: - // Check that a free queue exists that can upload this file. - //&& ( UploadQueues.QueueRank( PROTOCOL_HTTP, pFile ) <= Settings.Gnutella1.HitQueueLimit ); // Causes Deadlock? - // NOTE: Very CPU intensive operation! - // Normally this isn't a problem, default queue length is 8-10, so this check (50) will never be activated. - // However, sometimes users configure bad settings, such as a 2000 user HTTP queue. - // Although the remote client should handle this by itself, - // give Gnutella some protection against extreme settings (to reduce un-necessary traffic.) +// Note IsValidForHit for PROTOCOL_G1: +// Check that a free queue exists that can upload this file. +//&& ( UploadQueues.QueueRank( PROTOCOL_HTTP, pFile ) <= Settings.Gnutella1.HitQueueLimit ); // Causes Deadlock? +// NOTE: Very CPU intensive operation! +// Normally this isn't a problem, default queue length is 8-10, so this check (50) will never be activated. +// However, sometimes users configure bad settings, such as a 2000 user HTTP queue. +// Although the remote client should handle this by itself, +// give Gnutella some protection against extreme settings (to reduce un-necessary traffic). ////////////////////////////////////////////////////////////////////// // CLocalSearch execute -bool CLocalSearch::Execute(INT_PTR nMaximum, bool bPartial, bool bShared) +bool CLocalSearch::Execute(INT_PTR nMaximum, bool bPartial /*true*/, bool bShared /*true*/) { ASSERT( bPartial || bShared ); @@ -219,7 +219,7 @@ bool CLocalSearch::ExecuteSharedFiles(INT_PTR nMaximum, INT_PTR& nHits) if ( ! oLock.Lock( 250 ) ) return false; - auto_ptr< CFileList > pFiles( Library.Search( m_pSearch, nMaximum, FALSE, m_nProtocol != PROTOCOL_G2 ) ); // Ghost files only for G2 + unique_ptr< CFileList > pFiles( Library.Search( m_pSearch, nMaximum, FALSE, m_nProtocol != PROTOCOL_G2 ) ); // Ghost files only for G2 if ( pFiles.get() ) { @@ -235,12 +235,12 @@ bool CLocalSearch::ExecuteSharedFiles(INT_PTR nMaximum, INT_PTR& nHits) oFilesInPacket.AddTail( pFile ); // Obsolete for reference: - // if ( ( Settings.Gnutella.HitsPerPacket && (DWORD)oFilesInPacket.GetCount() >= Settings.Gnutella.HitsPerPacket ) || - // ( m_pPacket && m_pPacket->m_nLength >= MAX_QUERY_PACKET_SIZE ) ) - // { - // nHits += SendHits( oFilesInPacket ); // Packet full, send it - // oFilesInPacket.RemoveAll(); - // } + //if ( ( Settings.Gnutella.HitsPerPacket && (DWORD)oFilesInPacket.GetCount() >= Settings.Gnutella.HitsPerPacket ) || + // ( m_pPacket && m_pPacket->m_nLength >= MAX_QUERY_PACKET_SIZE ) ) + //{ + // nHits += SendHits( oFilesInPacket ); // Packet full, send it + // oFilesInPacket.RemoveAll(); + //} } SendHits( oFilesInPacket ); @@ -1286,7 +1286,7 @@ CG2Packet* CLocalSearch::AlbumToPacket(CAlbumFolder* pFolder) if ( pFolder->m_pSchema != NULL ) { - auto_ptr< CXMLElement > pXML( pFolder->m_pSchema->Instantiate( TRUE ) ); + unique_ptr< CXMLElement > pXML( pFolder->m_pSchema->Instantiate( TRUE ) ); if ( ! pXML.get() ) return NULL; if ( pFolder->m_pXML != NULL ) diff --git a/Envy/NeighboursWithConnect.cpp b/Envy/NeighboursWithConnect.cpp index 018220c..1aebf84 100644 --- a/Envy/NeighboursWithConnect.cpp +++ b/Envy/NeighboursWithConnect.cpp @@ -1,7 +1,7 @@ // // NeighboursWithConnect.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -167,7 +167,7 @@ CNeighbour* CNeighboursWithConnect::ConnectTo( { case PROTOCOL_ED2K: { - auto_ptr< CEDNeighbour > pNeighbour( new CEDNeighbour() ); + unique_ptr< CEDNeighbour > pNeighbour( new CEDNeighbour() ); if ( pNeighbour->ConnectTo( &pAddress, nPort, bAutomatic ) ) return pNeighbour.release(); // Started connecting to an ed2k neighbour } @@ -175,7 +175,7 @@ CNeighbour* CNeighboursWithConnect::ConnectTo( case PROTOCOL_DC: { - auto_ptr< CDCNeighbour > pNeighbour( new CDCNeighbour() ); + unique_ptr< CDCNeighbour > pNeighbour( new CDCNeighbour() ); if ( pNeighbour->ConnectTo( &pAddress, nPort, bAutomatic ) ) return pNeighbour.release(); // Started connecting to a dc++ neighbour } @@ -196,7 +196,7 @@ CNeighbour* CNeighboursWithConnect::ConnectTo( default: // PROTOCOL_G1/PROTOCOL_G2 { - auto_ptr< CShakeNeighbour > pNeighbour( new CShakeNeighbour() ); + unique_ptr< CShakeNeighbour > pNeighbour( new CShakeNeighbour() ); if ( pNeighbour->ConnectTo( &pAddress, nPort, bAutomatic, bNoUltraPeer ) ) { // If we only want G1 connections now, specify that to begin with diff --git a/Envy/Network.cpp b/Envy/Network.cpp index cbcd514..a2eabf9 100644 --- a/Envy/Network.cpp +++ b/Envy/Network.cpp @@ -1,7 +1,7 @@ // // Network.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -542,7 +542,7 @@ BOOL CNetwork::AsyncResolve(LPCTSTR pszAddress, WORD nPort, PROTOCOLID nProtocol { theApp.Message( MSG_INFO, IDS_NETWORK_RESOLVING, pszAddress ); - auto_ptr< ResolveStruct > pResolve( new ResolveStruct ); + unique_ptr< ResolveStruct > pResolve( new ResolveStruct ); if ( pResolve.get() ) { pResolve->m_sAddress = pszAddress; @@ -915,7 +915,7 @@ void CNetwork::PostRun() void CNetwork::OnWinsock(WPARAM wParam, LPARAM lParam) { - auto_ptr< const ResolveStruct > pResolve( GetResolve( (HANDLE)wParam ) ); + unique_ptr< const ResolveStruct > pResolve( GetResolve( (HANDLE)wParam ) ); if ( ! pResolve.get() ) return; // Out of memory diff --git a/Envy/PageTorrentFiles.cpp b/Envy/PageTorrentFiles.cpp index b3b6d73..a53bacf 100644 --- a/Envy/PageTorrentFiles.cpp +++ b/Envy/PageTorrentFiles.cpp @@ -1,7 +1,7 @@ // // PageTorrentFiles.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -91,7 +91,7 @@ BOOL CTorrentFilesPage::OnInitDialog() //ASSUME_LOCK( Transfers.m_pSection ); - auto_ptr< CLibraryTipCtrl > pTip( new CLibraryTipCtrl ); + unique_ptr< CLibraryTipCtrl > pTip( new CLibraryTipCtrl ); pTip->Create( this, &Settings.Interface.TipDownloads ); //m_wndFiles.EnableTips( pTip ); // Unused ComboListCtrl @@ -161,7 +161,7 @@ void CTorrentFilesPage::OnCheckbox(NMHDR* pNMHDR, LRESULT* pResult) CDownload* pDownload = ((CDownloadSheet*)GetParent())->GetDownload(); if ( ! pDownload ) return; // Invalid download - auto_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); + unique_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); if ( ! pFragFile.get() ) return; int nIndex = _wtoi( m_wndFiles.GetItemText( pNMListView->iItem, COL_INDEX ) ); @@ -252,7 +252,7 @@ BOOL CTorrentFilesPage::OnApply() // CSingleLock oLock( &Transfers.m_pSection, TRUE ); // CDownload* pDownload = ((CDownloadSheet*)GetParent())->m_pDownload; // if ( ! Downloads.Check( pDownload ) || ! pDownload->IsTorrent() ) return FALSE; -// auto_ptr< CFragmentedFile > pFragFile = pDownload->GetFile(); +// unique_ptr< CFragmentedFile > pFragFile = pDownload->GetFile(); // if ( pFragFile.get() ) // for ( DWORD i = 0 ; i < pFragFile->GetCount() ; ++i ) // pFragFile->SetPriority( i, m_wndFiles.GetColumnData( i, COL_INDEX ) ); @@ -266,7 +266,7 @@ void CTorrentFilesPage::UpdateCount() if ( ! oLock.Lock( 200 ) ) return; CDownload* pDownload = ((CDownloadSheet*)GetParent())->GetDownload(); - auto_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); + unique_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); if ( ! pFragFile.get() ) return; oLock.Unlock(); @@ -307,7 +307,7 @@ void CTorrentFilesPage::Update() CDownload* pDownload = ((CDownloadSheet*)GetParent())->GetDownload(); if ( ! pDownload ) return; // Invalid download - auto_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); + unique_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); if ( ! pFragFile.get() ) return; @@ -366,7 +366,7 @@ void CTorrentFilesPage::GetFiles() CDownload* pDownload = ((CDownloadSheet*)GetParent())->GetDownload(); ASSERT( pDownload && pDownload->IsTorrent() ); - auto_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); + unique_ptr< CFragmentedFile > pFragFile( pDownload->GetFile() ); if ( ! pFragFile.get() ) return; pLock.Unlock(); diff --git a/Envy/RegExp.cpp b/Envy/RegExp.cpp index e7c5b31..9626936 100644 --- a/Envy/RegExp.cpp +++ b/Envy/RegExp.cpp @@ -1,7 +1,7 @@ // // RegExp.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2010-2014 and Shareaza 2008-2010 // // Envy is free software. You may redistribute and/or modify it @@ -31,9 +31,15 @@ #include //#include // In StdAfx.h -//#if defined(_MSC_VER) && (_MSC_FULL_VER > 150030000) // _HAS_TR1 // VS2008 SP1 for tr1, VS2012 for std +// VS2008 SP1 for _HAS_TR1, VS2012+ for std #include +#if !defined(_MSC_VER) || (_MSC_VER < 1700) // VS2010~ +#define std::regex std::tr1::regex +#define std::wregex std::tr1::wregex +#define std::wsmatch std::tr1::wsmatch +#endif + #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[] = __FILE__; @@ -50,9 +56,8 @@ BOOL Match(LPCTSTR szRegExp, LPCTSTR szContent) { const std::wstring sContent( (LPCWSTR)CT2CW( szContent ) ); const std::wstring sRegExp( (LPCWSTR)CT2CW( szRegExp ) ); - const std::tr1::wregex regExpPattern( sRegExp, - std::tr1::regex_constants::ECMAScript | std::tr1::regex_constants::icase ); - if ( std::tr1::regex_search( sContent, regExpPattern ) ) + const std::wregex regExpPattern( sRegExp, std::regex_constants::ECMAScript | std::regex_constants::icase ); + if ( std::regex_search( sContent, regExpPattern ) ) return TRUE; } catch (...) @@ -67,10 +72,10 @@ size_t Split(LPCTSTR szRegExp, LPCTSTR szContent, LPTSTR* pszResult) { const std::wstring sContent( (LPCWSTR)CT2CW( szContent ) ); const std::wstring sRegExp( (LPCWSTR)CT2CW( szRegExp ) ); - const std::tr1::wregex regExpPattern( sRegExp, - std::tr1::regex_constants::ECMAScript | std::tr1::regex_constants::icase ); - std::tr1::wsmatch results; - if ( std::tr1::regex_search( sContent, results, regExpPattern ) ) + const std::wregex regExpPattern( sRegExp, std::regex_constants::ECMAScript | std::regex_constants::icase ); + std::wsmatch results; + + if ( std::regex_search( sContent, results, regExpPattern ) ) { const size_t nCount = results.size(); size_t len = 0; diff --git a/Envy/SQLite.h b/Envy/SQLite.h index 332637c..0490657 100644 --- a/Envy/SQLite.h +++ b/Envy/SQLite.h @@ -17,7 +17,7 @@ // // Example: /Data/Envy.db3 -// auto_ptr< CDatabase* > db( theApp.GetDatabase( DB_DEFAULT ) ); +// unique_ptr< CDatabase* > db( theApp.GetDatabase( DB_DEFAULT ) ); // if ( db->Prepare( L"SELECT Number FROM Table;" ) ) // { // while ( db->Step() || db->IsBusy() ) diff --git a/Envy/SharedFile.cpp b/Envy/SharedFile.cpp index 35a60a1..32428f1 100644 --- a/Envy/SharedFile.cpp +++ b/Envy/SharedFile.cpp @@ -1,7 +1,7 @@ // // SharedFile.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2016 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -184,11 +184,13 @@ CString CLibraryFile::GetSearchName() const return str; } -CXMLElement* CLibraryFile::CreateXML(CXMLElement* pRoot, BOOL bSharedOnly, XmlType nType) const +CXMLElement* CLibraryFile::CreateXML(CXMLElement* pRoot, BOOL bSharedOnly, XmlType nType /*0*/) const { if ( bSharedOnly && ! IsShared() ) return NULL; + // ToDo: Support private passkey + // Special case-sensitive http://adc.sourceforge.net/ADC.html#_file_list if ( nType == xmlDC ) { diff --git a/Envy/SharedFile.h b/Envy/SharedFile.h index 1b583a0..bd7940d 100644 --- a/Envy/SharedFile.h +++ b/Envy/SharedFile.h @@ -84,7 +84,7 @@ class CLibraryFile : public CEnvyFile CString GetFolder() const; CString GetSearchName() const; const CLibraryFolder* GetFolderPtr() const; - CXMLElement* CreateXML(CXMLElement* pRoot, BOOL bSharedOnly, XmlType nType) const; + CXMLElement* CreateXML(CXMLElement* pRoot, BOOL bSharedOnly, XmlType nType = xmlDefault ) const; bool IsPrivateTorrent() const; DWORD GetCreationTime(); // Get network wide file creation time (seconds, as time()) diff --git a/Envy/SharedFolder.cpp b/Envy/SharedFolder.cpp index 3359e4d..5a47339 100644 --- a/Envy/SharedFolder.cpp +++ b/Envy/SharedFolder.cpp @@ -94,11 +94,13 @@ void CLibraryFolder::RenewGUID() m_oGUID.validate(); } -CXMLElement* CLibraryFolder::CreateXML(CXMLElement* pRoot, BOOL bSharedOnly, XmlType nType) const +CXMLElement* CLibraryFolder::CreateXML(CXMLElement* pRoot, BOOL bSharedOnly, XmlType nType /*0*/) const { if ( bSharedOnly && ! IsShared() ) return NULL; + // ToDo: Support private passkey + CXMLElement* pFolder; if ( nType == xmlDC ) diff --git a/Envy/SharedFolder.h b/Envy/SharedFolder.h index 8e5bb51..9d6e569 100644 --- a/Envy/SharedFolder.h +++ b/Envy/SharedFolder.h @@ -55,7 +55,7 @@ class CLibraryFolder : public CComObject Hashes::Guid m_oGUID; public: - CXMLElement* CreateXML(CXMLElement* pRoot, BOOL bSharedOnly, XmlType nType) const; + CXMLElement* CreateXML(CXMLElement* pRoot, BOOL bSharedOnly, XmlType nType = xmlDefault) const; POSITION GetFolderIterator() const; CLibraryFolder* GetNextFolder(POSITION& pos) const; CLibraryFolder* GetFolderByName(LPCTSTR pszName) const; diff --git a/Envy/Skin.cpp b/Envy/Skin.cpp index 050894e..163df3a 100644 --- a/Envy/Skin.cpp +++ b/Envy/Skin.cpp @@ -1,7 +1,7 @@ // // Skin.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2016 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -981,7 +981,7 @@ BOOL CSkin::LoadMenu(CXMLElement* pXML) m_pMenus.RemoveKey( strName ); } - auto_ptr< CMenu > pMenu( new CMenu() ); + unique_ptr< CMenu > pMenu( new CMenu() ); ASSERT_VALID( pMenu.get() ); if ( ! pMenu.get() ) return FALSE; @@ -1129,8 +1129,8 @@ BOOL CSkin::CreateToolBar(LPCTSTR pszName, CCoolBarCtrl* pBar) CCoolBarCtrl* pBase = NULL; CString strClassName( pszName ); - if ( m_pToolbars.Lookup( strClassName + m_pszGUIMode[Settings.General.GUIMode], pBase ) || - ( Settings.General.GUIMode == GUI_BASIC && m_pToolbars.Lookup( strClassName + m_pszGUIMode[ GUI_TABBED ], pBase ) ) || + if ( m_pToolbars.Lookup( strClassName + m_pszGUIMode[Settings.General.GUIMode], pBase ) || + ( Settings.General.GUIMode == GUI_BASIC && m_pToolbars.Lookup( strClassName + m_pszGUIMode[ GUI_TABBED ], pBase ) ) || m_pToolbars.Lookup( strClassName, pBase ) ) { //if ( StartsWith( strClassName, L"CLibraryHeaderBar" ) ) // Crash Workarounds @@ -1993,7 +1993,7 @@ CSkinWindow* CSkin::GetWindowSkin(CWnd* pWnd) if ( Settings.General.GUIMode == GUI_BASIC ) if ( CSkinWindow* pSkin = GetWindowSkin( (LPCTSTR)strClassName, m_pszGUIMode[ GUI_TABBED ] ) ) return pSkin; - + if ( CSkinWindow* pSkin = GetWindowSkin( (LPCTSTR)strClassName ) ) return pSkin; diff --git a/Envy/StdAfx.h b/Envy/StdAfx.h index e3071cc..dc7fed5 100644 --- a/Envy/StdAfx.h +++ b/Envy/StdAfx.h @@ -1,7 +1,7 @@ // // StdAfx.h // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2016 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -149,9 +149,14 @@ #define _ATL_NO_COM_SUPPORT #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS -#if defined(_MSC_VER) && ( _MSC_VER < 1900 || _MSC_FULL_VER > 190022820 ) -#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS // Smaller filesize VS2012+ (VS2015 RC error) -#endif +// Smaller filesize VS2012+ +#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS + +// Test deprecated c++ features for future visual studio +// ToDo: Convert std::auto_ptr to std::unique_ptr for VS2010+ +//#ifndef _HAS_AUTO_PTR_ETC +//#define _HAS_AUTO_PTR_ETC 0 +//#endif #pragma warning ( push, 0 ) // Suppress Microsoft warnings @@ -299,18 +304,24 @@ using namespace std::tr1::placeholders; // For std::bind _1, std::placeholders //#pragma warning ( pop ) // Restore warnings -#include "Augment/Augment.hpp" -using augment::implicit_cast; -using augment::auto_ptr; -using augment::auto_array; +#include "Augment/IUnknownImplementation.hpp" // For UPnPFinder +#include "Augment/auto_array.hpp" using augment::IUnknownImplementation; +using augment::auto_array; +#if !defined(_MSC_VER) || (_MSC_VER >= 1600) // VS2010+ +using std::unique_ptr; +#else // VS2008 +//#include "Augment/auto_ptr.hpp" +using augment::auto_ptr; +#define unique_ptr auto_ptr +#endif #include "../HashLib/HashLib.h" // GeoIP (geolite.maxmind.com) #include -// BugTrap (intellesoft.net) +// BugTrap (Defunct intellesoft.net) #ifdef _DEBUG #include #endif diff --git a/Envy/ThumbCache.cpp b/Envy/ThumbCache.cpp index 3d9b374..4896640 100644 --- a/Envy/ThumbCache.cpp +++ b/Envy/ThumbCache.cpp @@ -1,7 +1,7 @@ // // ThumbCache.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -37,7 +37,7 @@ static char THIS_FILE[] = __FILE__; void CThumbCache::InitDatabase() { - auto_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) ); + unique_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) ); if ( ! *db ) { TRACE( "CThumbCache::InitDatabase : Database error: %s\n", (LPCSTR)CT2A( db->GetLastErrorMessage() ) ); @@ -86,7 +86,7 @@ BOOL CThumbCache::Load(LPCTSTR pszPath, CImageFile* pImage) } // Load file info from database - auto_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) ); + unique_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) ); if ( ! *db ) { TRACE( "CThumbCache::InitDatabase : Database error: %s\n", (LPCSTR)CT2A( db->GetLastErrorMessage() ) ); @@ -138,7 +138,7 @@ BOOL CThumbCache::Load(LPCTSTR pszPath, CImageFile* pImage) void CThumbCache::Delete(LPCTSTR pszPath) { - auto_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) ); + unique_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) ); if ( ! *db ) { TRACE( "CThumbCache::InitDatabase : Database error: %s\n", (LPCSTR)CT2A( db->GetLastErrorMessage() ) ); @@ -175,7 +175,7 @@ BOOL CThumbCache::Store(LPCTSTR pszPath, CImageFile* pImage) return FALSE; } - auto_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) ); + unique_ptr< CDatabase > db( theApp.GetDatabase( DB_THUMBS ) ); if ( ! *db ) { TRACE( "CThumbCache::InitDatabase : Database error: %s\n", (LPCSTR)CT2A( db->GetLastErrorMessage() ) ); diff --git a/Envy/UPnPFinder.h b/Envy/UPnPFinder.h index 5a2c93b..f9ddab0 100644 --- a/Envy/UPnPFinder.h +++ b/Envy/UPnPFinder.h @@ -74,8 +74,7 @@ class CUPnPFinder : public CUPnP void CreatePortMappings(ServicePointer pService); HRESULT SaveServices(CComPtr< IEnumUnknown >, const LONG nTotalItems); - HRESULT InvokeAction(ServicePointer pService, CComBSTR action, - LPCTSTR pszInArgString, CString& strResult); + HRESULT InvokeAction(ServicePointer pService, CComBSTR action, LPCTSTR pszInArgString, CString& strResult); // Utility functions HRESULT CreateSafeArray(const VARTYPE vt, const ULONG nArgs, SAFEARRAY** ppsa); @@ -94,17 +93,17 @@ class CUPnPFinder : public CUPnP private: std::vector< CAdapt< DevicePointer > > m_pDevices; std::vector< CAdapt< ServicePointer> > m_pServices; - FinderPointer m_pDeviceFinder; - CComPtr< IUPnPDeviceFinderCallback > m_pDeviceFinderCallback; CComPtr< IUPnPServiceCallback > m_pServiceCallback; + CComPtr< IUPnPDeviceFinderCallback > m_pDeviceFinderCallback; + FinderPointer m_pDeviceFinder; LONG m_nAsyncFindHandle; bool m_bAsyncFindRunning; bool m_bPortIsFree; CString m_sLocalIP; CString m_sExternalIP; - bool m_bADSL; // Is the device ADSL? - bool m_bADSLFailed; // Did port mapping failed for the ADSL device? + bool m_bADSL; // Is the device ADSL? + bool m_bADSLFailed; // Did port mapping failed for the ADSL device? bool m_bInited; bool m_bSecondTry; bool m_bDisableWANIPSetup; @@ -112,9 +111,11 @@ class CUPnPFinder : public CUPnP ServicePointer m_pWANIPService; }; + +// IUnknownImplementation defined in Augment + // DeviceFinder Callback -class CDeviceFinderCallback - : public IUnknownImplementation< IUPnPDeviceFinderCallback > +class CDeviceFinderCallback : public IUnknownImplementation< IUPnPDeviceFinderCallback > { public: CDeviceFinderCallback(CUPnPFinder& instance) @@ -124,7 +125,6 @@ class CDeviceFinderCallback private: CUPnPFinder& m_instance; -private: HRESULT __stdcall DeviceAdded(LONG nFindData, IUPnPDevice* pDevice); HRESULT __stdcall DeviceRemoved(LONG nFindData, BSTR bsUDN); HRESULT __stdcall SearchComplete(LONG nFindData); @@ -132,8 +132,7 @@ class CDeviceFinderCallback // Service Callback -class CServiceCallback - : public IUnknownImplementation< IUPnPServiceCallback > +class CServiceCallback : public IUnknownImplementation< IUPnPServiceCallback > { public: CServiceCallback(CUPnPFinder& instance) @@ -143,7 +142,6 @@ class CServiceCallback private: CUPnPFinder& m_instance; -private: HRESULT __stdcall StateVariableChanged(IUPnPService* pService, LPCWSTR pszStateVarName, VARIANT varValue); HRESULT __stdcall ServiceInstanceDied(IUPnPService* pService); }; diff --git a/Envy/UploadTransfer.cpp b/Envy/UploadTransfer.cpp index 4ee7caa..7f46aa6 100644 --- a/Envy/UploadTransfer.cpp +++ b/Envy/UploadTransfer.cpp @@ -1,7 +1,7 @@ // // UploadTransfer.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -60,7 +60,7 @@ CUploadTransfer::CUploadTransfer(PROTOCOLID nProtocol) , m_nAveragePos ( 0 ) , m_tRatingTime ( 0 ) , m_nMaxRate ( 0 ) - , m_pFile ( NULL ) + , m_pFile ( ) { m_nProtocol = nProtocol; m_nBandwidth = Settings.Bandwidth.Request; @@ -474,7 +474,7 @@ BOOL CUploadTransfer::RequestPartial(CDownload* pDownload) m_bFilePartial = TRUE; // Try to get existing file object from download - auto_ptr< CFragmentedFile > pDownloadFile( pDownload->GetFile() ); + unique_ptr< CFragmentedFile > pDownloadFile( pDownload->GetFile() ); if ( ! pDownloadFile.get() ) return FALSE; @@ -534,7 +534,7 @@ BOOL CUploadTransfer::OpenFile() if ( IsFileOpen() ) return TRUE; - auto_ptr< CFragmentedFile > pFile( new CFragmentedFile ); + unique_ptr< CFragmentedFile > pFile( new CFragmentedFile ); if ( pFile.get() && pFile->Open( this, FALSE ) ) { AttachFile( pFile ); @@ -564,7 +564,11 @@ BOOL CUploadTransfer::ReadFile(QWORD nOffset, LPVOID pData, QWORD nLength, QWORD return m_pFile->Read( nOffset, pData, nLength, pnRead ); } -void CUploadTransfer::AttachFile(auto_ptr< CFragmentedFile >& pFile) +void CUploadTransfer::AttachFile(unique_ptr< CFragmentedFile >& pFile) { +#if !defined(_MSC_VER) || (_MSC_VER >= 1600) // VS2010+ + m_pFile = std::move( pFile ); +#else // VS2008 m_pFile = pFile; +#endif } diff --git a/Envy/UploadTransfer.h b/Envy/UploadTransfer.h index b141bbf..850a13d 100644 --- a/Envy/UploadTransfer.h +++ b/Envy/UploadTransfer.h @@ -62,7 +62,7 @@ class CUploadTransfer abstract : public CTransfer, public CEnvyFile DWORD m_tRatingTime; // When rating was last calculated private: - auto_ptr< CFragmentedFile > m_pFile; // Disk file + unique_ptr< CFragmentedFile > m_pFile; // Disk file public: virtual void Remove(BOOL bMessage = TRUE); @@ -98,7 +98,7 @@ class CUploadTransfer abstract : public CTransfer, public CEnvyFile virtual void CloseFile(); virtual BOOL WriteFile(QWORD nOffset, LPCVOID pData, QWORD nLength, QWORD* pnWritten = NULL); virtual BOOL ReadFile(QWORD nOffset, LPVOID pData, QWORD nLength, QWORD* pnRead = NULL); - void AttachFile(auto_ptr< CFragmentedFile >& pFile); + void AttachFile(unique_ptr< CFragmentedFile >& pFile); }; enum UserRating diff --git a/Envy/UploadTransferBT.cpp b/Envy/UploadTransferBT.cpp index 8d5f275..cdacb63 100644 --- a/Envy/UploadTransferBT.cpp +++ b/Envy/UploadTransferBT.cpp @@ -1,7 +1,7 @@ // // UploadTransferBT.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -280,7 +280,7 @@ BOOL CUploadTransferBT::OpenFile() if ( m_pClient && Downloads.Check( m_pClient->m_pDownload ) ) { // Try to get existing file object from download - auto_ptr< CFragmentedFile > pFile( m_pClient->m_pDownload->GetFile() ); + unique_ptr< CFragmentedFile > pFile( m_pClient->m_pDownload->GetFile() ); if ( pFile.get() ) { AttachFile( pFile ); @@ -290,7 +290,7 @@ BOOL CUploadTransferBT::OpenFile() // HACK: Open from disk (ToDo: Replace this with SeedTorrent in OnDownloadComplete) if ( m_pClient->m_pDownload->IsSeeding() ) { - auto_ptr< CFragmentedFile > pSeedingFile( new CFragmentedFile ); + unique_ptr< CFragmentedFile > pSeedingFile( new CFragmentedFile ); if ( pSeedingFile.get() ) { if ( pSeedingFile->Open( m_pClient->m_pDownload->m_pTorrent, FALSE ) ) diff --git a/Envy/UploadTransferHTTP.cpp b/Envy/UploadTransferHTTP.cpp index eb81efc..e7771aa 100644 --- a/Envy/UploadTransferHTTP.cpp +++ b/Envy/UploadTransferHTTP.cpp @@ -1,7 +1,7 @@ // // UploadTransferHTTP.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2015 and Shareaza 2008 // // Envy is free software. You may redistribute and/or modify it @@ -117,7 +117,7 @@ BOOL CUploadTransferHTTP::OnRead() case upsQueued: if ( ! ReadRequest() ) return FALSE; if ( m_nState != upsHeaders ) break; - + // Fall through: case upsHeaders: return ReadHeaders(); } @@ -167,7 +167,7 @@ BOOL CUploadTransferHTTP::ReadRequest() m_bBackwards = FALSE; m_bRange = FALSE; m_bQueueMe = FALSE; - m_bNotEnvy = FALSE; + m_bNotEnvy = FALSE; m_nAccept = 0; m_bMetadata = FALSE; @@ -433,10 +433,8 @@ BOOL CUploadTransferHTTP::OnHeadersComplete() SendResponse( IDR_HTML_ABOUT ); theApp.Message( MSG_INFO, IDS_UPLOAD_ABOUT, (LPCTSTR)m_sAddress, (LPCTSTR)m_sUserAgent ); } - else if ( ( ! Settings.Community.ServeFiles ) && - ( m_nAccept == 0 || m_nAccept == 1 || - ( m_nAccept == 2 && ! Settings.Community.ServeProfile ) ) || - ( ! RequestHostBrowse() ) ) + else if ( ( ! Settings.Community.ServeFiles && ( m_nAccept < 2 || ! Settings.Community.ServeProfile ) ) || + ! RequestHostBrowse() ) { SendResponse( IDR_HTML_ABOUT ); theApp.Message( MSG_ERROR, IDS_UPLOAD_BROWSE_DENIED, (LPCTSTR)m_sAddress ); @@ -778,9 +776,7 @@ BOOL CUploadTransferHTTP::RequestSharedFile(CLibraryFile* pFile, CSingleLock& oL } if ( Settings.Library.SourceMesh && m_nGnutella > 1 ) - { m_sLocations = pFile->GetAlternateSources( &m_pSourcesSent, 15, PROTOCOL_HTTP ); - } oLibraryLock.Unlock(); @@ -815,10 +811,7 @@ BOOL CUploadTransferHTTP::RequestPartialFile(CDownload* pDownload) } if ( Settings.Library.SourceMesh ) - { - m_sLocations = pDownload->GetSourceURLs( &m_pSourcesSent, 15, - ( m_nGnutella < 2 ) ? PROTOCOL_G1 : PROTOCOL_HTTP, NULL ); - } + m_sLocations = pDownload->GetSourceURLs( &m_pSourcesSent, 15, ( m_nGnutella < 2 ) ? PROTOCOL_G1 : PROTOCOL_HTTP, NULL ); pDownload->GetAvailableRanges( m_sRanges ); @@ -1227,16 +1220,16 @@ BOOL CUploadTransferHTTP::OnWrite() { QWORD nRead = 0; if ( ! ReadFile( m_nFileBase + m_nOffset + m_nLength - - m_nPosition - nPacket, pBuffer.get(), nPacket, &nRead ) || - nRead != nPacket ) + m_nPosition - nPacket, pBuffer.get(), nPacket, &nRead ) || + nRead != nPacket ) return TRUE; WriteReversed( pBuffer.get(), (DWORD)nPacket ); } else { if ( ! ReadFile( m_nFileBase + m_nOffset + m_nPosition, - pBuffer.get(), nPacket, &nPacket ) || - nPacket == 0 ) + pBuffer.get(), nPacket, &nPacket ) || + nPacket == 0 ) return TRUE; Write( pBuffer.get(), (DWORD)nPacket ); } @@ -1408,8 +1401,6 @@ BOOL CUploadTransferHTTP::RequestTigerTreeRaw(CTigerTree* pTigerTree, BOOL bDele if ( m_nLength <= nSerialTree ) { - CString strHeader; - if ( m_nLength != nSerialTree ) Write( _P("HTTP/1.1 206 OK\r\n") ); else @@ -1418,6 +1409,8 @@ BOOL CUploadTransferHTTP::RequestTigerTreeRaw(CTigerTree* pTigerTree, BOOL bDele SendDefaultHeaders(); Write( _P("Content-Type: application/tigertree-breadthfirst\r\n") ); + + CString strHeader; strHeader.Format( L"Content-Length: %I64u\r\n", m_nLength ); Write( strHeader ); @@ -1505,16 +1498,14 @@ BOOL CUploadTransferHTTP::RequestTigerTreeDIME(CTigerTree* pTigerTree, int nDept CBuffer pDIME; pDIME.WriteDIME( 1, _P(""), _P("text/xml"), sXMLUTF8, sXMLUTF8.GetLength() ); - pDIME.WriteDIME( pHashset ? 0 : 2, pszUUID, nUUID - 1, - _P("http://open-content.net/spec/thex/breadthfirst"), pSerialTree, nSerialTree ); + pDIME.WriteDIME( pHashset ? 0 : 2, pszUUID, nUUID - 1, _P("http://open-content.net/spec/thex/breadthfirst"), pSerialTree, nSerialTree ); GlobalFree( pSerialTree ); delete [] pszUUID; if ( pHashset && pHashset->ToBytes( &pSerialTree, &nSerialTree ) ) { - pDIME.WriteDIME( 2, _P(""), - _P("http://edonkey2000.com/spec/md4-hashset"), pSerialTree, nSerialTree ); + pDIME.WriteDIME( 2, _P(""), _P("http://edonkey2000.com/spec/md4-hashset"), pSerialTree, nSerialTree ); GlobalFree( pSerialTree ); } @@ -1536,8 +1527,6 @@ BOOL CUploadTransferHTTP::RequestTigerTreeDIME(CTigerTree* pTigerTree, int nDept if ( m_nLength <= pDIME.m_nLength ) { - CString strHeader; - if ( m_nLength != pDIME.m_nLength ) Write( _P("HTTP/1.1 206 OK\r\n") ); else @@ -1546,6 +1535,8 @@ BOOL CUploadTransferHTTP::RequestTigerTreeDIME(CTigerTree* pTigerTree, int nDept SendDefaultHeaders(); Write( _P("Content-Type: application/dime\r\n") ); + + CString strHeader; strHeader.Format( L"Content-Length: %I64u\r\n", m_nLength ); Write( strHeader ); @@ -1682,7 +1673,7 @@ BOOL CUploadTransferHTTP::RequestHostBrowse() pBuffer.Print( pXML->ToString( TRUE, TRUE, TRUE, TRI_TRUE ), CP_UTF8 ); } - else if ( m_nAccept == 1 ) + else if ( m_nAccept == 1 ) // Gnutella { if ( Settings.Community.ServeFiles ) { @@ -1690,7 +1681,7 @@ BOOL CUploadTransferHTTP::RequestHostBrowse() pSearch.Execute( 0 ); } } - else if ( m_nAccept == 2 ) + else if ( m_nAccept == 2 ) // G2 { if ( Settings.Community.ServeProfile && MyProfile.IsValid() ) { diff --git a/Envy/UploadTransferHTTP.h b/Envy/UploadTransferHTTP.h index 8c94a41..202000f 100644 --- a/Envy/UploadTransferHTTP.h +++ b/Envy/UploadTransferHTTP.h @@ -47,7 +47,7 @@ class CUploadTransferHTTP : public CUploadTransfer // "Accept" header: // 0 - unknown; // 1 - Gnutella 1 (application/x-gnutella-packets); - // 2 - Gnutella 2 (application/x-gnutella2 or application/x-Envy). + // 2 - Gnutella 2 (application/x-gnutella2 or application/x-envy). int m_nAccept; // Gnutella functionality: // 0 - Pure HTTP diff --git a/Envy/WndSearch.cpp b/Envy/WndSearch.cpp index 9bbee79..e16b9c9 100644 --- a/Envy/WndSearch.cpp +++ b/Envy/WndSearch.cpp @@ -1,7 +1,7 @@ // // WndSearch.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2008 // // Envy is free software. You may redistribute and/or modify it @@ -95,10 +95,10 @@ CSearchWnd::CSearchWnd(CQuerySearch* pSearch) , m_nCacheHubs ( 0 ) , m_nCacheLeaves ( 0 ) , m_bWaitMore ( FALSE ) - , m_sCaption ( L"" ) , m_nMaxResults ( 0 ) , m_nMaxED2KResults ( 0 ) , m_nMaxQueryCount ( 0 ) +// , m_sCaption ( L"" ) { if ( pSearch ) { @@ -228,7 +228,7 @@ void CSearchWnd::OnSkinChange() CBaseMatchWnd::OnSkinChange(); m_wndToolBar.Clear(); - Skin.CreateToolBar( m_bPanel ? L"CSearchWnd.Panel" : L"CSearchWnd.Full", &m_wndToolBar ); // Can skin "CSearchWnd.Toolbar" + Skin.CreateToolBar( m_bPanel ? L"CSearchWnd.Panel" : L"CSearchWnd.Full", &m_wndToolBar ); // Can skin "CSearchWnd.Toolbar" OnSize( SIZE_INTERNAL, 0, 0 ); UpdateMessages(); @@ -297,7 +297,7 @@ void CSearchWnd::OnPaint() rc.bottom --; dc.FillSolidRect( rc.left, rc.bottom, rc.Width(), 1, RGB( 255, 255, 255 ) ); dc.Draw3dRect( &rc, - CColors::CalculateColor( Colors.m_crBannerBack, RGB(255,255,255), 100 ), + CColors::CalculateColor( Colors.m_crBannerBack, RGB( 255, 255, 255 ), 100 ), CColors::CalculateColor( Colors.m_crBannerBack, 0, 150 ) ); rc.DeflateRect( 1, 1 ); nTop --; diff --git a/Envy/WndSecurity.cpp b/Envy/WndSecurity.cpp index 8baa5c7..ee692b0 100644 --- a/Envy/WndSecurity.cpp +++ b/Envy/WndSecurity.cpp @@ -1,7 +1,7 @@ // // WndSecurity.cpp // -// This file is part of Envy (getenvy.com) © 2016 +// This file is part of Envy (getenvy.com) © 2016-2017 // Portions copyright PeerProject 2008-2014 and Shareaza 2002-2007 // // Envy is free software. You may redistribute and/or modify it @@ -457,7 +457,7 @@ void CSecurityWnd::OnSecurityExport() } else // Generate .XML { - auto_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"security" ) ); + unique_ptr< CXMLElement > pXML( new CXMLElement( NULL, L"security" ) ); pXML->AddAttribute( L"xmlns", CSecurity::xmlns ); diff --git a/Envy/ZIPFile.cpp b/Envy/ZIPFile.cpp index 8ee757f..ac57538 100644 --- a/Envy/ZIPFile.cpp +++ b/Envy/ZIPFile.cpp @@ -382,7 +382,7 @@ CBuffer* CZIPFile::File::Decompress() if ( ! PrepareToDecompress( pStream ) ) return NULL; - auto_ptr< CBuffer > pTarget( new CBuffer() ); + unique_ptr< CBuffer > pTarget( new CBuffer() ); if ( ! pTarget.get() ) return NULL; diff --git a/Plugins/ShortURL/ShortURL.vcxproj b/Plugins/ShortURL/ShortURL.vcxproj index be4246b..1fa0eda 100644 --- a/Plugins/ShortURL/ShortURL.vcxproj +++ b/Plugins/ShortURL/ShortURL.vcxproj @@ -126,7 +126,6 @@ ws2_32.lib;Wininet.lib;%(AdditionalDependencies) ws2_32.dll;Wininet.dll;%(DelayLoadDLLs) - true true true ShortURL.def @@ -168,7 +167,6 @@ ws2_32.lib;Wininet.lib;%(AdditionalDependencies) ws2_32.dll;Wininet.dll;%(DelayLoadDLLs) - true true ShortURL.def true @@ -214,7 +212,6 @@ ShortURL.def ws2_32.lib;Wininet.lib;%(AdditionalDependencies) ws2_32.dll;Wininet.dll;%(DelayLoadDLLs) - true true true true @@ -261,7 +258,6 @@ ws2_32.lib;Wininet.lib;%(AdditionalDependencies) ws2_32.dll;Wininet.dll;%(DelayLoadDLLs) ShortURL.def - true true true true