Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed sorting issue for large files #109

Merged
merged 1 commit into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([dfshow], [0.8.0], [https://github.com/roberthawdon/dfshow/issues])
AC_INIT([dfshow], [0.8.1], [https://github.com/roberthawdon/dfshow/issues])
AC_GNU_SOURCE
AM_INIT_AUTOMAKE([subdir-objects])
AC_PROG_CC
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.8.0-beta'
release = '0.8.1-beta'


# -- General configuration ---------------------------------------------------
Expand Down
38 changes: 31 additions & 7 deletions src/showfunctions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,32 +1275,56 @@ int cmp_dflist_name(const void *lhs, const void *rhs)

int cmp_dflist_date(const void *lhs, const void *rhs)
{
time_t compare;
int output;
results *dforderA = (results *)lhs;
results *dforderB = (results *)rhs;

if (reverse){
// Oldest to Newest
return (dforderA->date - dforderB->date);
compare = (dforderA->date - dforderB->date);
} else {
// Newest to Oldest
return (dforderB->date - dforderA->date);
compare = (dforderB->date - dforderA->date);
}

if (compare > 0){
output = 1;
} else if (compare < 0) {
output = -1;
} else {
output = 0;
}

return output;

}

int cmp_dflist_size(const void *lhs, const void *rhs)
{
ptrdiff_t compare;
int output;
results *dforderA = (results *)lhs;
results *dforderB = (results *)rhs;

if (reverse) {
// Smallest to largest
return (dforderA->size - dforderB->size);
if (reverse){
// Smallest to Largest
compare = (dforderA->size - dforderB->size);
} else {
// Largest to smallest
return (dforderB->size - dforderA->size);
// Largest to Smallest
compare = (dforderB->size - dforderA->size);
}

if (compare > 0){
output = 1;
} else if (compare < 0) {
output = -1;
} else {
output = 0;
}

return output;

}

int check_object(const char *object){
Expand Down