changed all other checking functions type to int

This commit is contained in:
Václav Šmejkal 2022-06-12 16:35:43 +02:00
parent d196818ec0
commit 827331c2ff
No known key found for this signature in database
GPG Key ID: FD749A97DF2D5E19
2 changed files with 7 additions and 7 deletions

View File

@ -5,11 +5,11 @@
#include <why2/flags.h>
int checkVersion(inputFlags flags); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED
void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION
void deallocateOutput(outputFlags flags); //DEALLOCATES flags
void checkKey(char *key, inputFlags flags); //CHECKS IF KEY IS VALID
void checkText(char *text, inputFlags flags); //CHECKS IF TEXT IS VALID
int checkVersion(inputFlags flags); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED
int checkKey(char *key, inputFlags flags); //CHECKS IF KEY IS VALID
int checkText(char *text, inputFlags flags); //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

@ -287,21 +287,21 @@ void deallocateOutput(outputFlags flags)
free(flags.usedKey);
}
void checkKey(char *key, inputFlags flags)
int checkKey(char *key, inputFlags flags)
{
if (strlen(key) < getKeyLength())
{
if (!flags.noOutput) fprintf(stderr, "Key must be at least %lu characters long!\n", getKeyLength());
return noOutput(INVALID_KEY);
return INVALID_KEY;
}
}
void checkText(char *text, inputFlags flags)
int checkText(char *text, inputFlags flags)
{
if (strcmp(text, "") == 0)
{
if (!flags.noOutput) fprintf(stderr, "No text to encrypt!\n");
return noOutput(INVALID_TEXT);
return INVALID_TEXT;
}
}