From fc3943ad79a51554fd0736e8fcaed120462d2339 Mon Sep 17 00:00:00 2001 From: Seppia Date: Wed, 31 Jan 2018 03:50:00 +0100 Subject: Change integer types declarations Use respectively int64_t and uint64_t in place of int and and unsigned int for better compatibility with non x86_64 compilers. --- src/onetimebluh.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/onetimebluh.c b/src/onetimebluh.c index d657904..c282c1a 100644 --- a/src/onetimebluh.c +++ b/src/onetimebluh.c @@ -7,22 +7,22 @@ #include #include -void xor (int ed, char* mess, char* keyf, char* outp); /* operates the bitwise XOR between mess and keyf and puts the output to outp */ -void keyrand (long int nb, char* outp); /* generates random numbers using RAND_bytes from openssl and puts them into outp */ -void bluh (int c, char* mess, char* outp, char* ch); /* performs the binary dump of the input file and prints that to outp */ +void xor (int64_t ed, char* mess, char* keyf, char* outp); /* operates the bitwise XOR between mess and keyf and puts the output to outp */ +void keyrand (int64_t nb, char* outp); /* generates random numbers using RAND_bytes from openssl and puts them into outp */ +void bluh (int64_t c, char* mess, char* outp, char* ch); /* performs the binary dump of the input file and prints that to outp */ void help (char* av[]); /* prints the help message */ int main (int argc, char* argv[]) { - int opt = 1; - int command = 0; - int comm = 0; - int tear = 0; + uint64_t opt = 1; + int64_t command = 0; + int64_t comm = 0; + int64_t tear = 0; char* chars = "01"; char* message = NULL; char* keyfile = NULL; char* output = NULL; - long int nbytes = -1; // must be resolved temporary workaround (ho sonno) + int64_t nbytes = -1; // must be resolved temporary workaround (ho sonno) char* sip = NULL; /* The following while cycle parses the argv vector to find commands, options and relative arguments @@ -123,7 +123,7 @@ int main (int argc, char* argv[]) { case '?': break; default: - printf ("carachter code returned 0%o \n", opt); + printf ("carachter code returned 0%lo \n", opt); } } @@ -163,7 +163,7 @@ int main (int argc, char* argv[]) { exit (EXIT_SUCCESS); } -void xor (int ed, char* mess, char* keyf, char* outp) { +void xor (int64_t ed, char* mess, char* keyf, char* outp) { char* defenoutp = "critt"; char* defdeoutp = "decritt"; @@ -230,7 +230,7 @@ void xor (int ed, char* mess, char* keyf, char* outp) { return; } -void keyrand (long int nb, char* outp) { +void keyrand (int64_t nb, char* outp) { char* defoutp = "default.key"; @@ -272,7 +272,7 @@ void keyrand (long int nb, char* outp) { return; } -void bluh (int c, char* mess, char* outp, char* ch) { +void bluh (int64_t c, char* mess, char* outp, char* ch) { char* defbluh = "bluhed"; char* defunbluh = "unbluhed"; @@ -306,7 +306,7 @@ void bluh (int c, char* mess, char* outp, char* ch) { fread (bytes, sizeof(char), len, mex); - int i,j; + int64_t i,j; for (i = 0; i < len; i ++) { for (j = 0; j < 8; j ++) { @@ -327,7 +327,7 @@ void bluh (int c, char* mess, char* outp, char* ch) { fread (bits, sizeof(char), len, mex); memset (comp, 0, ((len / 8) + 1)); - int i, j; + int64_t i, j; for (i = 0; i < (len / 8); i ++) { for (j = 0; j < 8; j ++) { -- cgit v1.2.3