implemented countIntLength
This commit is contained in:
parent
60adbc6f86
commit
271afd53d3
@ -94,7 +94,7 @@ encryptText(char *text, char *keyNew)
|
|||||||
//COUNT REQUIRED SIZE FOR returningText
|
//COUNT REQUIRED SIZE FOR returningText
|
||||||
for (int i = 0; i < (sizeof(textKeyChain) / sizeof(int)); i++)
|
for (int i = 0; i < (sizeof(textKeyChain) / sizeof(int)); i++)
|
||||||
{
|
{
|
||||||
numberBuffer += floor(log10(abs(textKeyChain[i]))) + 1;
|
numberBuffer += countIntLength(textKeyChain[i]);
|
||||||
|
|
||||||
//CHECK FOR MINUS
|
//CHECK FOR MINUS
|
||||||
if (textKeyChain[i] < 0) numberBuffer++;
|
if (textKeyChain[i] < 0) numberBuffer++;
|
||||||
@ -106,7 +106,7 @@ encryptText(char *text, char *keyNew)
|
|||||||
//LOAD returningText
|
//LOAD returningText
|
||||||
for (int i = 0; i < (sizeof(textKeyChain) / sizeof(int)); i++)
|
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]);
|
sprintf(textBuffer, "%d", textKeyChain[i]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user