replaced some why2_bool with EXIT_CODES

This commit is contained in:
Václav Šmejkal 2023-01-27 16:14:04 +01:00
parent 5524a4b6e5
commit 1a209b8675
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
4 changed files with 9 additions and 9 deletions

View File

@ -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);

View File

@ -26,9 +26,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
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

View File

@ -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';

View File

@ -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)
{