From 271afd53d3728039a43bd543e48e176d7e3bbcfe Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sat, 23 Apr 2022 18:15:36 +0200 Subject: [PATCH] implemented countIntLength --- src/encrypter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/encrypter.c b/src/encrypter.c index 5d2b7de..5c64552 100644 --- a/src/encrypter.c +++ b/src/encrypter.c @@ -94,7 +94,7 @@ encryptText(char *text, char *keyNew) //COUNT REQUIRED SIZE FOR returningText for (int i = 0; i < (sizeof(textKeyChain) / sizeof(int)); i++) { - numberBuffer += floor(log10(abs(textKeyChain[i]))) + 1; + numberBuffer += countIntLength(textKeyChain[i]); //CHECK FOR MINUS if (textKeyChain[i] < 0) numberBuffer++; @@ -106,7 +106,7 @@ encryptText(char *text, char *keyNew) //LOAD returningText for (int i = 0; i < (sizeof(textKeyChain) / sizeof(int)); i++) { - textBuffer = malloc(floor(log10(abs(textKeyChain[i])))); + textBuffer = malloc(countIntLength(textKeyChain[i])); sprintf(textBuffer, "%d", textKeyChain[i]);