From 5674fb7e3cc9b9060edc3df0fec596a18167e328 Mon Sep 17 00:00:00 2001 From: luca0N! <63941044+luca0N@users.noreply.github.com> Date: Sat, 27 Jun 2020 13:12:52 -0300 Subject: [PATCH] Made strings consistent --- main.c | 22 +++++++++++----------- str.h | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/main.c b/main.c index 31c872c..6da9bb3 100644 --- a/main.c +++ b/main.c @@ -75,7 +75,7 @@ void cleanDir(const char* path, unsigned* objectCount, unsigned long* totalDelet strcpy(wildPath, validPath); strcat(wildPath, "*"); - printf("%s %s\n", STR_CLEANING_DIR, wildPath); + printf(STR_CLEANING_DIR, wildPath); // Fetch files in dir WIN32_FIND_DATA data; HANDLE hFind = FindFirstFile(wildPath, &data); @@ -86,7 +86,7 @@ void cleanDir(const char* path, unsigned* objectCount, unsigned long* totalDelet iteration++; if (iteration <= 2) continue; - printf("%s %s\n", STR_FOUND_ITEM, data.cFileName); + printf(STR_FOUND_ITEM, data.cFileName); // Attempt to delete item... int pathSize = strlen(wildPath) + strlen(data.cFileName); @@ -130,7 +130,7 @@ void cleanDir(const char* path, unsigned* objectCount, unsigned long* totalDelet setConsoleColor(RESET_CONSOLE_COLOR); } else { setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_BLUE); - printf(" %s\n", STR_DELETED_FILE); + printf(STR_DELETED_FILE); // Update the deleted object count if the process was successful. (*objectCount)++; (*totalDeletedBytes) += length; @@ -149,7 +149,7 @@ void getAdditionalDirs(bool safeMode){ printf("\n%s\n", STR_FETCHING_ADD_DIRS); int dirs; dirs = GetPrivateProfileInt("Pastas", "Pastas", 3, PATH_CFG); - printf("%s %d\n", STR_DIR_COUNT, dirs); + printf(STR_DIR_COUNT, dirs); fflush(stdout); for(unsigned short x = 0; x < dirs; x++){ char dirKey[7] = "Pasta"; @@ -216,25 +216,25 @@ void getAdditionalDirs(bool safeMode){ continue; } - printf("%s [%s] %s\n", STR_FOUND_DIR, dirKey, currentPath); + printf(STR_FOUND_DIR, dirKey, currentPath); if (!safeMode) cleanDir(currentPath, &objectCount, &totalDeletedBytes); } setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_GREEN); - printf(FMT_STR_OBJECT_COUNT, objectCount); + printf(STR_OBJECT_COUNT, objectCount); // Determine whether we should output the size as bytes, KiB, MiB or GiB. if (totalDeletedBytes < 1024){ - printf(FMT_STR_TOTAL_DELETED_BYTES, totalDeletedBytes); + printf(STR_TOTAL_DELETED_BYTES, totalDeletedBytes); } else if (totalDeletedBytes < (unsigned long) pow(1024, 2)){ float kib = (unsigned long) totalDeletedBytes / pow(1024, 1); - printf(FMT_STR_TOTAL_DELETED_KIBIBYTES, kib); + printf(STR_TOTAL_DELETED_KIBIBYTES, kib); } else if (totalDeletedBytes < (unsigned long) pow(1024, 3)){ float mib = (unsigned long) totalDeletedBytes / pow(1024, 2);// / (float) 1024 / (float) 1024; - printf(FMT_STR_TOTAL_DELETED_MEBIBYTES, mib); + printf(STR_TOTAL_DELETED_MEBIBYTES, mib); } else { float gib = (unsigned long) totalDeletedBytes / pow(1024, 3); - printf(FMT_STR_TOTAL_DELETED_GIBIBYTES, gib); + printf(STR_TOTAL_DELETED_GIBIBYTES, gib); } setConsoleColor(RESET_CONSOLE_COLOR); } @@ -251,7 +251,7 @@ int main(void){ printf("%s\n%s\n\n", PROGRAM_COPYRIGHT, STR_LN); setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_YELLOW); - printf(FMT_STR_TAMPER_WARNING); + printf(STR_TAMPER_WARNING); unsigned int ignoreWarning = GetPrivateProfileInt("Geral", "IgnorarAlerta", 0, PATH_CFG); unsigned int licenseAccepted = GetPrivateProfileInt("Geral", "AceitarLicença", 0, PATH_CFG); if (!ignoreWarning || !licenseAccepted){ diff --git a/str.h b/str.h index 6a1ebf3..29ad18f 100644 --- a/str.h +++ b/str.h @@ -22,27 +22,27 @@ #define STR_LN "--------------------------------------" -#define FMT_STR_TAMPER_WARNING "Este programa é distribuído gratuitamente em na licença GNU General Public License versão 3. Você deve ter recebido um arquivo chamado \"LICENSE\" junto com este programa. O arquivo de licença pode ter sido modificado por alguma outra pessoa. Visite na ocorrência em que o arquivo não seja genuíno.\n" +#define STR_TAMPER_WARNING "Este programa é distribuído gratuitamente em na licença GNU General Public License versão 3. Você deve ter recebido um arquivo chamado \"LICENSE\" junto com este programa. O arquivo de licença pode ter sido modificado por alguma outra pessoa. Visite na ocorrência em que o arquivo não seja genuíno.\n" #define STR_USE_WARNING "Aviso: é recomendado fechar todos os programas abertos antes de utilizar este programa para poder remover mais arquivos temporários. Deseja continuar? (s/n)" #define STR_FETCHING_ADD_DIRS "Recolhendo pastas adicionais..." -#define STR_CLEANING_DIR "[Limpando pasta]" -#define STR_DELETED_FILE "[Arquivo removido]" -#define STR_DELETED_DIR "[Pasta removida]" -#define STR_DIR_COUNT "[Contagem de pastas]" -#define STR_FOUND_DIR "[Pasta encontrada]" -#define STR_FOUND_FILE "[Arquivo encontrado]" -#define STR_FOUND_ITEM "[Item encontrado]" +#define STR_CLEANING_DIR "[Limpando pasta] %s\n" +#define STR_DELETED_FILE " [Arquivo removido]\n" +#define STR_DELETED_DIR "[Pasta removida] %s\n" +#define STR_DIR_COUNT "[Contagem de pastas] %d\n" +#define STR_FOUND_DIR "[Pasta encontrada] [%s] %s\n" +#define STR_FOUND_FILE "[Arquivo encontrado] %s\n" +#define STR_FOUND_ITEM "[Item encontrado] %s\n" #define STR_FAILED_DIR_LIST "Um erro ocorreu ao tentar enumerar os arquivos dentro de uma pasta especificada." #define STR_FAILED_FILE "[Arquivo mantido] Não foi possível apagar este arquivo pelo seguinte erro:" #define STR_FAILED_DIR "[Pasta mantida] Não foi possível apagar esta pasta pelo seguinte erro:" -#define FMT_STR_OBJECT_COUNT "[Relatório] %u objetos foram apagados com sucesso.\n" -#define FMT_STR_TOTAL_DELETED_BYTES "[Relatório] %lu baites ou mais foram liberados." -#define FMT_STR_TOTAL_DELETED_KIBIBYTES "[Relatório] %.2f KiB ou mais foram liberados." -#define FMT_STR_TOTAL_DELETED_MEBIBYTES "[Relatório] %.2f MiB ou mais foram liberados." -#define FMT_STR_TOTAL_DELETED_GIBIBYTES "[Relatório] %.2f GiB ou mais foram liberados." +#define STR_OBJECT_COUNT "[Relatório] %u objetos foram apagados com sucesso.\n" +#define STR_TOTAL_DELETED_BYTES "[Relatório] %lu baites ou mais foram liberados." +#define STR_TOTAL_DELETED_KIBIBYTES "[Relatório] %.2f KiB ou mais foram liberados." +#define STR_TOTAL_DELETED_MEBIBYTES "[Relatório] %.2f MiB ou mais foram liberados." +#define STR_TOTAL_DELETED_GIBIBYTES "[Relatório] %.2f GiB ou mais foram liberados." #define STR_MEM_ERR "[Erro fatal] Não foi possível alocar memória. Tente fechar alguns programas abertos e tente novamente."