Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/dfm-io/dfm-io/denumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ bool DEnumeratorPrivate::checkFilter()
bool DEnumeratorPrivate::openDirByfts()
{
char *paths[2] = { nullptr, nullptr };
paths[0] = strdup(filePath(uri));
paths[0] = strdup(filePath(uri).constData());
if (!paths[0]) {
error.setCode(DFMIOErrorCode::DFM_IO_ERROR_FAILED);
return false;
}
int (*compare)(const FTSENT **, const FTSENT **);
compare = nullptr;
if (sortRoleFlag == DEnumerator::SortRoleCompareFlag::kSortRoleCompareFileName) {
Expand Down Expand Up @@ -364,15 +368,15 @@ void DEnumeratorPrivate::setQueryAttributes(const QString &attributes)
queryAttributes = attributes;
}

char *DEnumeratorPrivate::filePath(const QUrl &url)
QByteArray DEnumeratorPrivate::filePath(const QUrl &url)
{
if (url.userInfo().startsWith("originPath::"))
return url.userInfo().replace("originPath::", "").toLatin1().data();
return url.userInfo().replace("originPath::", "").toLatin1();

QString path = url.path();
if (path != "/" && path.endsWith("/"))
path = path.left(path.length() - 1);
return path.toUtf8().data();
return path.toUtf8();
}

QUrl DEnumeratorPrivate::buildUrl(const QUrl &url, const char *fileName)
Expand Down Expand Up @@ -776,7 +780,8 @@ QList<QSharedPointer<DEnumerator::SortFileInfo>> DEnumerator::sortFileInfoList()
QSet<QString> hideList;
QUrl urlHidden = d->buildUrl(d->uri, ".hidden");
hideList = DLocalHelper::hideListFromUrl(urlHidden);
const char *dirPath = d->filePath(d->uri);
QByteArray dirPathBa = d->filePath(d->uri);
const char *dirPath = dirPathBa.constData();
while (1) {
FTSENT *ent = fts_read(d->fts);

Expand Down
2 changes: 1 addition & 1 deletion src/dfm-io/dfm-io/private/denumerator_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DEnumeratorPrivate : public QObject, public QEnableSharedFromThis<DEnumera
bool hasNext();
QList<QSharedPointer<DFileInfo>> fileInfoList();
void setQueryAttributes(const QString &attributes);
char *filePath(const QUrl &url);
QByteArray filePath(const QUrl &url);
QUrl buildUrl(const QUrl &url, const char *fileName);

static void enumUriAsyncCallBack(GObject *sourceObject,
Expand Down
2 changes: 0 additions & 2 deletions src/dfm-io/tools/dfm-list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
// SPDX-License-Identifier: GPL-3.0-or-later

#include <dfm-io/dfmio_global.h>
#include <dfm-io/denumerator.h>

Check warning on line 6 in src/dfm-io/tools/dfm-list.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <dfm-io/denumerator.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <dfm-io/denumeratorfuture.h>

Check warning on line 7 in src/dfm-io/tools/dfm-list.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <dfm-io/denumeratorfuture.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <stdio.h>

#include <QDebug>

Check warning on line 9 in src/dfm-io/tools/dfm-list.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDebug> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QUrl>

Check warning on line 10 in src/dfm-io/tools/dfm-list.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QUrl> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QCoreApplication>

Check warning on line 11 in src/dfm-io/tools/dfm-list.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QCoreApplication> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QThread>
#include <QtConcurrent>

Expand Down
Loading