diff --git a/include/flags.h b/include/flags.h index 3bce4dc..c4a0234 100644 --- a/include/flags.h +++ b/include/flags.h @@ -66,7 +66,7 @@ typedef struct unsigned long unusedKeySize; //VARIABLE FOR COUNT OF UNUSED CHARACTERS IN KEY unsigned long repeatedKeySize; //VARIABLE FOR COUNT OF REPEATED CHARACTERS IN KEY (basically reversed unusedKeySize) unsigned long elapsedTime; //VARIABLE FOR ELAPSED TIME IN MICROSECONDS => 1s = 1000000µs - why2_bool exitCode; //VARIABLE FOR EXIT CODE + enum EXIT_CODES exitCode; //VARIABLE FOR EXIT CODE } outputFlags; //NOTE: Variables were moved to 'flags.c' to force y'all using getters @@ -76,7 +76,7 @@ char getEncryptionSeparator(void); unsigned long getKeyLength(void); inputFlags getDefaultFlags(void); //THIS GENERATES inputFlags WITH DEFAULT VALUES inputFlags getFlags(void); //RETURNS USED FLAGS -outputFlags noOutput(why2_bool exitCode); //SAME AS getDefaultFlags() BUT FOR outputFlags +outputFlags noOutput(enum EXIT_CODES exitCode); //SAME AS getDefaultFlags() BUT FOR outputFlags encryptionOperation_type_cb getEncryptionOperation(void); //RETURNS FUNCTION WHICH IS USED FOR ENCRYPTION & DECRYPTION why2_bool getFlagsChanged(void); diff --git a/include/misc.h b/include/misc.h index e04d596..cf601cc 100644 --- a/include/misc.h +++ b/include/misc.h @@ -26,9 +26,9 @@ along with this program. If not, see . void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION void generateKey(char *key, int keyLength); //GENERATE ENCRYPTION KEY void deallocateOutput(outputFlags flags); //DEALLOCATES flags -why2_bool checkVersion(void); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED -why2_bool checkKey(char *key); //CHECKS IF KEY IS VALID -why2_bool checkText(char *text); //CHECKS IF TEXT IS VALID +enum EXIT_CODES checkVersion(void); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED +enum EXIT_CODES checkKey(char *key); //CHECKS IF KEY IS VALID +enum EXIT_CODES checkText(char *text); //CHECKS IF TEXT IS VALID unsigned long countIntLength(int number); //RETURNS LENGTH OF number unsigned long countUnusedKeySize(char *text, char *key); //COUNT unusedKeySize unsigned long countRepeatedKeySize(char *text, char *key); //COUNT repeatedKeySize diff --git a/src/core/lib/flags.c b/src/core/lib/flags.c index 2f68f72..fdfdca3 100644 --- a/src/core/lib/flags.c +++ b/src/core/lib/flags.c @@ -53,7 +53,7 @@ inputFlags getFlags(void) return flagsAllah; } -outputFlags noOutput(why2_bool exitCode) +outputFlags noOutput(enum EXIT_CODES exitCode) { char *emptyText = malloc(1); //TEXT emptyText[0] = '\0'; diff --git a/src/core/lib/misc.c b/src/core/lib/misc.c index 98a6a08..d6aef8b 100644 --- a/src/core/lib/misc.c +++ b/src/core/lib/misc.c @@ -87,7 +87,7 @@ char *replaceWord(char *string, char *old, char *new) //CODE FROM: https://www.g return result; } -why2_bool checkVersion(void) +enum EXIT_CODES checkVersion(void) { if (getFlags().noCheck) return SUCCESS; @@ -319,7 +319,7 @@ void deallocateOutput(outputFlags flags) flags.usedKey = NULL; } -why2_bool checkKey(char *key) +enum EXIT_CODES checkKey(char *key) { if (strlen(key) < getKeyLength()) { @@ -330,7 +330,7 @@ why2_bool checkKey(char *key) return SUCCESS; } -why2_bool checkText(char *text) +enum EXIT_CODES checkText(char *text) { if (strcmp(text, "") == 0) {