diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tagtree.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/tagtree.c b/apps/tagtree.c index 417b6f28f0..9eef38b5e6 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include "storage.h" | 53 | #include "storage.h" |
54 | #include "dir.h" | 54 | #include "dir.h" |
55 | #include "playback.h" | 55 | #include "playback.h" |
56 | #include "strnatcmp.h" | ||
56 | #include "panic.h" | 57 | #include "panic.h" |
57 | 58 | ||
58 | #define str_or_empty(x) (x ? x : "(NULL)") | 59 | #define str_or_empty(x) (x ? x : "(NULL)") |
@@ -791,6 +792,17 @@ static int compare(const void *p1, const void *p2) | |||
791 | return strncasecmp(e1->name, e2->name, MAX_PATH); | 792 | return strncasecmp(e1->name, e2->name, MAX_PATH); |
792 | } | 793 | } |
793 | 794 | ||
795 | static int nat_compare(const void *p1, const void *p2) | ||
796 | { | ||
797 | struct tagentry *e1 = (struct tagentry *)p1; | ||
798 | struct tagentry *e2 = (struct tagentry *)p2; | ||
799 | |||
800 | if (sort_inverse) | ||
801 | return strnatcasecmp(e2->name, e1->name); | ||
802 | |||
803 | return strnatcasecmp(e1->name, e2->name); | ||
804 | } | ||
805 | |||
794 | static void tagtree_buffer_event(void *data) | 806 | static void tagtree_buffer_event(void *data) |
795 | { | 807 | { |
796 | struct tagcache_search tcs; | 808 | struct tagcache_search tcs; |
@@ -1530,7 +1542,8 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1530 | struct tagentry *entries = get_entries(c); | 1542 | struct tagentry *entries = get_entries(c); |
1531 | qsort(&entries[special_entry_count], | 1543 | qsort(&entries[special_entry_count], |
1532 | current_entry_count - special_entry_count, | 1544 | current_entry_count - special_entry_count, |
1533 | sizeof(struct tagentry), compare); | 1545 | sizeof(struct tagentry), |
1546 | global_settings.interpret_numbers ? nat_compare : compare); | ||
1534 | } | 1547 | } |
1535 | 1548 | ||
1536 | if (!init) | 1549 | if (!init) |