loplugin:useuniqueptr
CMtaFolderPicker resp. its only derived class CWinFolderPickerImpl is only ever instantiated on the heap, so no harm in having that array directly as a member. Change-Id: I23312e34d3377a46b95a7ee059a2dbbf8f937422
This commit is contained in:
@@ -367,7 +367,7 @@ bool SAL_CALL CMtaFolderPicker::onBrowseForFolder( )
|
|||||||
// pre SHBrowseFroFolder
|
// pre SHBrowseFroFolder
|
||||||
|
|
||||||
m_bi.pidlRoot = nullptr;
|
m_bi.pidlRoot = nullptr;
|
||||||
m_bi.pszDisplayName = reinterpret_cast<LPWSTR>(m_pathBuff.get());
|
m_bi.pszDisplayName = reinterpret_cast<LPWSTR>(m_pathBuff);
|
||||||
|
|
||||||
if ( m_Description.getLength( ) )
|
if ( m_Description.getLength( ) )
|
||||||
m_bi.lpszTitle = reinterpret_cast<LPCWSTR>(m_Description.getStr( ));
|
m_bi.lpszTitle = reinterpret_cast<LPCWSTR>(m_Description.getStr( ));
|
||||||
@@ -428,9 +428,9 @@ OUString SAL_CALL CMtaFolderPicker::getPathFromItemIdList( LPCITEMIDLIST lpItemI
|
|||||||
|
|
||||||
if ( lpItemIdList )
|
if ( lpItemIdList )
|
||||||
{
|
{
|
||||||
bool bRet = SHGetPathFromIDListW( lpItemIdList, reinterpret_cast<LPWSTR>(m_pathBuff.get()) );
|
bool bRet = SHGetPathFromIDListW( lpItemIdList, reinterpret_cast<LPWSTR>(m_pathBuff) );
|
||||||
if ( bRet )
|
if ( bRet )
|
||||||
path = m_pathBuff.get( );
|
path = m_pathBuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
@@ -43,48 +43,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "../misc/WinImplHelper.hxx"
|
#include "../misc/WinImplHelper.hxx"
|
||||||
|
|
||||||
|
|
||||||
// a simple helper class used to provide a buffer for different
|
|
||||||
// Win32 file and directory functions
|
|
||||||
|
|
||||||
|
|
||||||
class CAutoPathBuff
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit CAutoPathBuff( size_t size = 0 )
|
|
||||||
{
|
|
||||||
if (0 == size)
|
|
||||||
size = 32000; // max path length under Win2000
|
|
||||||
|
|
||||||
pBuff = new sal_Unicode[size];
|
|
||||||
|
|
||||||
SAL_WARN_IF(!pBuff, "fpicker", "Could not allocate path buffer");
|
|
||||||
}
|
|
||||||
|
|
||||||
~CAutoPathBuff( )
|
|
||||||
{
|
|
||||||
delete [] pBuff;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator sal_Unicode*( )
|
|
||||||
{
|
|
||||||
OSL_PRECOND( pBuff,
|
|
||||||
"No path buffer allocated" );
|
|
||||||
return pBuff;
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Unicode* get( )
|
|
||||||
{
|
|
||||||
OSL_PRECOND( pBuff,
|
|
||||||
"No path buffer allocated" );
|
|
||||||
return pBuff;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
sal_Unicode* pBuff;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// the Mta-Ole clipboard class is for internal use only!
|
// the Mta-Ole clipboard class is for internal use only!
|
||||||
// only one instance of this class should be created, the
|
// only one instance of this class should be created, the
|
||||||
// user has to ensure this!
|
// user has to ensure this!
|
||||||
@@ -168,7 +126,7 @@ private:
|
|||||||
OUString m_displayDir;
|
OUString m_displayDir;
|
||||||
OUString m_SelectedDir;
|
OUString m_SelectedDir;
|
||||||
BROWSEINFOW m_bi;
|
BROWSEINFOW m_bi;
|
||||||
CAutoPathBuff m_pathBuff;
|
sal_Unicode m_pathBuff[32000]; // max path length under Win2000
|
||||||
HINSTANCE m_hInstance;
|
HINSTANCE m_hInstance;
|
||||||
|
|
||||||
// the request window class has to be registered only
|
// the request window class has to be registered only
|
||||||
|
Reference in New Issue
Block a user