static int CompareUpdateItems(const CRefItem *p1, const CRefItem *p2, void *param) { const CRefItem &a1 = *p1; const CRefItem &a2 = *p2; const CUpdateItem &u1 = *a1.UpdateItem; const CUpdateItem &u2 = *a2.UpdateItem; int n; if (u1.IsDirectory != u2.IsDirectory) { if (u1.IsDirectory) return u1.IsAnti ? 1: -1; return u2.IsAnti ? -1: 1; } if (u1.IsDirectory) { if (u1.IsAnti != u2.IsAnti) return (u1.IsAnti ? 1 : -1); n = MyStringCompareNoCase(u1.Name, u2.Name); return (u1.IsAnti ? (-n) : n); } if (a1.SortByType) { RINOZ(MyStringCompareNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos)); RINOZ(MyStringCompareNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos)); if (u1.LastWriteTimeIsDefined && u2.LastWriteTimeIsDefined) RINOZ(CompareFileTime(&u1.LastWriteTime, &u2.LastWriteTime)); RINOZ(MyCompare(u1.Size, u2.Size)) }
static int CompareUpdateItems(const CRefItem *p1, const CRefItem *p2, void *param) { const CRefItem &a1 = *p1; const CRefItem &a2 = *p2; const CUpdateItem &u1 = *a1.UpdateItem; const CUpdateItem &u2 = *a2.UpdateItem; int n; if (u1.IsDir != u2.IsDir) return (u1.IsDir) ? 1 : -1; if (u1.IsDir) { if (u1.IsAnti != u2.IsAnti) return (u1.IsAnti ? 1 : -1); n = MyStringCompareNoCase(u1.Name, u2.Name); return -n; } bool sortByType = *(bool *)param; if (sortByType) { RINOZ_COMP(a1.ExtensionIndex, a2.ExtensionIndex); RINOZ(MyStringCompareNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos)); RINOZ(MyStringCompareNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos)); if (!u1.MTimeDefined && u2.MTimeDefined) return 1; if (u1.MTimeDefined && !u2.MTimeDefined) return -1; if (u1.MTimeDefined && u2.MTimeDefined) RINOZ_COMP(u1.MTime, u2.MTime); RINOZ_COMP(u1.Size, u2.Size); } return MyStringCompareNoCase(u1.Name, u2.Name); }
static int CompareUpdateItems(const CRefItem *p1, const CRefItem *p2, void *param) { const CRefItem &a1 = *p1; const CRefItem &a2 = *p2; const CUpdateItem &u1 = *a1.UpdateItem; const CUpdateItem &u2 = *a2.UpdateItem; int n; if (u1.IsDirectory != u2.IsDirectory) return (u1.IsDirectory) ? 1 : -1; if (u1.IsDirectory) { if (u1.IsAnti != u2.IsAnti) return (u1.IsAnti ? 1 : -1); n = MyStringCompareNoCase(u1.Name, u2.Name); return -n; } bool sortByType = *(bool *)param; if (sortByType) { RINOZ(MyCompare(a1.ExtensionIndex, a2.ExtensionIndex)) RINOZ(MyStringCompareNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos)); RINOZ(MyStringCompareNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos)); if (u1.IsLastWriteTimeDefined && u2.IsLastWriteTimeDefined) RINOZ(CompareFileTime(&u1.LastWriteTime, &u2.LastWriteTime)); RINOZ(MyCompare(u1.Size, u2.Size)) } return MyStringCompareNoCase(u1.Name, u2.Name); }
int CompareItems(void *const *a1, void *const *a2, void * /* param */) { const CItem &i1 = **((const CItem **)a1); const CItem &i2 = **((const CItem **)a2); if (i1.isDir() != i2.isDir()) return (i1.isDir()) ? 1 : -1; if (i1.isDir()) return -MyStringCompareNoCase(i1.Name, i2.Name); int res = MyCompare(i1.StreamIndex, i2.StreamIndex); if (res != 0) return res; return MyStringCompareNoCase(i1.Name, i2.Name); }
static bool IsExeExt(const wchar_t *ext) { for (int i = 0; i < ARRAY_SIZE(g_ExeExts); i++) if (MyStringCompareNoCase(ext, g_ExeExts[i]) == 0) return true; return false; }
static int CompareEmptyItems(const int *p1, const int *p2, void *param) { const CObjectVector<CUpdateItem> &updateItems = *(const CObjectVector<CUpdateItem> *)param; const CUpdateItem &u1 = updateItems[*p1]; const CUpdateItem &u2 = updateItems[*p2]; if (u1.IsDir != u2.IsDir) return (u1.IsDir) ? 1 : -1; if (u1.IsDir) { if (u1.IsAnti != u2.IsAnti) return (u1.IsAnti ? 1 : -1); int n = MyStringCompareNoCase(u1.Name, u2.Name); return -n; } if (u1.IsAnti != u2.IsAnti) return (u1.IsAnti ? 1 : -1); return MyStringCompareNoCase(u1.Name, u2.Name); }
static int FindInSorted_Ext(const CObjectVector<CExtIconPair> &vect, const wchar_t *ext, int &insertPos) { unsigned left = 0, right = vect.Size(); while (left != right) { unsigned mid = (left + right) / 2; int compare = MyStringCompareNoCase(ext, vect[mid].Ext); if (compare == 0) return mid; if (compare < 0) right = mid; else left = mid + 1; } insertPos = left; return -1; }
int MyStringCompareNoCase(const char *s1, const char *s2) { return MyStringCompareNoCase(MultiByteToUnicodeString(s1), MultiByteToUnicodeString(s2)); }
static int ComparePairIDs(const UString &s1, const UString &s2) { return MyStringCompareNoCase(s1, s2); }
static int CompareFiles(const CFileItem &f1, const CFileItem &f2) { return MyStringCompareNoCase(f1.Name, f2.Name); }