Skip to content

Commit

Permalink
Fix MacOS UTF-8 normalization issue
Browse files Browse the repository at this point in the history
Signed-off-by: xavi-b <developer@xavi-b.fr>
  • Loading branch information
xavi-b authored and claucambra committed Apr 23, 2023
1 parent e57fd7d commit 5113802
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/common/syncjournaldb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,10 +882,15 @@ QVector<QByteArray> SyncJournalDb::tableColumns(const QByteArray &table)

qint64 SyncJournalDb::getPHash(const QByteArray &file)
{
QByteArray bytes = file;
#ifdef Q_OS_MAC
bytes = QString::fromUtf8(file).normalized(QString::NormalizationForm_C).toUtf8();
#endif

qint64 h = 0;
int len = file.length();
int len = bytes.length();

h = c_jhash64((uint8_t *)file.data(), len, 0);
h = c_jhash64((uint8_t *)bytes.data(), len, 0);
return h;
}

Expand Down

0 comments on commit 5113802

Please sign in to comment.