From d82d45d6b6a1c8cc2da3f8a797fe4fdcd58832f8 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 30 Aug 2024 17:11:42 +0600 Subject: [PATCH] Added 2 size functions --- source/libublsettings.c | 30 ++++++++++++++++++++++++++++++ source/libublsettings.h | 4 ++++ 2 files changed, 34 insertions(+) diff --git a/source/libublsettings.c b/source/libublsettings.c index 783a43f..efe1670 100644 --- a/source/libublsettings.c +++ b/source/libublsettings.c @@ -919,6 +919,36 @@ float yon_size_convert_automatic(int bytes, int *size){ return byte_float; } +int yon_get_size_get_from_letter(char size){ + switch (size){ + case 'K': return 0; + break; + case 'M': return 1; + break; + case 'G': return 2; + break; + case 'T': return 0; + break; + default: return -1; + break; + } +} + +char *yon_size_get_mod(int size){ + char *size_modifier = NULL; + switch (size){ + case 0: size_modifier = "K"; + break; + case 1: size_modifier = "M"; + break; + case 2: size_modifier = "G"; + break; + case 3: size_modifier = "T"; + break; + } + return size_modifier; +} + config_str yon_dir_get_contents(char *dir_path, int *size){ config_str dir = NULL; *size=0; diff --git a/source/libublsettings.h b/source/libublsettings.h index c48a649..f576c6d 100644 --- a/source/libublsettings.h +++ b/source/libublsettings.h @@ -568,6 +568,10 @@ config_str yon_ubl_get_all_users(int *user_size); */ float yon_size_convert_automatic(int bytes, int *size); +int yon_get_size_get_from_letter(char size); + +char *yon_size_get_mod(int size); + apps *yon_apps_scan_and_parse_desktops(int *sizef); void yon_apps_sort(apps *applist, int size);