implemented why2_realloc

This commit is contained in:
Václav Šmejkal 2023-01-31 15:56:53 +01:00
parent 384678b055
commit 7baaca49c2
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
3 changed files with 4 additions and 4 deletions

View File

@ -97,7 +97,7 @@ why2_output_flags why2_decrypt_text(char *text, char *keyNew)
numberBuffer++; numberBuffer++;
} }
textBuffer = realloc(textBuffer, numberBuffer + 1); textBuffer = why2_realloc(textBuffer, numberBuffer + 1);
//CLEAN (POSSIBLY EXISTING) JUNK in textBuffer //CLEAN (POSSIBLY EXISTING) JUNK in textBuffer
for (int j = 0; j <= numberBuffer; j++) for (int j = 0; j <= numberBuffer; j++)

View File

@ -98,7 +98,7 @@ why2_output_flags why2_encrypt_text(char *text, char *keyNew)
{ {
numberBuffer = sizeof(int) * why2_count_int_length(textKeyChain[i]); numberBuffer = sizeof(int) * why2_count_int_length(textKeyChain[i]);
textBuffer = realloc(textBuffer, numberBuffer); textBuffer = why2_realloc(textBuffer, numberBuffer);
sprintf(textBuffer, "%d", textKeyChain[i]); sprintf(textBuffer, "%d", textKeyChain[i]);
@ -106,7 +106,7 @@ why2_output_flags why2_encrypt_text(char *text, char *keyNew)
if (i != (int) strlen(text) - 1) if (i != (int) strlen(text) - 1)
{ {
textBuffer = realloc(textBuffer, 2); textBuffer = why2_realloc(textBuffer, 2);
sprintf(textBuffer, "%c", why2_get_encryption_separator()); sprintf(textBuffer, "%c", why2_get_encryption_separator());
strcat(returningText, textBuffer); strcat(returningText, textBuffer);

View File

@ -85,7 +85,7 @@ int main(void)
{ {
statusBuffer = strdup("failed"); statusBuffer = strdup("failed");
outputBuffer = realloc(outputBuffer, strlen(encrypted.outputText) + 6); outputBuffer = why2_realloc(outputBuffer, strlen(encrypted.outputText) + 6);
sprintf(outputBuffer, "\t\t\"%s\"\n", encrypted.outputText); sprintf(outputBuffer, "\t\t\"%s\"\n", encrypted.outputText);
outputStreamBuffer = stderr; outputStreamBuffer = stderr;