Kaydet (Commit) f7214c70 authored tarafından Noel Grandin's avatar Noel Grandin

simplify UCB_GetFileListOfFolder

no need to use heap objects here

Change-Id: Iadc35b019da7b9446ede79c96a9d8ce8c6db81ef
Reviewed-on: https://gerrit.libreoffice.org/66315
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 6018adfa
......@@ -56,11 +56,10 @@ SW_DLLPUBLIC bool UCB_IsReadOnlyFileName( const OUString& rURL );
// options: pExtension = 0 -> all, else this specific extension
// pDateTime != 0 -> returns also the modified date/time of
// the files in a vector -->
// !! objects must be deleted from the caller!!
bool UCB_GetFileListOfFolder( const OUString& rURL,
std::vector<OUString>& rList,
const OUString* pExtension,
std::vector<DateTime*>* pDateTimeList = nullptr );
std::vector<DateTime>* pDateTimeList = nullptr );
// is the URL an existing file?
SW_DLLPUBLIC bool UCB_IsFile( const OUString& rURL );
......
......@@ -184,7 +184,7 @@ bool UCB_IsDirectory( const OUString& rURL )
bool UCB_GetFileListOfFolder( const OUString& rURL,
std::vector<OUString>& rList,
const OUString* pExtension,
std::vector< ::DateTime* >* pDateTimeList )
std::vector< ::DateTime >* pDateTimeList )
{
bool bOk = false;
try
......@@ -227,7 +227,7 @@ bool UCB_GetFileListOfFolder( const OUString& rURL,
if( pDateTimeList )
{
css::util::DateTime aStamp = xRow->getTimestamp(2);
::DateTime* pDateTime = new ::DateTime(
::DateTime aDateTime(
::Date( aStamp.Day,
aStamp.Month,
aStamp.Year ),
......@@ -235,7 +235,7 @@ bool UCB_GetFileListOfFolder( const OUString& rURL,
aStamp.Minutes,
aStamp.Seconds,
aStamp.NanoSeconds ));
pDateTimeList->push_back( pDateTime );
pDateTimeList->push_back( aDateTime );
}
}
......
......@@ -270,14 +270,14 @@ void SwGlossaryList::Update()
{
std::vector<OUString> aFoundGroupNames;
std::vector<OUString> aFiles;
std::vector<DateTime*> aDateTimeArr;
std::vector<DateTime> aDateTimeArr;
SWUnoHelper::UCB_GetFileListOfFolder( rPathArr[nPath], aFiles,
&sExt, &aDateTimeArr );
for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles )
{
const OUString aTitle = aFiles[ nFiles ];
::DateTime* pDT = aDateTimeArr[ nFiles ];
::DateTime& rDT = aDateTimeArr[ nFiles ];
OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() ));
......@@ -289,18 +289,15 @@ void SwGlossaryList::Update()
pFound = new AutoTextGroup;
pFound->sName = sName;
FillGroup( pFound, pGlossaries );
pFound->aDateModified = *pDT;
pFound->aDateModified = rDT;
aGroupArr.push_back(std::unique_ptr<AutoTextGroup>(pFound));
}
else if( pFound->aDateModified < *pDT )
else if( pFound->aDateModified < rDT )
{
FillGroup(pFound, pGlossaries);
pFound->aDateModified = *pDT;
pFound->aDateModified = rDT;
}
// don't need any more these pointers
delete pDT;
}
for( size_t i = aGroupArr.size(); i>0; )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment