replaced UC with _Bool

This commit is contained in:
Václav Šmejkal 2022-07-22 18:22:42 +02:00
parent 340834adf6
commit cfdfd2aa2c
No known key found for this signature in database
GPG Key ID: FD749A97DF2D5E19
4 changed files with 12 additions and 12 deletions

View File

@ -29,9 +29,9 @@
typedef struct
{
unsigned char noCheck; //BOOLEAN FOR SKIPPING VERSION CHECK
unsigned char noOutput; //BOOLEAN FOR NOT PRINTING OUTPUT WHEN ENCRYPTING/DECRYPTING
unsigned char update; //BOOLEAN FOR UPDATING YOUR WHY VERSION IF OLD IS USED
_Bool noCheck; //BOOLEAN FOR SKIPPING VERSION CHECK
_Bool noOutput; //BOOLEAN FOR NOT PRINTING OUTPUT WHEN ENCRYPTING/DECRYPTING
_Bool update; //BOOLEAN FOR UPDATING YOUR WHY VERSION IF OLD IS USED
} inputFlags;
typedef struct
@ -40,7 +40,7 @@ typedef struct
char *usedKey; //VARIABLE FOR USED/GENERATED KEY
unsigned long unusedKeySize; //VARIABLE FOR COUNT OF UNUSED CHARACTERS IN KEY
unsigned long elapsedTime; //VARIABLE FOR ELAPSED TIME IN MICROSECONDS => 1s = 1000000µs
unsigned char exitCode; //VARIABLE FOR EXIT CODE
_Bool exitCode; //VARIABLE FOR EXIT CODE
} outputFlags;
//NOTE: Variables were moved to 'flags.c' to force y'all using getters
@ -50,7 +50,7 @@ char getEncryptionSeparator();
unsigned long getKeyLength();
inputFlags defaultFlags(); //THIS GENERATES inputFlags WITH DEFAULT VALUES
inputFlags getFlags(); //RETURNS USED FLAGS
outputFlags noOutput(unsigned char exitCode); //SAME AS defaultFlags() BUT FOR outputFlags
outputFlags noOutput(_Bool exitCode); //SAME AS defaultFlags() BUT FOR outputFlags
//SETTERS
void setEncryptionSeparator(char encryptionSeparatorNew);

View File

@ -7,9 +7,9 @@
void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION
void deallocateOutput(outputFlags flags); //DEALLOCATES flags
unsigned char checkVersion(); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED
unsigned char checkKey(char *key); //CHECKS IF KEY IS VALID
unsigned char checkText(char *text); //CHECKS IF TEXT IS VALID
_Bool checkVersion(); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED
_Bool checkKey(char *key); //CHECKS IF KEY IS VALID
_Bool 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 compareTimeMicro(struct timeval startTime, struct timeval finishTime); //COMPARE TIMES IN MICROSECONDS

View File

@ -31,7 +31,7 @@ inputFlags getFlags()
return flags;
}
outputFlags noOutput(unsigned char exitCode)
outputFlags noOutput(_Bool exitCode)
{
char *emptyText = malloc(1); //TEXT
emptyText[0] = '\0';

View File

@ -72,7 +72,7 @@ char *replaceWord(char *string, char *old, char *new) //CODE FROM: https://www.g
return result;
}
unsigned char checkVersion()
_Bool checkVersion()
{
if (getFlags().noCheck) return SUCCESS;
@ -301,7 +301,7 @@ void deallocateOutput(outputFlags flags)
free(flags.usedKey);
}
unsigned char checkKey(char *key)
_Bool checkKey(char *key)
{
if (strlen(key) < getKeyLength())
{
@ -312,7 +312,7 @@ unsigned char checkKey(char *key)
return SUCCESS;
}
unsigned char checkText(char *text)
_Bool checkText(char *text)
{
if (strcmp(text, "") == 0)
{