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 typedef struct
{ {
unsigned char noCheck; //BOOLEAN FOR SKIPPING VERSION CHECK _Bool noCheck; //BOOLEAN FOR SKIPPING VERSION CHECK
unsigned char noOutput; //BOOLEAN FOR NOT PRINTING OUTPUT WHEN ENCRYPTING/DECRYPTING _Bool noOutput; //BOOLEAN FOR NOT PRINTING OUTPUT WHEN ENCRYPTING/DECRYPTING
unsigned char update; //BOOLEAN FOR UPDATING YOUR WHY VERSION IF OLD IS USED _Bool update; //BOOLEAN FOR UPDATING YOUR WHY VERSION IF OLD IS USED
} inputFlags; } inputFlags;
typedef struct typedef struct
@ -40,7 +40,7 @@ typedef struct
char *usedKey; //VARIABLE FOR USED/GENERATED KEY char *usedKey; //VARIABLE FOR USED/GENERATED KEY
unsigned long unusedKeySize; //VARIABLE FOR COUNT OF UNUSED CHARACTERS IN 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 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; } outputFlags;
//NOTE: Variables were moved to 'flags.c' to force y'all using getters //NOTE: Variables were moved to 'flags.c' to force y'all using getters
@ -50,7 +50,7 @@ char getEncryptionSeparator();
unsigned long getKeyLength(); unsigned long getKeyLength();
inputFlags defaultFlags(); //THIS GENERATES inputFlags WITH DEFAULT VALUES inputFlags defaultFlags(); //THIS GENERATES inputFlags WITH DEFAULT VALUES
inputFlags getFlags(); //RETURNS USED FLAGS 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 //SETTERS
void setEncryptionSeparator(char encryptionSeparatorNew); void setEncryptionSeparator(char encryptionSeparatorNew);

View File

@ -7,9 +7,9 @@
void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION
void deallocateOutput(outputFlags flags); //DEALLOCATES flags void deallocateOutput(outputFlags flags); //DEALLOCATES flags
unsigned char checkVersion(); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED _Bool checkVersion(); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED
unsigned char checkKey(char *key); //CHECKS IF KEY IS VALID _Bool checkKey(char *key); //CHECKS IF KEY IS VALID
unsigned char checkText(char *text); //CHECKS IF TEXT IS VALID _Bool checkText(char *text); //CHECKS IF TEXT IS VALID
unsigned long countIntLength(int number); //RETURNS LENGTH OF number unsigned long countIntLength(int number); //RETURNS LENGTH OF number
unsigned long countUnusedKeySize(char *text, char *key); //COUNT unusedKeySize unsigned long countUnusedKeySize(char *text, char *key); //COUNT unusedKeySize
unsigned long compareTimeMicro(struct timeval startTime, struct timeval finishTime); //COMPARE TIMES IN MICROSECONDS unsigned long compareTimeMicro(struct timeval startTime, struct timeval finishTime); //COMPARE TIMES IN MICROSECONDS

View File

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

View File

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