1// SortUtils.cpp
2
3#include "StdAfx.h"
4
5#include "../../../Common/Wildcard.h"
6
7#include "SortUtils.h"
8
9static int CompareStrings(const unsigned *p1, const unsigned *p2, void *param)
10{
11  const UStringVector &strings = *(const UStringVector *)param;
12  return CompareFileNames(strings[*p1], strings[*p2]);
13}
14
15void SortFileNames(const UStringVector &strings, CUIntVector &indices)
16{
17  unsigned numItems = strings.Size();
18  indices.ClearAndSetSize(numItems);
19  unsigned *vals = &indices[0];
20  for (unsigned i = 0; i < numItems; i++)
21    vals[i] = i;
22  indices.Sort(CompareStrings, (void *)&strings);
23}
24