Skip to content

Commit

Permalink
fix: Fixed the sorting crash issue
Browse files Browse the repository at this point in the history
Fixed the sorting crash issue

Bug: https://pms.uniontech.com/bug-view-275449.html
Log: Fixed the sorting crash issue
  • Loading branch information
pengfeixx authored and deepin-bot[bot] committed Oct 14, 2024
1 parent 1537869 commit ebdb79d
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/libdmusic/core/datamanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,39 +45,39 @@ static bool moreThanTimestampASC(MediaMeta v1, MediaMeta v2)
return v1.timestamp < v2.timestamp;
}

static bool moreThanTitleASC(const MediaMeta v1, const MediaMeta v2)
static bool moreThanTitleASC(const MediaMeta &v1, const MediaMeta &v2)
{
return v1.pinyinTitle.toLower() <= v2.pinyinTitle.toLower();
return v1.pinyinTitle.toLower() < v2.pinyinTitle.toLower();
}

static bool moreThanArtistASC(MediaMeta v1, MediaMeta v2)
static bool moreThanArtistASC(const MediaMeta &v1, const MediaMeta &v2)
{
return v1.pinyinArtist.toLower() <= v2.pinyinArtist.toLower();
return v1.pinyinArtist.toLower() < v2.pinyinArtist.toLower();
}

static bool moreThanAblumASC(const MediaMeta v1, const MediaMeta v2)
static bool moreThanAblumASC(const MediaMeta &v1, const MediaMeta &v2)
{
return v1.pinyinAlbum.toLower() <= v2.pinyinAlbum.toLower();
return v1.pinyinAlbum.toLower() < v2.pinyinAlbum.toLower();
}
// 降序
static bool moreThanTimestampDES(MediaMeta v1, MediaMeta v2)
{
return v1.timestamp > v2.timestamp;
}

static bool moreThanTitleDES(const MediaMeta v1, const MediaMeta v2)
static bool moreThanTitleDES(const MediaMeta &v1, const MediaMeta &v2)
{
return v1.pinyinTitle.toLower() >= v2.pinyinTitle.toLower();
return v1.pinyinTitle.toLower() > v2.pinyinTitle.toLower();
}

static bool moreThanArtistDES(MediaMeta v1, MediaMeta v2)
static bool moreThanArtistDES(const MediaMeta &v1, const MediaMeta &v2)
{
return v1.pinyinArtist.toLower() >= v2.pinyinArtist.toLower();
return v1.pinyinArtist.toLower() > v2.pinyinArtist.toLower();
}

static bool moreThanAblumDES(const MediaMeta v1, const MediaMeta v2)
static bool moreThanAblumDES(const MediaMeta &v1, const MediaMeta &v2)
{
return v1.pinyinAlbum.toLower() >= v2.pinyinAlbum.toLower();
return v1.pinyinAlbum.toLower() > v2.pinyinAlbum.toLower();
}

// 升序
Expand All @@ -86,19 +86,19 @@ static bool moreThanAlbumTimestampASC(AlbumInfo v1, AlbumInfo v2)
return v1.timestamp < v2.timestamp;
}

static bool moreThanAlbumTitleASC(const AlbumInfo v1, const AlbumInfo v2)
static bool moreThanAlbumTitleASC(const AlbumInfo &v1, const AlbumInfo &v2)
{
return v1.pinyin.toLower() <= v2.pinyin.toLower();
return v1.pinyin.toLower() < v2.pinyin.toLower();
}
// 降序
static bool moreThanAlbumTimestampDES(AlbumInfo v1, AlbumInfo v2)
static bool moreThanAlbumTimestampDES(const AlbumInfo &v1, const AlbumInfo &v2)
{
return v1.timestamp > v2.timestamp;
}

static bool moreThanAlbumTitleDES(const AlbumInfo v1, const AlbumInfo v2)
static bool moreThanAlbumTitleDES(const AlbumInfo &v1, const AlbumInfo &v2)
{
return v1.pinyin.toLower() >= v2.pinyin.toLower();
return v1.pinyin.toLower() > v2.pinyin.toLower();
}

// 升序
Expand All @@ -107,19 +107,19 @@ static bool moreThanArtistTimestampASC(ArtistInfo v1, ArtistInfo v2)
return v1.timestamp < v2.timestamp;
}

static bool moreThanArtistTitleASC(ArtistInfo v1, ArtistInfo v2)
static bool moreThanArtistTitleASC(const ArtistInfo &v1, const ArtistInfo &v2)
{
return v1.pinyin.toLower() <= v2.pinyin.toLower();
return v1.pinyin.toLower() < v2.pinyin.toLower();
}
// 降序
static bool moreThanArtistTimestampDES(ArtistInfo v1, ArtistInfo v2)
{
return v1.timestamp > v2.timestamp;
}

static bool moreThanArtistTitleDES(ArtistInfo v1, ArtistInfo v2)
static bool moreThanArtistTitleDES(const ArtistInfo &v1, const ArtistInfo &v2)
{
return v1.pinyin.toLower() >= v2.pinyin.toLower();
return v1.pinyin.toLower() > v2.pinyin.toLower();
}

class DataManagerPrivate
Expand Down

0 comments on commit ebdb79d

Please sign in to comment.