From 520f8bce34ce00de8198c0a3c01d1868369885ab Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Mon, 13 Jan 2025 19:54:44 +0100 Subject: [PATCH] created anon fns for core-flags changed vars calling sets flag without changing flag_changed variable --- include/flags.h | 4 +++- src/core/lib/flags.c | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/flags.h b/include/flags.h index 8dbb13b..c19e7fc 100644 --- a/include/flags.h +++ b/include/flags.h @@ -111,10 +111,12 @@ char *why2_get_default_memory_identifier(void); //SETTERS void why2_set_encryption_separator(char encryption_separator_new); void why2_set_key_length(int keyLengthNew); -void why2_set_flags(why2_input_flags newFlags); //.... whatcha think? +void why2_set_flags(why2_input_flags new_flags); //.... whatcha think? +void __why2_set_flags_anon(why2_input_flags new_flags); //DO NOT CHANGE flags_changed ON USAGE void why2_set_encryption_operation(why2_encryption_operation_cb newEncryptionOperation); //are you that dumb? void why2_set_memory_identifier(char *new_memory_identifier); void why2_set_padding(unsigned long padding); //SET PADDING RATE WITHOUT REWRITING INPUT FLAGS +void __why2_set_padding_anon(unsigned long padding); void why2_reset_memory_identifier(void); //hmmm, what could reset mean.... huh diff --git a/src/core/lib/flags.c b/src/core/lib/flags.c index fde9557..e0289d1 100644 --- a/src/core/lib/flags.c +++ b/src/core/lib/flags.c @@ -132,9 +132,9 @@ void why2_set_key_length(int keyLengthNew) keyLength = keyLengthNew; } -void why2_set_flags(why2_input_flags newFlags) +void why2_set_flags(why2_input_flags new_flags) { - used_flags = newFlags; + __why2_set_flags_anon(new_flags); if (!flags_changed) { @@ -143,6 +143,11 @@ void why2_set_flags(why2_input_flags newFlags) } } +void __why2_set_flags_anon(why2_input_flags new_flags) +{ + used_flags = new_flags; +} + void why2_set_encryption_operation(why2_encryption_operation_cb newEncryptionOperation) { encryptionOperation_cb = newEncryptionOperation; @@ -157,10 +162,15 @@ void why2_set_memory_identifier(char *new_memory_identifier) void why2_set_padding(unsigned long padding) { - used_flags.padding = padding; + __why2_set_padding_anon(padding); if (!padding_changed) padding_changed = 1; } +void __why2_set_padding_anon(unsigned long padding) +{ + used_flags.padding = padding; +} + void why2_reset_memory_identifier(void) { why2_list_remove_back(&identifier_list);