diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-07-24 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:52 +0300 |
commit | 980e181dcc9d64312a4dddfa58f80770506f27f5 (patch) | |
tree | 4ab20c1b4c7ebfe0f5fbf39ec2ce2cd3022ebf66 /CPP/7zip/UI/Common/SortUtils.cpp | |
parent | 7038848692e7049234f223703522681a19db49a5 (diff) |
4.50 beta
Diffstat (limited to 'CPP/7zip/UI/Common/SortUtils.cpp')
-rwxr-xr-x | CPP/7zip/UI/Common/SortUtils.cpp | 64 |
1 files changed, 3 insertions, 61 deletions
diff --git a/CPP/7zip/UI/Common/SortUtils.cpp b/CPP/7zip/UI/Common/SortUtils.cpp index 616472ff..061e7773 100755 --- a/CPP/7zip/UI/Common/SortUtils.cpp +++ b/CPP/7zip/UI/Common/SortUtils.cpp @@ -3,60 +3,15 @@ #include "StdAfx.h" #include "SortUtils.h" -#include "Common/Types.h" - -/* -template <class T> -void TSortRefDown(T *p, UInt32 k, UInt32 size, int (*compare)(const T*, const T*, void *), void *param) -{ - T temp = p[k]; - for (;;) - { - UInt32 s = (k << 1); - if (s > size) - break; - if (s < size && compare(p + s + 1, p + s, param) > 0) - s++; - if (compare(&temp, p + s, param) >= 0) - break; - p[k] = p[s]; - k = s; - } - p[k] = temp; -} - -template <class T> -void TSort(T* p, UInt32 size, int (*compare)(const T*, const T*, void *), void *param) -{ - if (size <= 1) - return; - p--; - { - UInt32 i = size / 2; - do - TSortRefDown(p, i, size, compare, param); - while(--i != 0); - } - do - { - T temp = p[size]; - p[size--] = p[1]; - p[1] = temp; - TSortRefDown(p, 1, size, compare, param); - } - while (size > 1); -} -*/ +#include "Common/Wildcard.h" static int CompareStrings(const int *p1, const int *p2, void *param) { const UStringVector &strings = *(const UStringVector *)param; - const UString &s1 = strings[*p1]; - const UString &s2 = strings[*p2]; - return s1.CompareNoCase(s2); + return CompareFileNames(strings[*p1], strings[*p2]); } -void SortStringsToIndices(const UStringVector &strings, CIntVector &indices) +void SortFileNames(const UStringVector &strings, CIntVector &indices) { indices.Clear(); int numItems = strings.Size(); @@ -64,17 +19,4 @@ void SortStringsToIndices(const UStringVector &strings, CIntVector &indices) for(int i = 0; i < numItems; i++) indices.Add(i); indices.Sort(CompareStrings, (void *)&strings); - // TSort(&indices.Front(), indices.Size(), CompareStrings, (void *)&strings); -} - -/* -void SortStrings(const UStringVector &src, UStringVector &dest) -{ - CIntVector indices; - SortStringsToIndices(src, indices); - dest.Clear(); - dest.Reserve(indices.Size()); - for (int i = 0; i < indices.Size(); i++) - dest.Add(src[indices[i]]); } -*/ |