Skip to content

Commit

Permalink
Revert sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillem96 authored Jan 3, 2019
1 parent 4c63cee commit 276ff27
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions src/utils/dirlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "mem/heap.h"
#include "utils/types.h"

#define NUMBER_OCCURR 4

char *dirlist(const char *directory, const char *pattern, bool includeHiddenFiles)
{
u8 max_entries = 61;
Expand All @@ -32,7 +30,6 @@ char *dirlist(const char *directory, const char *pattern, bool includeHiddenFile
static FILINFO fno;

char *dir_entries = (char *)calloc(max_entries, 256);
char *occurrences[NUMBER_OCCURR] = {"nx", " os", "Sxos", "Biskeydump"};
char *temp = (char *)calloc(1, 256);

if (!pattern && !f_opendir(&dir, directory))
Expand Down Expand Up @@ -76,53 +73,6 @@ char *dirlist(const char *directory, const char *pattern, bool includeHiddenFile
return NULL;
}

// Fix cap in a static and more good-looking way
for(i = 0; i < k; i++)
{
j = i * 256;
while(dir_entries[j])
{
if(j % 256 == 0) // first letter
{
if(dir_entries[j] >= 'a' && dir_entries[j] <= 'z') // and lower cap
{
dir_entries[j] -= 32; // make it upper
}
}
else if(dir_entries[j] >= 'A' && dir_entries[j] <= 'Z') // not first letter but upper
{
dir_entries[j] += 32; // make it lower
}
j++;
}

// find any occurrence in strings
char *index;
for(j = 0; j < NUMBER_OCCURR; j++)
{
index = strstr(&dir_entries[i * 256], occurrences[j]);
if(index)
{
size_t size = strlen(occurrences[j]);
switch(j)
{
case 0:
memcpy(index, "NX", size);
break;
case 1:
memcpy(index, " OS", size);
break;
case 2:
memcpy(index, "SxOS", size);
break;
case 3:
memcpy(index, "BisKeyDump", size);
break;
}
}
}
}

for (i = 0; i < k - 1 ; i++)
{
for (j = i + 1; j < k; j++)
Expand Down

0 comments on commit 276ff27

Please sign in to comment.