From: Kevin Day Date: Sat, 9 Mar 2024 06:47:12 +0000 (-0600) Subject: Progress: Add more unit tests for fl_fss_payload_header_map() and fix observed problems. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=08858a71da7be738ba9ebacb35308310312387ed;p=fll Progress: Add more unit tests for fl_fss_payload_header_map() and fix observed problems. There needs to be f_abstruse_t and f_abstruse_map_t delete and destroy methods. Update the builld disable headers (which shows that I haven't updated that in a while). The private_f_abstruses_delete_switch() is not correctly deallocating data. The f_fss_payload_header_state_t and f_fss_payload_header_internal_t should instead be fl_fss_payload_header_state_t and fl_fss_payload_header_internal_t. --- diff --git a/build/disable/level_0/f_abstruse.h b/build/disable/level_0/f_abstruse.h index 99a951f..af360d0 100644 --- a/build/disable/level_0/f_abstruse.h +++ b/build/disable/level_0/f_abstruse.h @@ -1,4 +1,8 @@ +#define _di_f_abstruse_delete_ +#define _di_f_abstruse_destroy_ #define _di_f_abstruse_e_ +#define _di_f_abstruse_map_delete_ +#define _di_f_abstruse_map_destroy_ #define _di_f_abstruse_maps_delete_callback_ #define _di_f_abstruse_maps_destroy_callback_ #define _di_f_abstruse_mapss_delete_callback_ diff --git a/build/disable/level_0/f_fss.h b/build/disable/level_0/f_fss.h index 9974283..3866be1 100644 --- a/build/disable/level_0/f_fss.h +++ b/build/disable/level_0/f_fss.h @@ -100,8 +100,4 @@ #define _di_f_fss_skip_past_delimit_ #define _di_f_fss_skip_past_space_ #define _di_f_fss_state_flag_e_ -#define _di_f_fss_status_codes_e_ -#define _di_f_fss_status_error_e_ -#define _di_f_fss_status_success_e_ -#define _di_f_fss_status_warning_e_ #define _di_f_fss_type_s_ diff --git a/build/disable/level_0/f_string.h b/build/disable/level_0/f_string.h index 273b91b..4ee3f8e 100644 --- a/build/disable/level_0/f_string.h +++ b/build/disable/level_0/f_string.h @@ -3,7 +3,134 @@ #define _di_f_string_append_assure_ #define _di_f_string_append_assure_nulless_ #define _di_f_string_append_nulless_ +#define _di_f_string_ascii_0_s_ +#define _di_f_string_ascii_1_s_ +#define _di_f_string_ascii_2_s_ +#define _di_f_string_ascii_3_s_ +#define _di_f_string_ascii_4_s_ +#define _di_f_string_ascii_5_s_ +#define _di_f_string_ascii_6_s_ +#define _di_f_string_ascii_7_s_ +#define _di_f_string_ascii_8_s_ +#define _di_f_string_ascii_9_s_ +#define _di_f_string_ascii_acknowledge_negative_s_ +#define _di_f_string_ascii_acknowledge_s_ +#define _di_f_string_ascii_ampersand_s_ +#define _di_f_string_ascii_a_s_ +#define _di_f_string_ascii_A_s_ +#define _di_f_string_ascii_asterisk_s_ +#define _di_f_string_ascii_bell_s_ +#define _di_f_string_ascii_brace_close_s_ +#define _di_f_string_ascii_brace_open_s_ +#define _di_f_string_ascii_bracket_close_s_ +#define _di_f_string_ascii_bracket_open_s_ +#define _di_f_string_ascii_b_s_ +#define _di_f_string_ascii_B_s_ +#define _di_f_string_ascii_cancel_s_ +#define _di_f_string_ascii_caret_s_ +#define _di_f_string_ascii_colon_s_ +#define _di_f_string_ascii_colon_semi_s_ +#define _di_f_string_ascii_comma_s_ +#define _di_f_string_ascii_c_s_ +#define _di_f_string_ascii_C_s_ +#define _di_f_string_ascii_data_link_escape_s_ +#define _di_f_string_ascii_device_control_four_s_ +#define _di_f_string_ascii_device_control_one_s_ +#define _di_f_string_ascii_device_control_three_s_ +#define _di_f_string_ascii_device_control_two_s_ +#define _di_f_string_ascii_dollar_s_ +#define _di_f_string_ascii_d_s_ +#define _di_f_string_ascii_D_s_ +#define _di_f_string_ascii_enquiry_s_ +#define _di_f_string_ascii_equal_s_ +#define _di_f_string_ascii_e_s_ +#define _di_f_string_ascii_E_s_ +#define _di_f_string_ascii_escape_s_ +#define _di_f_string_ascii_exclamation_s_ +#define _di_f_string_ascii_feed_form_s_ +#define _di_f_string_ascii_feed_line_s_ +#define _di_f_string_ascii_f_s_ +#define _di_f_string_ascii_F_s_ +#define _di_f_string_ascii_grave_s_ +#define _di_f_string_ascii_g_s_ +#define _di_f_string_ascii_G_s_ +#define _di_f_string_ascii_header_start_s_ +#define _di_f_string_ascii_h_s_ +#define _di_f_string_ascii_H_s_ +#define _di_f_string_ascii_i_s_ +#define _di_f_string_ascii_I_s_ +#define _di_f_string_ascii_j_s_ +#define _di_f_string_ascii_J_s_ +#define _di_f_string_ascii_k_s_ +#define _di_f_string_ascii_K_s_ +#define _di_f_string_ascii_l_s_ +#define _di_f_string_ascii_L_s_ +#define _di_f_string_ascii_mark_question_s_ +#define _di_f_string_ascii_medium_stop_s_ +#define _di_f_string_ascii_minus_s_ +#define _di_f_string_ascii_m_s_ +#define _di_f_string_ascii_M_s_ +#define _di_f_string_ascii_n_s_ +#define _di_f_string_ascii_N_s_ +#define _di_f_string_ascii_null_s_ +#define _di_f_string_ascii_o_s_ +#define _di_f_string_ascii_O_s_ +#define _di_f_string_ascii_parenthesis_close_s_ +#define _di_f_string_ascii_parenthesis_open_s_ +#define _di_f_string_ascii_percent_s_ +#define _di_f_string_ascii_period_s_ +#define _di_f_string_ascii_pipe_s_ +#define _di_f_string_ascii_plus_s_ +#define _di_f_string_ascii_pound_s_ +#define _di_f_string_ascii_p_s_ +#define _di_f_string_ascii_P_s_ +#define _di_f_string_ascii_q_s_ +#define _di_f_string_ascii_Q_s_ +#define _di_f_string_ascii_quote_double_s_ +#define _di_f_string_ascii_quote_single_s_ +#define _di_f_string_ascii_return_carriage_s_ +#define _di_f_string_ascii_r_s_ +#define _di_f_string_ascii_R_s_ #define _di_f_string_ascii_s_ +#define _di_f_string_ascii_separator_file_s_ +#define _di_f_string_ascii_separator_group_s_ +#define _di_f_string_ascii_separator_record_s_ +#define _di_f_string_ascii_separator_unit_s_ +#define _di_f_string_ascii_shift_in_s_ +#define _di_f_string_ascii_shift_out_s_ +#define _di_f_string_ascii_sign_at_s_ +#define _di_f_string_ascii_sign_greater_than_s_ +#define _di_f_string_ascii_sign_less_than_s_ +#define _di_f_string_ascii_slash_backward_s_ +#define _di_f_string_ascii_slash_forward_s_ +#define _di_f_string_ascii_space_back_s_ +#define _di_f_string_ascii_space_s_ +#define _di_f_string_ascii_s_s_ +#define _di_f_string_ascii_S_s_ +#define _di_f_string_ascii_substitute_s_ +#define _di_f_string_ascii_synchronous_idle_s_ +#define _di_f_string_ascii_tab_horizontal_s_ +#define _di_f_string_ascii_tab_vertical_s_ +#define _di_f_string_ascii_text_start_s_ +#define _di_f_string_ascii_text_stop_s_ +#define _di_f_string_ascii_tilde_s_ +#define _di_f_string_ascii_transmission_block_end_s_ +#define _di_f_string_ascii_transmission_stop_s_ +#define _di_f_string_ascii_t_s_ +#define _di_f_string_ascii_T_s_ +#define _di_f_string_ascii_underscore_s_ +#define _di_f_string_ascii_u_s_ +#define _di_f_string_ascii_U_s_ +#define _di_f_string_ascii_v_s_ +#define _di_f_string_ascii_V_s_ +#define _di_f_string_ascii_w_s_ +#define _di_f_string_ascii_W_s_ +#define _di_f_string_ascii_x_s_ +#define _di_f_string_ascii_X_s_ +#define _di_f_string_ascii_y_s_ +#define _di_f_string_ascii_Y_s_ +#define _di_f_string_ascii_z_s_ +#define _di_f_string_ascii_Z_s_ #define _di_f_string_constant_t_ #define _di_f_string_dynamic_append_ #define _di_f_string_dynamic_append_assure_ @@ -49,7 +176,75 @@ #define _di_f_string_dynamic_terminate_after_ #define _di_f_string_empty_s_ #define _di_f_string_eol_s_ +#define _di_f_string_format_d_double_s_ +#define _di_f_string_format_D_double_s_ +#define _di_f_string_format_dl_double_s_ +#define _di_f_string_format_DL_double_s_ +#define _di_f_string_format_dl_single_s_ +#define _di_f_string_format_DL_single_s_ +#define _di_f_string_format_d_single_s_ +#define _di_f_string_format_D_single_s_ +#define _di_f_string_format_i_double_s_ +#define _di_f_string_format_ii_double_s_ +#define _di_f_string_format_iii_double_s_ +#define _di_f_string_format_iii_single_s_ +#define _di_f_string_format_ii_single_s_ +#define _di_f_string_format_il_double_s_ +#define _di_f_string_format_ill_double_s_ +#define _di_f_string_format_ill_single_s_ +#define _di_f_string_format_il_single_s_ +#define _di_f_string_format_in_double_s_ +#define _di_f_string_format_in_single_s_ +#define _di_f_string_format_i_single_s_ +#define _di_f_string_format_q_double_s_ +#define _di_f_string_format_Q_double_s_ +#define _di_f_string_format_QQ_double_s_ +#define _di_f_string_format_QQ_single_s_ +#define _di_f_string_format_q_range_double_s_ +#define _di_f_string_format_Q_range_double_s_ +#define _di_f_string_format_q_range_single_s_ +#define _di_f_string_format_Q_range_single_s_ +#define _di_f_string_format_q_single_s_ +#define _di_f_string_format_Q_single_s_ +#define _di_f_string_format_r_double_s_ +#define _di_f_string_format_R_double_s_ +#define _di_f_string_format_r_range_double_s_ +#define _di_f_string_format_R_range_double_s_ +#define _di_f_string_format_r_range_single_s_ +#define _di_f_string_format_R_range_single_s_ +#define _di_f_string_format_rr_double_s_ +#define _di_f_string_format_RR_double_s_ +#define _di_f_string_format_rr_single_s_ +#define _di_f_string_format_RR_single_s_ +#define _di_f_string_format_r_single_s_ +#define _di_f_string_format_R_single_s_ #define _di_f_string_format_s_ +#define _di_f_string_format_s_double_s_ +#define _di_f_string_format_S_double_s_ +#define _di_f_string_format_sentence_end_quote_s_ +#define _di_f_string_format_sentence_end_s_ +#define _di_f_string_format_ss_double_s_ +#define _di_f_string_format_SS_double_s_ +#define _di_f_string_format_s_single_s_ +#define _di_f_string_format_S_single_s_ +#define _di_f_string_format_ss_single_s_ +#define _di_f_string_format_SS_single_s_ +#define _di_f_string_format_u_double_s_ +#define _di_f_string_format_ui_double_s_ +#define _di_f_string_format_uii_double_s_ +#define _di_f_string_format_uii_single_s_ +#define _di_f_string_format_ui_single_s_ +#define _di_f_string_format_ul_double_s_ +#define _di_f_string_format_ull_double_s_ +#define _di_f_string_format_ull_single_s_ +#define _di_f_string_format_ul_single_s_ +#define _di_f_string_format_un_double_s_ +#define _di_f_string_format_un_single_s_ +#define _di_f_string_format_u_single_s_ +#define _di_f_string_format_z_double_s_ +#define _di_f_string_format_Z_double_s_ +#define _di_f_string_format_z_single_s_ +#define _di_f_string_format_Z_single_s_ #define _di_f_string_map_multis_append_ #define _di_f_string_map_multis_append_all_ #define _di_f_string_map_multis_delete_callback_ diff --git a/build/disable/level_1/fl_fss.h b/build/disable/level_1/fl_fss.h index 3193b3e..1fd08ac 100644 --- a/build/disable/level_1/fl_fss.h +++ b/build/disable/level_1/fl_fss.h @@ -1,5 +1,3 @@ -#define _di_f_fss_payload_header_internal_t_ -#define _di_f_fss_payload_header_state_t_ #define _di_f_fss_payload_header_write_d_ #define _di_fl_fss_basic_content_read_ #define _di_fl_fss_basic_content_write_ @@ -22,4 +20,6 @@ #define _di_fl_fss_extended_object_read_ #define _di_fl_fss_extended_object_write_ #define _di_fl_fss_payload_d_ +#define _di_fl_fss_payload_header_internal_t_ #define _di_fl_fss_payload_header_map_ +#define _di_fl_fss_payload_header_state_t_ diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index bf04309..5bbaa61 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -15,7 +15,11 @@ // echo "#define _di_private_inline_f_print_to_error_" >> /tmp/sorted.txt // echo "#define _di_private_inline_private_f_print_to_error_" >> /tmp/sorted.txt +#define _di_f_abstruse_delete_ +#define _di_f_abstruse_destroy_ #define _di_f_abstruse_e_ +#define _di_f_abstruse_map_delete_ +#define _di_f_abstruse_map_destroy_ #define _di_f_abstruse_maps_delete_callback_ #define _di_f_abstruse_maps_destroy_callback_ #define _di_f_abstruse_mapss_delete_callback_ diff --git a/build/stand_alone/firewall.config.h b/build/stand_alone/firewall.config.h index 8cd7345..a1b4666 100644 --- a/build/stand_alone/firewall.config.h +++ b/build/stand_alone/firewall.config.h @@ -15,7 +15,11 @@ // echo "#define _di_private_inline_f_print_to_error_" >> /tmp/sorted.txt // echo "#define _di_private_inline_private_f_print_to_error_" >> /tmp/sorted.txt +#define _di_f_abstruse_delete_ +#define _di_f_abstruse_destroy_ #define _di_f_abstruse_e_ +#define _di_f_abstruse_map_delete_ +#define _di_f_abstruse_map_destroy_ #define _di_f_abstruse_maps_delete_callback_ #define _di_f_abstruse_maps_destroy_callback_ #define _di_f_abstruse_mapss_delete_callback_ diff --git a/level_0/f_abstruse/c/abstruse/abstruse.c b/level_0/f_abstruse/c/abstruse/abstruse.c index 0587655..150e920 100644 --- a/level_0/f_abstruse/c/abstruse/abstruse.c +++ b/level_0/f_abstruse/c/abstruse/abstruse.c @@ -5,6 +5,20 @@ extern "C" { #endif +#ifndef _di_f_abstruse_delete_ + f_status_t f_abstruse_delete(f_abstruse_t * const abstruse) { + + return private_f_abstruses_delete_switch(abstruse); + } +#endif // _di_f_abstruse_delete_ + +#ifndef _di_f_abstruse_destroy_ + f_status_t f_abstruse_destroy(f_abstruse_t * const abstruse) { + + return private_f_abstruses_destroy_switch(abstruse); + } +#endif // _di_f_abstruse_destroy_ + #ifndef _di_f_abstruses_delete_callback_ f_status_t f_abstruses_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { diff --git a/level_0/f_abstruse/c/abstruse/abstruse.h b/level_0/f_abstruse/c/abstruse/abstruse.h index 4dcfd78..278082a 100644 --- a/level_0/f_abstruse/c/abstruse/abstruse.h +++ b/level_0/f_abstruse/c/abstruse/abstruse.h @@ -91,6 +91,94 @@ extern "C" { #endif // _di_f_abstrusess_t_ /** + * Delete the f_abstruse_t structure. + * + * This only de-allocates the following: + * - a_u8s + * - a_u16s + * - a_u32s + * - a_u64s + * - a_i8s + * - a_i16s + * - a_i32s + * - a_i64s + * - a_signeds + * - a_unsigneds + * - a_static (as an f_string_dynamic_t, if size > 0). + * - a_statics (as an f_string_dynamics_t, if size > 0). + * - a_map + * - a_maps + * - a_map_multi + * - a_map_multis + * - a_quantitys + * - a_ranges + * - a_triple + * - a_triples + * + * For all other types, the caller must handle de-allocation to avoid memory leaks. + * Provide and use a custom callback if special handling of deallocation is needed. + * + * @param abstruse + * The abstruse to delete. + * + * @return + * F_okay on success, including when nothing done due to no match against the type. + * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_abstruse_delete_ + extern f_status_t f_abstruse_delete(f_abstruse_t * const abstruse); +#endif // _di_f_abstruse_delete_ + +/** + * Destroy the f_abstruse_t structure. + * + * This only de-allocates the following: + * - a_u8s + * - a_u16s + * - a_u32s + * - a_u64s + * - a_i8s + * - a_i16s + * - a_i32s + * - a_i64s + * - a_signeds + * - a_unsigneds + * - a_static (as an f_string_dynamic_t, if size > 0). + * - a_statics (as an f_string_dynamics_t, if size > 0). + * - a_map + * - a_maps + * - a_map_multi + * - a_map_multis + * - a_quantitys + * - a_ranges + * - a_triple + * - a_triples + * + * For all other types, the caller must handle de-allocation to avoid memory leaks. + * Provide and use a custom callback if special handling of deallocation is needed. + * + * @param abstruse + * The abstruse to destroy. + * + * @return + * F_okay on success, including when nothing done due to no match against the type. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_abstruse_destroy_ + extern f_status_t f_abstruse_destroy(f_abstruse_t * const abstruse); +#endif // _di_f_abstruse_destroy_ + +/** * A callback intended to be passed to f_memory_arrays_resize() for an f_abstruses_t structure. * * This callback only de-allocates the following: diff --git a/level_0/f_abstruse/c/abstruse/map.c b/level_0/f_abstruse/c/abstruse/map.c index 4b5e1a3..07e3ac4 100644 --- a/level_0/f_abstruse/c/abstruse/map.c +++ b/level_0/f_abstruse/c/abstruse/map.c @@ -5,6 +5,30 @@ extern "C" { #endif +#ifndef _di_f_abstruse_map_delete_ + f_status_t f_abstruse_map_delete(f_abstruse_map_t * const map) { + + { + const f_status_t status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &map->key.string, &map->key.used, &map->key.size); + if (F_status_is_error(status)) return status; + } + + return private_f_abstruses_delete_switch(&map->value); + } +#endif // _di_f_abstruse_map_delete_ + +#ifndef _di_f_abstruse_map_destroy_ + f_status_t f_abstruse_map_destroy(f_abstruse_map_t * const map) { + + { + const f_status_t status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &map->key.string, &map->key.used, &map->key.size); + if (F_status_is_error(status)) return status; + } + + return private_f_abstruses_destroy_switch(&map->value); + } +#endif // _di_f_abstruse_map_destroy_ + #ifndef _di_f_abstruse_maps_delete_callback_ f_status_t f_abstruse_maps_delete_callback(const f_number_unsigned_t start, const f_number_unsigned_t stop, void * const void_array) { diff --git a/level_0/f_abstruse/c/abstruse/map.h b/level_0/f_abstruse/c/abstruse/map.h index 39e1f5a..8ca88de 100644 --- a/level_0/f_abstruse/c/abstruse/map.h +++ b/level_0/f_abstruse/c/abstruse/map.h @@ -83,6 +83,94 @@ extern "C" { #endif // _di_f_abstruse_mapss_t_ /** + * Delete the f_abstruse_map_t structure. + * + * This only de-allocates the following: + * - a_u8s + * - a_u16s + * - a_u32s + * - a_u64s + * - a_i8s + * - a_i16s + * - a_i32s + * - a_i64s + * - a_signeds + * - a_unsigneds + * - a_static (as an f_string_dynamic_t, if size > 0). + * - a_statics (as an f_string_dynamics_t, if size > 0). + * - a_map + * - a_maps + * - a_map_multi + * - a_map_multis + * - a_quantitys + * - a_ranges + * - a_triple + * - a_triples + * + * For all other types, the caller must handle de-allocation to avoid memory leaks. + * Provide and use a custom callback if special handling of deallocation is needed. + * + * @param map + * The abstruse map to delete. + * + * @return + * F_okay on success, including when nothing done due to no match against the type. + * + * Errors (with error bit) from: f_memory_array_resize(). + * Errors (with error bit) from: f_memory_arrays_resize(). + * + * @see f_memory_array_resize() + * @see f_memory_arrays_resize() + */ +#ifndef _di_f_abstruse_map_delete_ + extern f_status_t f_abstruse_map_delete(f_abstruse_map_t * const map); +#endif // _di_f_abstruse_map_delete_ + +/** + * Destroy the f_abstruse_map_t structure. + * + * This only de-allocates the following: + * - a_u8s + * - a_u16s + * - a_u32s + * - a_u64s + * - a_i8s + * - a_i16s + * - a_i32s + * - a_i64s + * - a_signeds + * - a_unsigneds + * - a_static (as an f_string_dynamic_t, if size > 0). + * - a_statics (as an f_string_dynamics_t, if size > 0). + * - a_map + * - a_maps + * - a_map_multi + * - a_map_multis + * - a_quantitys + * - a_ranges + * - a_triple + * - a_triples + * + * For all other types, the caller must handle de-allocation to avoid memory leaks. + * Provide and use a custom callback if special handling of deallocation is needed. + * + * @param map + * The abstruse map to destroy. + * + * @return + * F_okay on success, including when nothing done due to no match against the type. + * + * Errors (with error bit) from: f_memory_array_adjust(). + * Errors (with error bit) from: f_memory_arrays_adjust(). + * + * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() + */ +#ifndef _di_f_abstruse_map_destroy_ + extern f_status_t f_abstruse_map_destroy(f_abstruse_map_t * const map); +#endif // _di_f_abstruse_map_destroy_ + +/** * A callback intended to be passed to f_memory_arrays_resize() for an f_abstruse_maps_t structure. * * This is only called when shrinking the array and generally should perform deallocations. diff --git a/level_0/f_abstruse/c/abstruse/private-abstruse.c b/level_0/f_abstruse/c/abstruse/private-abstruse.c index 4de2ffa..afe0ac0 100644 --- a/level_0/f_abstruse/c/abstruse/private-abstruse.c +++ b/level_0/f_abstruse/c/abstruse/private-abstruse.c @@ -94,11 +94,12 @@ extern "C" { break; case f_abstruse_map_e: - if (abstruse->is.a_map.key.size) { - return f_memory_array_resize(0, sizeof(f_char_t), (void **) &abstruse->is.a_map.key.string, &abstruse->is.a_map.key.used, &abstruse->is.a_map.key.size); - } + if (abstruse->is.a_map.key.size || abstruse->is.a_map.value.size) { + { + const f_status_t status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &abstruse->is.a_map.key.string, &abstruse->is.a_map.key.used, &abstruse->is.a_map.key.size); + if (F_status_is_error(status)) return status; + } - if (abstruse->is.a_map.value.size) { return f_memory_array_resize(0, sizeof(f_char_t), (void **) &abstruse->is.a_map.value.string, &abstruse->is.a_map.value.used, &abstruse->is.a_map.value.size); } @@ -112,11 +113,12 @@ extern "C" { break; case f_abstruse_map_multi_e: - if (abstruse->is.a_map_multi.key.size) { - return f_memory_array_resize(0, sizeof(f_char_t), (void **) &abstruse->is.a_map_multi.key.string, &abstruse->is.a_map_multi.key.used, &abstruse->is.a_map_multi.key.size); - } + if (abstruse->is.a_map_multi.key.size || abstruse->is.a_map_multi.value.size) { + { + const f_status_t status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &abstruse->is.a_map_multi.key.string, &abstruse->is.a_map_multi.key.used, &abstruse->is.a_map_multi.key.size); + if (F_status_is_error(status)) return status; + } - if (abstruse->is.a_map_multi.value.size) { return f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &abstruse->is.a_map_multi.value.array, &abstruse->is.a_map_multi.value.used, &abstruse->is.a_map_multi.value.size, &f_string_dynamics_delete_callback); } @@ -137,7 +139,7 @@ extern "C" { break; case f_abstruse_ranges_e: - if (abstruse->is.a_quantitys.size) { + if (abstruse->is.a_ranges.size) { return f_memory_array_resize(0, sizeof(f_range_t), (void **) &abstruse->is.a_ranges.array, &abstruse->is.a_ranges.used, &abstruse->is.a_ranges.size); } diff --git a/level_1/fl_fss/c/fss/payload.c b/level_1/fl_fss/c/fss/payload.c index 0114562..77a0c87 100644 --- a/level_1/fl_fss/c/fss/payload.c +++ b/level_1/fl_fss/c/fss/payload.c @@ -23,8 +23,8 @@ extern "C" { } #endif // _di_level_1_parameter_checking_ - f_fss_payload_header_state_t * const data = (f_fss_payload_header_state_t *) state->data; - f_fss_payload_header_internal_t internal = macro_f_fss_payload_header_internal_t_initialize_2(destinations, destinations->used); + fl_fss_payload_header_state_t * const data = (fl_fss_payload_header_state_t *) state->data; + fl_fss_payload_header_internal_t internal = macro_fl_fss_payload_header_internal_t_initialize_2(destinations, destinations->used); if (!data->cache) { state->status = F_status_set_error(F_parameter); diff --git a/level_1/fl_fss/c/fss/payload.h b/level_1/fl_fss/c/fss/payload.h index 1ece8a3..edb5619 100644 --- a/level_1/fl_fss/c/fss/payload.h +++ b/level_1/fl_fss/c/fss/payload.h @@ -71,17 +71,17 @@ extern "C" { * A state for providing flags and handling interrupts during long running operations. * The state.handle() is optionally allowed. * There is no "callbacks" structure. - * The data is required and set to f_fss_payload_header_state_t. + * The data is required and set to fl_fss_payload_header_state_t. * The data.cache must not be NULL. * * The optional state->handle() is called on error and the handler may alter the status to not have an error bit step to prevent returning except for when there is an invalid parameter passed to this function. - * The second parameter is a f_fss_payload_header_internal_t. + * The second parameter is a fl_fss_payload_header_internal_t. * The second parameter to state->handle() is NULL on invalid paramter passed to this function. * * When state.interrupt() returns, only F_interrupt and F_interrupt_not are processed. * Error bit designates an error but must be passed along with F_interrupt. * All other statuses are ignored. - * The second parameter is a f_fss_payload_header_internal_t. + * The second parameter is a fl_fss_payload_header_internal_t. * * Must not be NULL. * diff --git a/level_1/fl_fss/c/fss/payload/define.h b/level_1/fl_fss/c/fss/payload/define.h index b8aeb13..e214031 100644 --- a/level_1/fl_fss/c/fss/payload/define.h +++ b/level_1/fl_fss/c/fss/payload/define.h @@ -23,7 +23,7 @@ extern "C" { * Parameters: * - destinations: The destinations passed directly from the fl_fss_payload_header_map() parameters. * - state: The state passed directly from the fl_fss_payload_header_map() parameters. - * - internal: The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * - internal: The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * * macro_f_fss_payload_header_write_process_numbers_d: * Process the numbers array (either signed or unsigned), converting it to a string. @@ -32,9 +32,9 @@ extern "C" { * This requires private_fl_payload_header_map_number_signed() from payload.c. * * Parameters: - * - data: The f_fss_payload_header_state_t pointer. + * - data: The fl_fss_payload_header_state_t pointer. * - state: The state passed directly from the fl_fss_payload_header_map() parameters. - * - internal: The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * - internal: The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * - numbers: The is.a representing the array of signed numbers. * - destinations: The destination strings to append to. * - function: The private signed/unsigned function to call. diff --git a/level_1/fl_fss/c/fss/payload/type.h b/level_1/fl_fss/c/fss/payload/type.h index dbae37e..db7af69 100644 --- a/level_1/fl_fss/c/fss/payload/type.h +++ b/level_1/fl_fss/c/fss/payload/type.h @@ -33,7 +33,7 @@ extern "C" { * - destinations: The destinations map being appended to. * - original: The original destination used length. */ -#ifndef _di_f_fss_payload_header_internal_t_ +#ifndef _di_fl_fss_payload_header_internal_t_ typedef struct { uint8_t quote; uint16_t step; @@ -48,9 +48,9 @@ extern "C" { f_string_static_t quote_null; f_string_maps_t * const destinations; const f_number_unsigned_t original; - } f_fss_payload_header_internal_t; + } fl_fss_payload_header_internal_t; - #define f_fss_payload_header_internal_t_initialize { \ + #define fl_fss_payload_header_internal_t_initialize { \ 0, \ 0, \ 0, \ @@ -65,7 +65,7 @@ extern "C" { 0, \ } - #define macro_f_fss_payload_header_internal_t_initialize_1(quote, step, i, j, k, l, m, range, conversion, destinations, quote_null, original) { \ + #define macro_fl_fss_payload_header_internal_t_initialize_1(quote, step, i, j, k, l, m, range, conversion, destinations, quote_null, original) { \ quote, \ step, \ i, \ @@ -80,7 +80,7 @@ extern "C" { original, \ } - #define macro_f_fss_payload_header_internal_t_initialize_2(destinations, original) { \ + #define macro_fl_fss_payload_header_internal_t_initialize_2(destinations, original) { \ 0, \ 0, \ 0, \ @@ -94,7 +94,7 @@ extern "C" { destinations, \ original, \ } -#endif // _di_f_fss_payload_header_internal_t_ +#endif // _di_fl_fss_payload_header_internal_t_ /** * A state structure for passing data to FSS Payload header functions. @@ -106,38 +106,38 @@ extern "C" { * - conversion: The conversion data. * - cache: A string cache to use reduce re-allocations on the destination strings (generally required to not be NULL). */ -#ifndef _di_f_fss_payload_header_state_t_ +#ifndef _di_fl_fss_payload_header_state_t_ typedef struct { uint64_t flag; f_conversion_data_t conversion; f_string_dynamic_t *cache; - } f_fss_payload_header_state_t; + } fl_fss_payload_header_state_t; - #define f_fss_payload_header_state_t_initialize { \ + #define fl_fss_payload_header_state_t_initialize { \ 0, \ f_conversion_data_base_10_c, \ 0, \ } - #define macro_f_fss_payload_header_state_t_initialize_1(flag, conversion, cache) { \ + #define macro_fl_fss_payload_header_state_t_initialize_1(flag, conversion, cache) { \ 0, \ conversion, \ cache, \ } - #define macro_f_fss_payload_header_state_t_initialize_2(flag, cache) { \ + #define macro_fl_fss_payload_header_state_t_initialize_2(flag, cache) { \ flag, \ f_conversion_data_base_10_c, \ cache, \ } - #define macro_f_fss_payload_header_state_t_initialize_3(cache) { \ + #define macro_fl_fss_payload_header_state_t_initialize_3(cache) { \ 0, \ f_conversion_data_base_10_c, \ cache, \ } -#endif // _di_f_fss_payload_header_state_t_ +#endif // _di_fl_fss_payload_header_state_t_ #ifdef __cplusplus } // extern "C" diff --git a/level_1/fl_fss/c/fss/private-payload-helper.c b/level_1/fl_fss/c/fss/private-payload-helper.c index 88aae89..fd2938e 100644 --- a/level_1/fl_fss/c/fss/private-payload-helper.c +++ b/level_1/fl_fss/c/fss/private-payload-helper.c @@ -7,7 +7,7 @@ extern "C" { #endif #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_helper_header_map_destination_write_buffer(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_static_t * const buffer, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_helper_header_map_destination_write_buffer(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_static_t * const buffer, f_string_maps_t * const destinations) { if (buffer->used) { internal->range.start = 0; @@ -27,7 +27,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_helper_header_map_destination_write_buffer_or_empty(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_static_t * const buffer, f_string_maps_t * const destinations, const uint64_t append_on_empty) { + uint8_t private_fl_payload_helper_header_map_destination_write_buffer_or_empty(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_static_t * const buffer, f_string_maps_t * const destinations, const uint64_t append_on_empty) { if (buffer->used) { internal->range.start = 0; @@ -51,7 +51,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_helper_header_map_destination_write_empty_three(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_static_t * const destination, const f_string_static_t separator) { + uint8_t private_fl_payload_helper_header_map_destination_write_empty_three(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_static_t * const destination, const f_string_static_t separator) { state->status = f_memory_array_increase_by(internal->quote_null.used * 3 + separator.used * 2, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size); if (F_status_is_error(state->status)) return F_true; @@ -78,7 +78,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_helper_header_map_destination_write_empty_two(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_static_t * const destination, const f_string_static_t separator) { + uint8_t private_fl_payload_helper_header_map_destination_write_empty_two(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_static_t * const destination, const f_string_static_t separator) { state->status = f_memory_array_increase_by(internal->quote_null.used * 2 + separator.used, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size); if (F_status_is_error(state->status)) return F_true; diff --git a/level_1/fl_fss/c/fss/private-payload-helper.h b/level_1/fl_fss/c/fss/private-payload-helper.h index fed23ba..bb5fa65 100644 --- a/level_1/fl_fss/c/fss/private-payload-helper.h +++ b/level_1/fl_fss/c/fss/private-payload-helper.h @@ -19,7 +19,7 @@ extern "C" { * Write to the next destinations value, doing nothing on empty buffer. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * Must not be NULL. * @param state * The state passed directly from the fl_fss_payload_header_map() parameters. @@ -32,7 +32,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * The internal.range is modified. * Must not be NULL. * @param buffer @@ -49,14 +49,14 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_helper_header_map_destination_write_buffer(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_static_t * const buffer, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_helper_header_map_destination_write_buffer(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_static_t * const buffer, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** * Write to the next destinations value, and if empty adding the quotes on NULL if needed. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * Must not be NULL. * @param state * The state passed directly from the fl_fss_payload_header_map() parameters. @@ -70,7 +70,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * The internal.range is modified. * Must not be NULL. * @param buffer @@ -90,14 +90,14 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_helper_header_map_destination_write_buffer_or_empty(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_static_t * const buffer, f_string_maps_t * const destinations, const uint64_t append_on_empty) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_helper_header_map_destination_write_buffer_or_empty(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_static_t * const buffer, f_string_maps_t * const destinations, const uint64_t append_on_empty) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** * Write three quoted empty strings to the destination. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * Must not be NULL. * @param state * The state passed directly from the fl_fss_payload_header_map() parameters. @@ -111,7 +111,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * The internal.range is modified. * Must not be NULL. * @param destination @@ -131,14 +131,14 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_helper_header_map_destination_write_empty_three(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_static_t * const destination, const f_string_static_t separator) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_helper_header_map_destination_write_empty_three(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_static_t * const destination, const f_string_static_t separator) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** * Write two quoted empty strings to the destination. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * Must not be NULL. * @param state * The state passed directly from the fl_fss_payload_header_map() parameters. @@ -152,7 +152,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * The internal.range is modified. * Must not be NULL. * @param destination @@ -172,7 +172,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_helper_header_map_destination_write_empty_two(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_static_t * const destination, const f_string_static_t separator) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_helper_header_map_destination_write_empty_two(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_static_t * const destination, const f_string_static_t separator) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) #ifdef __cplusplus diff --git a/level_1/fl_fss/c/fss/private-payload.c b/level_1/fl_fss/c/fss/private-payload.c index ba71dd8..cc37641 100644 --- a/level_1/fl_fss/c/fss/private-payload.c +++ b/level_1/fl_fss/c/fss/private-payload.c @@ -8,7 +8,7 @@ extern "C" { #endif #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_dynamics(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_statics_t * const buffers, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_dynamics(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_statics_t * const buffers, f_string_maps_t * const destinations) { if (buffers->used) { data->cache->used = 0; @@ -96,7 +96,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_map(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_map_t * const map, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_map(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_map_t * const map, f_string_maps_t * const destinations) { state->status = f_memory_array_increase_by(map->key.used + map->value.used + f_string_space_s.used + internal->quote_null.used * 2, sizeof(f_char_t), (void **) &destinations->array[destinations->used].value.string, &destinations->array[destinations->used].value.used, &destinations->array[destinations->used].value.size); if (F_status_is_error(state->status)) return F_true; @@ -199,7 +199,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_map_multi(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_map_multi_t * const map, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_map_multi(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_map_multi_t * const map, f_string_maps_t * const destinations) { if (map->key.used || (data->flag & f_fss_payload_header_map_flag_null_map_multi_name_e)) { internal->k = map->key.used + internal->quote_null.used; @@ -220,6 +220,11 @@ extern "C" { internal->k += f_string_space_s.used + internal->quote_null.used; } + // Add additional characters for the standard placeholders. + if (internal->k) { + internal->k += f_fss_placeholder_s.used * 4; + } + state->status = f_memory_array_increase_by(internal->k, sizeof(f_char_t), (void **) &destinations->array[destinations->used].value.string, &destinations->array[destinations->used].value.used, &destinations->array[destinations->used].value.size); if (F_status_is_error(state->status)) return F_true; @@ -304,13 +309,12 @@ extern "C" { if (map->value.used || (data->flag & f_fss_payload_header_map_flag_null_map_multi_values_e)) { if (map->value.used) { - for (internal->m = 0; internal->m < map->value.used; ++internal->m) { if (map->value.array[internal->m].used || (data->flag & f_fss_payload_header_map_flag_null_map_multi_values_e)) { if (map->value.array[internal->m].used) { internal->range.start = 0; - internal->range.stop = map->value.used - 1; + internal->range.stop = map->value.array[internal->m].used - 1; private_fl_fss_basic_write(F_false, map->value.array[internal->m], 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal); } @@ -351,13 +355,13 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_maps_) - uint8_t private_fl_payload_header_map_map_multis(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_map_multis_t * const maps, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_map_multis(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_map_multis_t * const maps, f_string_maps_t * const destinations) { if (maps->used) { internal->k = 0; internal->l = 0; - for (; internal->l < maps->used; ++internal->k) { + for (; internal->l < maps->used; ++internal->l) { if (state->interrupt) { state->interrupt((void * const) state, (void * const) internal); @@ -365,7 +369,7 @@ extern "C" { } if (maps->array[internal->l].key.used) { - internal->k += maps->array[internal->k].key.used + f_fss_extended_next_s.used + internal->quote_null.used; + internal->k += maps->array[internal->l].key.used + f_fss_extended_next_s.used + internal->quote_null.used; } else if (data->flag & f_fss_payload_header_map_flag_null_map_multi_name_e) { internal->k += f_fss_extended_next_s.used + internal->quote_null.used; @@ -387,6 +391,11 @@ extern "C" { } } // for + // Add additional characters for the standard placeholders. + if (internal->k) { + internal->k += f_fss_placeholder_s.used * 4; + } + if (data->flag & f_fss_payload_header_map_flag_join_map_multis_e) { data->cache->used = 0; @@ -654,12 +663,12 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_maps_) #if !defined(_di_fl_fss_payload_header_maps_) - uint8_t private_fl_payload_header_map_maps(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_maps_t * const maps, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_maps(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_maps_t * const maps, f_string_maps_t * const destinations) { if (maps->used) { internal->k = 0; - for (internal->l = 0; internal->l < maps->used; ++internal->k) { + for (internal->l = 0; internal->l < maps->used; ++internal->l) { if (state->interrupt) { state->interrupt((void * const) state, (void * const) internal); @@ -667,7 +676,7 @@ extern "C" { } if (maps->array[internal->l].key.used) { - internal->k += maps->array[internal->k].key.used + f_fss_extended_next_s.used + internal->quote_null.used; + internal->k += maps->array[internal->l].key.used + f_fss_extended_next_s.used + internal->quote_null.used; } else if (data->flag & f_fss_payload_header_map_flag_null_map_name_e) { internal->k += f_fss_extended_next_s.used + internal->quote_null.used; @@ -681,6 +690,11 @@ extern "C" { } } // for + // Add additional characters for the standard placeholders. + if (internal->k) { + internal->k += f_fss_placeholder_s.used * 4; + } + if (data->flag & f_fss_payload_header_map_flag_join_maps_e) { data->cache->used = 0; @@ -903,7 +917,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_maps_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_number_signed(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_number_signed_t number) { + uint8_t private_fl_payload_header_map_number_signed(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_number_signed_t number) { if (data->cache->used) { state->status = f_string_dynamic_append_assure(f_fss_extended_next_s, data->cache); @@ -920,7 +934,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_number_unsigned(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_number_unsigned_t number) { + uint8_t private_fl_payload_header_map_number_unsigned(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_number_unsigned_t number) { if (data->cache->used) { state->status = f_string_dynamic_append_assure(f_fss_extended_next_s, data->cache); @@ -937,7 +951,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_quantity(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_quantity_t quantity, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_quantity(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_quantity_t quantity, f_string_maps_t * const destinations) { if (quantity.total) { data->cache->used = 0; @@ -981,7 +995,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_quantitys(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_quantitys_t quantitys, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_quantitys(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_quantitys_t quantitys, f_string_maps_t * const destinations) { if (quantitys.used) { internal->k = 0; @@ -1001,6 +1015,11 @@ extern "C" { } } // for + // Add additional characters for the standard placeholders. + if (internal->k) { + internal->k += f_fss_placeholder_s.used * 2; + } + state->status = f_memory_array_increase_by(internal->k, sizeof(f_char_t), (void **) &destinations->array[destinations->used].value.string, &destinations->array[destinations->used].value.used, &destinations->array[destinations->used].value.size); if (F_status_is_error(state->status)) return F_true; @@ -1136,7 +1155,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_range(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_range_t range, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_range(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_range_t range, f_string_maps_t * const destinations) { if (range.start > range.stop) { if (data->flag & f_fss_payload_header_map_flag_null_range_e) { @@ -1180,7 +1199,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_ranges(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_ranges_t ranges, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_ranges(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_ranges_t ranges, f_string_maps_t * const destinations) { if (ranges.used) { internal->k = 0; @@ -1200,6 +1219,11 @@ extern "C" { } } // for + // Add additional characters for the standard placeholders. + if (internal->k) { + internal->k += f_fss_placeholder_s.used * 4; + } + state->status = f_memory_array_increase_by(internal->k, sizeof(f_char_t), (void **) &destinations->array[destinations->used].value.string, &destinations->array[destinations->used].value.used, &destinations->array[destinations->used].value.size); if (F_status_is_error(state->status)) return F_true; @@ -1335,7 +1359,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_strings(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_t * const buffers, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_strings(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_t * const buffers, f_string_maps_t * const destinations) { if (buffers && buffers[0]) { f_string_static_t string_static = f_string_static_t_initialize; @@ -1356,6 +1380,11 @@ extern "C" { internal->k += string_static.used + f_fss_extended_next_s.used + internal->quote_null.used; } // for + // Add additional characters for the standard placeholders. + if (internal->k) { + internal->k += f_fss_placeholder_s.used * 4; + } + state->status = f_memory_array_increase_by(internal->k, sizeof(f_char_t), (void **) &destinations->array[destinations->used].value.string, &destinations->array[destinations->used].value.used, &destinations->array[destinations->used].value.size); if (F_status_is_error(state->status)) return F_true; @@ -1436,7 +1465,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_triple(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_string_triple_t triple, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_triple(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_string_triple_t triple, f_string_maps_t * const destinations) { f_string_dynamic_t * const destination = (data->flag & f_fss_payload_header_map_flag_join_triple_e) ? data->cache : &destinations->array[destinations->used].value; const f_string_static_t separator = (data->flag & f_fss_payload_header_map_flag_join_triple_e) ? f_string_space_s : f_fss_extended_next_s; @@ -1516,7 +1545,7 @@ extern "C" { #endif // !defined(_di_fl_fss_payload_header_map_) #if !defined(_di_fl_fss_payload_header_map_) - uint8_t private_fl_payload_header_map_triples(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_string_triples_t triples, f_string_maps_t * const destinations) { + uint8_t private_fl_payload_header_map_triples(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_string_triples_t triples, f_string_maps_t * const destinations) { if (triples.used) { internal->k = 0; @@ -1534,6 +1563,11 @@ extern "C" { internal->k += (data->flag & f_fss_payload_header_map_flag_join_triple_e) ? f_fss_space_s.used * 2 : f_fss_extended_next_s.used * 2; } // for + // Add additional characters for the standard placeholders. + if (internal->k) { + internal->k += f_fss_placeholder_s.used * 4; + } + state->status = f_memory_array_increase_by(internal->k, sizeof(f_char_t), (void **) &destinations->array[destinations->used].value.string, &destinations->array[destinations->used].value.used, &destinations->array[destinations->used].value.size); if (F_status_is_error(state->status)) return F_true; diff --git a/level_1/fl_fss/c/fss/private-payload.h b/level_1/fl_fss/c/fss/private-payload.h index f45ba39..553787f 100644 --- a/level_1/fl_fss/c/fss/private-payload.h +++ b/level_1/fl_fss/c/fss/private-payload.h @@ -23,7 +23,7 @@ extern "C" { * @param headers * An abstruse map representing individual headers. * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This modifies data.cache. * Must not be NULL. * @param state @@ -41,7 +41,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param buffers * The array of dynamic strings to read from. @@ -66,7 +66,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_dynamics(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_statics_t * const buffers, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_dynamics(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_statics_t * const buffers, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -75,7 +75,7 @@ extern "C" { * This expects that the appropriate used and flag checks are performed prior to calling this. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * Must not be NULL. * @param state * The state passed directly from the fl_fss_payload_header_map() parameters. @@ -89,7 +89,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param map * The map to read from. @@ -113,7 +113,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_map(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_map_t * const map, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_map(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_map_t * const map, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -122,7 +122,7 @@ extern "C" { * This expects that the appropriate used and flag checks are performed prior to calling this. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * Must not be NULL. * @param state * The state passed directly from the fl_fss_payload_header_map() parameters. @@ -136,7 +136,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param map * The map to read from. @@ -160,7 +160,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_map_multi(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_map_multi_t * const map, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_map_multi(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_map_multi_t * const map, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -169,7 +169,7 @@ extern "C" { * This expects that the appropriate used and flag checks are performed prior to calling this. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * Must not be NULL. * @param state * The state passed directly from the fl_fss_payload_header_map() parameters. @@ -183,7 +183,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param maps * The maps to read from. @@ -207,7 +207,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_maps_) - extern uint8_t private_fl_payload_header_map_map_multis(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_map_multis_t * const maps, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_map_multis(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_map_multis_t * const maps, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_maps_) /** @@ -216,7 +216,7 @@ extern "C" { * This expects that the appropriate used and flag checks are performed prior to calling this. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * Must not be NULL. * @param state * The state passed directly from the fl_fss_payload_header_map() parameters. @@ -230,7 +230,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param maps * The maps to read from. @@ -254,7 +254,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_maps_) - extern uint8_t private_fl_payload_header_map_maps(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_maps_t * const maps, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_maps(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_maps_t * const maps, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_maps_) /** @@ -264,7 +264,7 @@ extern "C" { * If the number is not appended to data->cache, then nothing is appended to the destination value. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This caller must reset data.cache.used as needed. * If data.cache.used is not 0, then this will append a space before adding the converted number. * Must not be NULL. @@ -279,7 +279,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param number * The signed number. @@ -295,7 +295,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_number_signed(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_number_signed_t number) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_number_signed(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_number_signed_t number) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -305,7 +305,7 @@ extern "C" { * If the number is not appended to data->cache, then nothing is appended to the destination value. * * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This caller must reset data.cache.used as needed. * if data.cache.used is not 0, then this will append a space before adding the converted number. * @@ -321,7 +321,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param number * The unsigned number. @@ -337,7 +337,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_number_unsigned(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_number_unsigned_t number) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_number_unsigned(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_number_unsigned_t number) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -348,7 +348,7 @@ extern "C" { * @param headers * An abstruse map representing individual headers. * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This modifies data.cache. * Must not be NULL. * @param state @@ -365,7 +365,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param quantity * The quantity to process. @@ -389,7 +389,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_quantity(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_quantity_t quantity, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_quantity(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_quantity_t quantity, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -400,7 +400,7 @@ extern "C" { * @param headers * An abstruse map representing individual headers. * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This modifies data.cache. * Must not be NULL. * @param state @@ -417,7 +417,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param quantity * The quantity to process. @@ -441,7 +441,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_quantitys(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_quantitys_t quantitys, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_quantitys(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_quantitys_t quantitys, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -452,7 +452,7 @@ extern "C" { * @param headers * An abstruse map representing individual headers. * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This modifies data.cache. * Must not be NULL. * @param state @@ -469,7 +469,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param range * The range to process. @@ -493,7 +493,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_range(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_range_t range, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_range(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_range_t range, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -504,7 +504,7 @@ extern "C" { * @param headers * An abstruse map representing individual headers. * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This modifies data.cache. * Must not be NULL. * @param state @@ -521,7 +521,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param range * The range to process. @@ -545,7 +545,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_ranges(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_ranges_t ranges, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_ranges(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_ranges_t ranges, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -556,7 +556,7 @@ extern "C" { * @param headers * An abstruse map representing individual headers. * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This modifies data.cache. * Must not be NULL. * @param state @@ -573,7 +573,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param buffers * The array of NULL terminated strings to read from. @@ -598,7 +598,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_strings(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, f_string_t * const buffers, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_strings(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, f_string_t * const buffers, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -609,7 +609,7 @@ extern "C" { * @param headers * An abstruse map representing individual headers. * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This modifies data.cache. * Must not be NULL. * @param state @@ -626,7 +626,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param triple * The triple to process. @@ -650,7 +650,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_triple(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_string_triple_t triple, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_triple(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_string_triple_t triple, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) /** @@ -661,7 +661,7 @@ extern "C" { * @param headers * An abstruse map representing individual headers. * @param data - * The f_fss_payload_header_state_t pointer. + * The fl_fss_payload_header_state_t pointer. * This modifies data.cache. * Must not be NULL. * @param state @@ -678,7 +678,7 @@ extern "C" { * * Must not be NULL. * @param internal - * The internal state, f_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). + * The internal state, fl_fss_payload_header_internal_t, created inside of fl_fss_payload_header_map(). * Must not be NULL. * @param triple * The triple to process. @@ -702,7 +702,7 @@ extern "C" { * @see fl_fss_payload_header_map() */ #if !defined(_di_fl_fss_payload_header_map_) - extern uint8_t private_fl_payload_header_map_triples(f_fss_payload_header_state_t * const data, f_state_t * const state, f_fss_payload_header_internal_t * const internal, const f_string_triples_t triples, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; + extern uint8_t private_fl_payload_header_map_triples(fl_fss_payload_header_state_t * const data, f_state_t * const state, fl_fss_payload_header_internal_t * const internal, const f_string_triples_t triples, f_string_maps_t * const destinations) F_attribute_visibility_internal_d; #endif // !defined(_di_fl_fss_payload_header_map_) #ifdef __cplusplus diff --git a/level_1/fl_fss/data/build/settings-tests b/level_1/fl_fss/data/build/settings-tests index af11560..95600f9 100644 --- a/level_1/fl_fss/data/build/settings-tests +++ b/level_1/fl_fss/data/build/settings-tests @@ -42,6 +42,9 @@ build_sources_program test-fss-payload_header_map-abstruse_int32s-split.c test-f build_sources_program test-fss-payload_header_map-abstruse_int64s-join.c test-fss-payload_header_map-abstruse_uint64s-join.c build_sources_program test-fss-payload_header_map-abstruse_int64s-split.c test-fss-payload_header_map-abstruse_uint64s-split.c build_sources_program test-fss-payload_header_map-abstruse_map-join.c test-fss-payload_header_map-abstruse_map-split.c +build_sources_program test-fss-payload_header_map-abstruse_map_multi-join.c test-fss-payload_header_map-abstruse_map_multi-split.c +build_sources_program test-fss-payload_header_map-abstruse_map_multis-join.c test-fss-payload_header_map-abstruse_map_multis-split.c +build_sources_program test-fss-payload_header_map-abstruse_maps-join.c test-fss-payload_header_map-abstruse_maps-split.c build_sources_program test-fss-payload_header_map-abstruse_signed-join.c test-fss-payload_header_map-abstruse_unsigned-join.c build_sources_program test-fss-payload_header_map-abstruse_signeds-join.c test-fss-payload_header_map-abstruse_unsigneds-join.c build_sources_program test-fss-payload_header_map-abstruse_signeds-split.c test-fss-payload_header_map-abstruse_unsigneds-split.c diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-0.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-0.txt new file mode 100644 index 0000000..003eb20 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-0.txt @@ -0,0 +1,3 @@ +a-0 +1 +"0 hello" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-1.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-1.txt new file mode 100644 index 0000000..3f9d8f4 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-1.txt @@ -0,0 +1,3 @@ +a-1 +1 +"some thing 3全#$⸙" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-2.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-2.txt new file mode 100644 index 0000000..26bcdbd --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-2.txt @@ -0,0 +1,3 @@ +a-2 +1 +""\" ''" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-3.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-3.txt new file mode 100644 index 0000000..cdc6a2d --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-3.txt @@ -0,0 +1,3 @@ +b-0 +1 +"全 ⸙" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-4.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-4.txt new file mode 100644 index 0000000..babfa63 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-4.txt @@ -0,0 +1,3 @@ +b-1 +1 +"␂␂␂ ␀ ␀ ␀ ␀ ␀ ␀" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-5.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-5.txt new file mode 100644 index 0000000..576b709 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-5.txt @@ -0,0 +1,3 @@ +b-2 +1 +"' '" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-6.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-6.txt new file mode 100644 index 0000000..e9d783e --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multi-6.txt @@ -0,0 +1,3 @@ +c-0 +1 +"� "a b \" c" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-0.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-0.txt new file mode 100644 index 0000000..003eb20 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-0.txt @@ -0,0 +1,3 @@ +a-0 +1 +"0 hello" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-1.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-1.txt new file mode 100644 index 0000000..3f9d8f4 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-1.txt @@ -0,0 +1,3 @@ +a-1 +1 +"some thing 3全#$⸙" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-2.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-2.txt new file mode 100644 index 0000000..26bcdbd --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-2.txt @@ -0,0 +1,3 @@ +a-2 +1 +""\" ''" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-3.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-3.txt new file mode 100644 index 0000000..cdc6a2d --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-3.txt @@ -0,0 +1,3 @@ +b-0 +1 +"全 ⸙" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-4.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-4.txt new file mode 100644 index 0000000..babfa63 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-4.txt @@ -0,0 +1,3 @@ +b-1 +1 +"␂␂␂ ␀ ␀ ␀ ␀ ␀ ␀" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-5.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-5.txt new file mode 100644 index 0000000..576b709 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-5.txt @@ -0,0 +1,3 @@ +b-2 +1 +"' '" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-6.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-6.txt new file mode 100644 index 0000000..e9d783e --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map_multis-6.txt @@ -0,0 +1,3 @@ +c-0 +1 +"� "a b \" c" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-0.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-0.txt new file mode 100644 index 0000000..003eb20 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-0.txt @@ -0,0 +1,3 @@ +a-0 +1 +"0 hello" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-1.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-1.txt new file mode 100644 index 0000000..3f9d8f4 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-1.txt @@ -0,0 +1,3 @@ +a-1 +1 +"some thing 3全#$⸙" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-2.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-2.txt new file mode 100644 index 0000000..26bcdbd --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-2.txt @@ -0,0 +1,3 @@ +a-2 +1 +""\" ''" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-3.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-3.txt new file mode 100644 index 0000000..cdc6a2d --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-3.txt @@ -0,0 +1,3 @@ +b-0 +1 +"全 ⸙" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-4.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-4.txt new file mode 100644 index 0000000..babfa63 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-4.txt @@ -0,0 +1,3 @@ +b-1 +1 +"␂␂␂ ␀ ␀ ␀ ␀ ␀ ␀" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-5.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-5.txt new file mode 100644 index 0000000..576b709 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-5.txt @@ -0,0 +1,3 @@ +b-2 +1 +"' '" diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-6.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-6.txt new file mode 100644 index 0000000..e9d783e --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_maps-6.txt @@ -0,0 +1,3 @@ +c-0 +1 +"� "a b \" c" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-0.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-0.txt new file mode 100644 index 0000000..3a0f995 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-0.txt @@ -0,0 +1,3 @@ +a-0 +1 +0 hello diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-1.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-1.txt new file mode 100644 index 0000000..2490950 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-1.txt @@ -0,0 +1,3 @@ +a-1 +1 +"some thing" 3全#$⸙ diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-2.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-2.txt new file mode 100644 index 0000000..7e91d24 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-2.txt @@ -0,0 +1,3 @@ +a-2 +1 +"""" "''" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-3.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-3.txt new file mode 100644 index 0000000..6a55e8c --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-3.txt @@ -0,0 +1,3 @@ +b-0 +1 +全 ⸙ diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-4.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-4.txt new file mode 100644 index 0000000..2df9bf9 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-4.txt @@ -0,0 +1,3 @@ +b-1 +1 +␂␂␂ "␀ ␀ ␀ ␀ ␀ ␀" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-5.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-5.txt new file mode 100644 index 0000000..7f046f2 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-5.txt @@ -0,0 +1,3 @@ +b-2 +1 +"'" "'" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-6.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-6.txt new file mode 100644 index 0000000..946471d --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multi-6.txt @@ -0,0 +1,3 @@ +c-0 +1 +� ""a b \" c" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-0.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-0.txt new file mode 100644 index 0000000..3a0f995 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-0.txt @@ -0,0 +1,3 @@ +a-0 +1 +0 hello diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-1.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-1.txt new file mode 100644 index 0000000..2490950 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-1.txt @@ -0,0 +1,3 @@ +a-1 +1 +"some thing" 3全#$⸙ diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-2.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-2.txt new file mode 100644 index 0000000..7e91d24 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-2.txt @@ -0,0 +1,3 @@ +a-2 +1 +"""" "''" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-3.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-3.txt new file mode 100644 index 0000000..6a55e8c --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-3.txt @@ -0,0 +1,3 @@ +b-0 +1 +全 ⸙ diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-4.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-4.txt new file mode 100644 index 0000000..2df9bf9 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-4.txt @@ -0,0 +1,3 @@ +b-1 +1 +␂␂␂ "␀ ␀ ␀ ␀ ␀ ␀" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-5.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-5.txt new file mode 100644 index 0000000..7f046f2 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-5.txt @@ -0,0 +1,3 @@ +b-2 +1 +"'" "'" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-6.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-6.txt new file mode 100644 index 0000000..946471d --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map_multis-6.txt @@ -0,0 +1,3 @@ +c-0 +1 +� ""a b \" c" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-0.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-0.txt new file mode 100644 index 0000000..3a0f995 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-0.txt @@ -0,0 +1,3 @@ +a-0 +1 +0 hello diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-1.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-1.txt new file mode 100644 index 0000000..2490950 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-1.txt @@ -0,0 +1,3 @@ +a-1 +1 +"some thing" 3全#$⸙ diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-2.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-2.txt new file mode 100644 index 0000000..7e91d24 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-2.txt @@ -0,0 +1,3 @@ +a-2 +1 +"""" "''" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-3.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-3.txt new file mode 100644 index 0000000..6a55e8c --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-3.txt @@ -0,0 +1,3 @@ +b-0 +1 +全 ⸙ diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-4.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-4.txt new file mode 100644 index 0000000..2df9bf9 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-4.txt @@ -0,0 +1,3 @@ +b-1 +1 +␂␂␂ "␀ ␀ ␀ ␀ ␀ ␀" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-5.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-5.txt new file mode 100644 index 0000000..7f046f2 --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-5.txt @@ -0,0 +1,3 @@ +b-2 +1 +"'" "'" diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-6.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-6.txt new file mode 100644 index 0000000..946471d --- /dev/null +++ b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_maps-6.txt @@ -0,0 +1,3 @@ +c-0 +1 +� ""a b \" c" diff --git a/level_1/fl_fss/data/tests/variables/payload-abstruse_map_multi.txt b/level_1/fl_fss/data/tests/variables/payload-abstruse_map_multi.txt new file mode 100644 index 0000000..f3bf3e3 --- /dev/null +++ b/level_1/fl_fss/data/tests/variables/payload-abstruse_map_multi.txt @@ -0,0 +1,28 @@ +a-0 +2 +0 +hello +a-1 +2 +some thing +3全#$⸙ +a-2 +2 +"" +'' +b-0 +2 +全 +⸙ +b-1 +2 +␂␂␂ +␀ ␀ ␀ ␀ ␀ ␀ +b-2 +2 +' +' +c-0 +2 +� +"a b " c diff --git a/level_1/fl_fss/data/tests/variables/payload-abstruse_map_multis.txt b/level_1/fl_fss/data/tests/variables/payload-abstruse_map_multis.txt new file mode 100644 index 0000000..f3bf3e3 --- /dev/null +++ b/level_1/fl_fss/data/tests/variables/payload-abstruse_map_multis.txt @@ -0,0 +1,28 @@ +a-0 +2 +0 +hello +a-1 +2 +some thing +3全#$⸙ +a-2 +2 +"" +'' +b-0 +2 +全 +⸙ +b-1 +2 +␂␂␂ +␀ ␀ ␀ ␀ ␀ ␀ +b-2 +2 +' +' +c-0 +2 +� +"a b " c diff --git a/level_1/fl_fss/data/tests/variables/payload-abstruse_maps.txt b/level_1/fl_fss/data/tests/variables/payload-abstruse_maps.txt new file mode 100644 index 0000000..f3bf3e3 --- /dev/null +++ b/level_1/fl_fss/data/tests/variables/payload-abstruse_maps.txt @@ -0,0 +1,28 @@ +a-0 +2 +0 +hello +a-1 +2 +some thing +3全#$⸙ +a-2 +2 +"" +'' +b-0 +2 +全 +⸙ +b-1 +2 +␂␂␂ +␀ ␀ ␀ ␀ ␀ ␀ +b-2 +2 +' +' +c-0 +2 +� +"a b " c diff --git a/level_1/fl_fss/tests/unit/c/help-fss-payload.c b/level_1/fl_fss/tests/unit/c/help-fss-payload.c index 65f9cb1..a48a985 100644 --- a/level_1/fl_fss/tests/unit/c/help-fss-payload.c +++ b/level_1/fl_fss/tests/unit/c/help-fss-payload.c @@ -14,11 +14,15 @@ void help_payload__test(const f_string_t context_variables, const f_string_t con FILE *file_variables = data__file_open__named("variables", "payload", context_variables); FILE *file_headers = 0; + if (!file_variables) { + printf("[ ERROR ] --- Opening File: variables/payload-%s.txt returned NULL.\n", context_variables); + } + assert_non_null(file_variables); f_abstruse_maps_t headers = f_abstruse_maps_t_initialize; f_state_t state = f_state_t_initialize; - f_fss_payload_header_state_t data = f_fss_payload_header_state_t_initialize; + fl_fss_payload_header_state_t data = fl_fss_payload_header_state_t_initialize; f_string_dynamic_t object = f_string_dynamic_t_initialize; f_string_dynamics_t contents = f_string_dynamics_t_initialize; f_string_dynamic_t cache = f_string_dynamic_t_initialize; @@ -50,6 +54,11 @@ void help_payload__test(const f_string_t context_variables, const f_string_t con ++headers.used; file_headers = data__file_open__named_at("headers", "payload", context_headers, at); + + if (!file_headers) { + printf("[ ERROR ] --- Opening File: headers/payload-%s-%d.txt returned NULL.\n", context_headers, at); + } + assert_non_null(file_headers); help__read_line_object(file_headers, &object); @@ -67,6 +76,10 @@ void help_payload__test(const f_string_t context_variables, const f_string_t con for (f_number_unsigned_t i = 0; i < destinations.used; ++i) { + if (destinations.array[i].key.used != expects.array[i].key.used || destinations.array[i].value.used != expects.array[i].value.used || strncmp(destinations.array[i].key.string, expects.array[i].key.string, expects.array[i].key.used) || strncmp(destinations.array[i].value.string, expects.array[i].value.string, expects.array[i].value.used)) { + printf("[ ERROR ] --- Match failure: [%lu] key[%lu]='%s', value[%lu]='%s' vs expected key[%lu]='%s', value[%lu]='%s'\n", i, destinations.array[i].key.used, destinations.array[i].key.string, destinations.array[i].value.used, destinations.array[i].value.string, expects.array[i].key.used, expects.array[i].key.string, expects.array[i].value.used, expects.array[i].value.string); + } + assert_string_equal(destinations.array[i].key.string, expects.array[i].key.string); assert_string_equal(destinations.array[i].value.string, expects.array[i].value.string); diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-join.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-join.c new file mode 100644 index 0000000..844bb4f --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-join.c @@ -0,0 +1,44 @@ +#include "test-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_payload_header_map__abstruse_map_multi__works_join(void **void_state) { + + help_payload__test("abstruse_map_multi", "join-abstruse_map_multi", f_fss_payload_header_map_flag_join_map_multi_e, test__fl_fss_payload_header_map__abstruse_map_multi__join_load_contents, 0); +} + +void test__fl_fss_payload_header_map__abstruse_map_multi__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) { + + headers->array[0].value.type = f_abstruse_map_multi_e; + headers->array[0].value.is.a_map_multi.key.used = 0; + headers->array[0].value.is.a_map_multi.value.used = 0; + headers->array[0].key.used = 0; + + f_string_map_multi_t * const map = &headers->array[0].value.is.a_map_multi; + + state->status = f_string_dynamic_append(object, &headers->array[headers->used].key); + assert_int_equal(state->status, F_okay); + + if (contents.used) { + state->status = f_string_dynamic_append(contents.array[0], &map->key); + assert_int_equal(state->status, F_okay); + + if (contents.used > 1) { + state->status = f_memory_array_increase(state->step_small, sizeof(f_string_dynamic_t), (void **) &map->value.array, &map->value.used, &map->value.size); + assert_int_equal(state->status, F_okay); + + map->value.array[map->value.used].used = 0; + + state->status = f_string_dynamic_append(contents.array[1], &map->value.array[map->value.used]); + assert_int_equal(state->status, F_okay); + + ++map->value.used; + } + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-join.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-join.h new file mode 100644 index 0000000..d8be1b9 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-join.h @@ -0,0 +1,37 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_payload_header_map__abstruse_map_multi_join_h +#define _TEST__FL_fss_payload_header_map__abstruse_map_multi_join_h + +/** + * Test that the function works for abstruse_map_multi type. + * + * @see fl_fss_payload_header_map() + */ +extern void test__fl_fss_payload_header_map__abstruse_map_multi__works_join(void **state); + +/** + * Callback to load the contents for the test. + * + * @param object + * The object parameter. + * @param contents + * The contents parameter. + * @param headers + * The headers parameter. +* @param state + * The state parameter. + * @param extra + * (optional) The extra parameter. + * Set to NULL to not use. + */ +extern void test__fl_fss_payload_header_map__abstruse_map_multi__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra); + +#endif // _TEST__FL_fss_payload_header_map__abstruse_map_multi_join_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-split.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-split.c new file mode 100644 index 0000000..3d31f62 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-split.c @@ -0,0 +1,44 @@ +#include "test-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_payload_header_map__abstruse_map_multi__works_split(void **void_state) { + + help_payload__test("abstruse_map_multi", "split-abstruse_map_multi", 0, test__fl_fss_payload_header_map__abstruse_map_multi__split_load_contents, 0); +} + +void test__fl_fss_payload_header_map__abstruse_map_multi__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) { + + headers->array[0].value.type = f_abstruse_map_multi_e; + headers->array[0].value.is.a_map_multi.key.used = 0; + headers->array[0].value.is.a_map_multi.value.used = 0; + headers->array[0].key.used = 0; + + f_string_map_multi_t * const map = &headers->array[0].value.is.a_map_multi; + + state->status = f_string_dynamic_append(object, &headers->array[headers->used].key); + assert_int_equal(state->status, F_okay); + + if (contents.used) { + state->status = f_string_dynamic_append(contents.array[0], &map->key); + assert_int_equal(state->status, F_okay); + + if (contents.used > 1) { + state->status = f_memory_array_increase(state->step_small, sizeof(f_string_dynamic_t), (void **) &map->value.array, &map->value.used, &map->value.size); + assert_int_equal(state->status, F_okay); + + map->value.array[map->value.used].used = 0; + + state->status = f_string_dynamic_append(contents.array[1], &map->value.array[map->value.used]); + assert_int_equal(state->status, F_okay); + + ++map->value.used; + } + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-split.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-split.h new file mode 100644 index 0000000..2903f0b --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multi-split.h @@ -0,0 +1,37 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_payload_header_map__abstruse_map_multi_split_h +#define _TEST__FL_fss_payload_header_map__abstruse_map_multi_split_h + +/** + * Test that the function works for abstruse_map_multi type. + * + * @see fl_fss_payload_header_map() + */ +extern void test__fl_fss_payload_header_map__abstruse_map_multi__works_split(void **state); + +/** + * Callback to load the contents for the test. + * + * @param object + * The object parameter. + * @param contents + * The contents parameter. + * @param headers + * The headers parameter. +* @param state + * The state parameter. + * @param extra + * (optional) The extra parameter. + * Set to NULL to not use. + */ +extern void test__fl_fss_payload_header_map__abstruse_map_multi__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra); + +#endif // _TEST__FL_fss_payload_header_map__abstruse_map_multi_split_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-join.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-join.c new file mode 100644 index 0000000..3430b64 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-join.c @@ -0,0 +1,52 @@ +#include "test-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_payload_header_map__abstruse_map_multis__works_join(void **void_state) { + + help_payload__test("abstruse_map_multis", "join-abstruse_map_multis", f_fss_payload_header_map_flag_join_map_multis_e, test__fl_fss_payload_header_map__abstruse_map_multis__join_load_contents, 0); +} + +void test__fl_fss_payload_header_map__abstruse_map_multis__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) { + + headers->array[0].value.type = f_abstruse_map_multis_e; + headers->array[0].value.is.a_map_multis.used = 0; + headers->array[0].key.used = 0; + + f_string_map_multis_t * const maps = &headers->array[0].value.is.a_map_multis; + + state->status = f_string_dynamic_append(object, &headers->array[headers->used].key); + assert_int_equal(state->status, F_okay); + + if (contents.used) { + state->status = f_memory_array_increase_by(contents.used, sizeof(f_string_map_multi_t), (void **) &maps->array, &maps->used, &maps->size); + assert_int_equal(state->status, F_okay); + + for (f_number_unsigned_t i = 0; i < contents.used; i += 2, ++maps->used) { + + maps->array[maps->used].key.used = 0; + maps->array[maps->used].value.used = 0; + + state->status = f_memory_array_increase(state->step_small, sizeof(f_string_dynamic_t), (void **) &maps->array[maps->used].value.array, &maps->array[maps->used].value.used, &maps->array[maps->used].value.size); + assert_int_equal(state->status, F_okay); + + state->status = f_string_dynamic_append(contents.array[i], &maps->array[maps->used].key); + assert_int_equal(state->status, F_okay); + + if (i + 1 < contents.used) { + maps->array[maps->used].value.array[maps->array[maps->used].value.used].used = 0; + + state->status = f_string_dynamic_append(contents.array[i + 1], &maps->array[maps->used].value.array[maps->array[maps->used].value.used]); + assert_int_equal(state->status, F_okay); + } + + ++maps->array[maps->used].value.used; + } // for + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-join.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-join.h new file mode 100644 index 0000000..50e0450 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-join.h @@ -0,0 +1,37 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_payload_header_map__abstruse_map_multis_join_h +#define _TEST__FL_fss_payload_header_map__abstruse_map_multis_join_h + +/** + * Test that the function works for abstruse_map_multis type. + * + * @see fl_fss_payload_header_maps() + */ +extern void test__fl_fss_payload_header_map__abstruse_map_multis__works_join(void **state); + +/** + * Callback to load the contents for the test. + * + * @param object + * The object parameter. + * @param contents + * The contents parameter. + * @param headers + * The headers parameter. +* @param state + * The state parameter. + * @param extra + * (optional) The extra parameter. + * Set to NULL to not use. + */ +extern void test__fl_fss_payload_header_map__abstruse_map_multis__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra); + +#endif // _TEST__FL_fss_payload_header_map__abstruse_map_multis_join_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-split.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-split.c new file mode 100644 index 0000000..83d2c4d --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-split.c @@ -0,0 +1,52 @@ +#include "test-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_payload_header_map__abstruse_map_multis__works_split(void **void_state) { + + help_payload__test("abstruse_map_multis", "split-abstruse_map_multis", 0, test__fl_fss_payload_header_map__abstruse_map_multis__split_load_contents, 0); +} + +void test__fl_fss_payload_header_map__abstruse_map_multis__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) { + + headers->array[0].value.type = f_abstruse_map_multis_e; + headers->array[0].value.is.a_map_multis.used = 0; + headers->array[0].key.used = 0; + + f_string_map_multis_t * const maps = &headers->array[0].value.is.a_map_multis; + + state->status = f_string_dynamic_append(object, &headers->array[headers->used].key); + assert_int_equal(state->status, F_okay); + + if (contents.used) { + state->status = f_memory_array_increase_by(contents.used, sizeof(f_string_map_multi_t), (void **) &maps->array, &maps->used, &maps->size); + assert_int_equal(state->status, F_okay); + + for (f_number_unsigned_t i = 0; i < contents.used; i += 2, ++maps->used) { + + maps->array[maps->used].key.used = 0; + maps->array[maps->used].value.used = 0; + + state->status = f_memory_array_increase(state->step_small, sizeof(f_string_dynamic_t), (void **) &maps->array[maps->used].value.array, &maps->array[maps->used].value.used, &maps->array[maps->used].value.size); + assert_int_equal(state->status, F_okay); + + state->status = f_string_dynamic_append(contents.array[i], &maps->array[maps->used].key); + assert_int_equal(state->status, F_okay); + + if (i + 1 < contents.used) { + maps->array[maps->used].value.array[maps->array[maps->used].value.used].used = 0; + + state->status = f_string_dynamic_append(contents.array[i + 1], &maps->array[maps->used].value.array[maps->array[maps->used].value.used]); + assert_int_equal(state->status, F_okay); + } + + ++maps->array[maps->used].value.used; + } // for + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-split.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-split.h new file mode 100644 index 0000000..ffc6fbd --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map_multis-split.h @@ -0,0 +1,37 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_payload_header_map__abstruse_map_multis_split_h +#define _TEST__FL_fss_payload_header_map__abstruse_map_multis_split_h + +/** + * Test that the function works for abstruse_map_multis type. + * + * @see fl_fss_payload_header_maps() + */ +extern void test__fl_fss_payload_header_map__abstruse_map_multis__works_split(void **state); + +/** + * Callback to load the contents for the test. + * + * @param object + * The object parameter. + * @param contents + * The contents parameter. + * @param headers + * The headers parameter. +* @param state + * The state parameter. + * @param extra + * (optional) The extra parameter. + * Set to NULL to not use. + */ +extern void test__fl_fss_payload_header_map__abstruse_map_multis__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra); + +#endif // _TEST__FL_fss_payload_header_map__abstruse_map_multis_split_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-join.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-join.c new file mode 100644 index 0000000..9004e28 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-join.c @@ -0,0 +1,45 @@ +#include "test-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_payload_header_map__abstruse_maps__works_join(void **void_state) { + + help_payload__test("abstruse_maps", "join-abstruse_maps", f_fss_payload_header_map_flag_join_maps_e, test__fl_fss_payload_header_map__abstruse_maps__join_load_contents, 0); +} + +void test__fl_fss_payload_header_map__abstruse_maps__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) { + + headers->array[0].value.type = f_abstruse_maps_e; + headers->array[0].value.is.a_maps.used = 0; + headers->array[0].key.used = 0; + + f_string_maps_t * const maps = &headers->array[0].value.is.a_maps; + + state->status = f_string_dynamic_append(object, &headers->array[headers->used].key); + assert_int_equal(state->status, F_okay); + + if (contents.used) { + state->status = f_memory_array_increase_by(contents.used, sizeof(f_string_map_t), (void **) &maps->array, &maps->used, &maps->size); + assert_int_equal(state->status, F_okay); + + for (f_number_unsigned_t i = 0; i < contents.used; i += 2, ++maps->used) { + + maps->array[maps->used].key.used = 0; + maps->array[maps->used].value.used = 0; + + state->status = f_string_dynamic_append(contents.array[i], &maps->array[maps->used].key); + assert_int_equal(state->status, F_okay); + + if (i + 1 < contents.used) { + state->status = f_string_dynamic_append(contents.array[i + 1], &maps->array[maps->used].value); + assert_int_equal(state->status, F_okay); + } + } // for + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-join.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-join.h new file mode 100644 index 0000000..7a84e67 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-join.h @@ -0,0 +1,37 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_payload_header_map__abstruse_maps_join_h +#define _TEST__FL_fss_payload_header_map__abstruse_maps_join_h + +/** + * Test that the function works for abstruse_maps type. + * + * @see fl_fss_payload_header_maps() + */ +extern void test__fl_fss_payload_header_map__abstruse_maps__works_join(void **state); + +/** + * Callback to load the contents for the test. + * + * @param object + * The object parameter. + * @param contents + * The contents parameter. + * @param headers + * The headers parameter. +* @param state + * The state parameter. + * @param extra + * (optional) The extra parameter. + * Set to NULL to not use. + */ +extern void test__fl_fss_payload_header_map__abstruse_maps__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra); + +#endif // _TEST__FL_fss_payload_header_map__abstruse_maps_join_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-split.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-split.c new file mode 100644 index 0000000..c7d96a3 --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-split.c @@ -0,0 +1,45 @@ +#include "test-fss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__fl_fss_payload_header_map__abstruse_maps__works_split(void **void_state) { + + help_payload__test("abstruse_maps", "split-abstruse_maps", 0, test__fl_fss_payload_header_map__abstruse_maps__split_load_contents, 0); +} + +void test__fl_fss_payload_header_map__abstruse_maps__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) { + + headers->array[0].value.type = f_abstruse_maps_e; + headers->array[0].value.is.a_maps.used = 0; + headers->array[0].key.used = 0; + + f_string_maps_t * const maps = &headers->array[0].value.is.a_maps; + + state->status = f_string_dynamic_append(object, &headers->array[headers->used].key); + assert_int_equal(state->status, F_okay); + + if (contents.used) { + state->status = f_memory_array_increase_by(contents.used, sizeof(f_string_map_t), (void **) &maps->array, &maps->used, &maps->size); + assert_int_equal(state->status, F_okay); + + for (f_number_unsigned_t i = 0; i < contents.used; i += 2, ++maps->used) { + + maps->array[maps->used].key.used = 0; + maps->array[maps->used].value.used = 0; + + state->status = f_string_dynamic_append(contents.array[i], &maps->array[maps->used].key); + assert_int_equal(state->status, F_okay); + + if (i + 1 < contents.used) { + state->status = f_string_dynamic_append(contents.array[i + 1], &maps->array[maps->used].value); + assert_int_equal(state->status, F_okay); + } + } // for + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-split.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-split.h new file mode 100644 index 0000000..379311d --- /dev/null +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_maps-split.h @@ -0,0 +1,37 @@ +/** + * FLL - Level 2 + * + * Project: FSS + * API Version: 0.6 + * Licenses: lgpl-2.1-or-later + * + * Test the fl_fss project. + */ +#ifndef _TEST__FL_fss_payload_header_map__abstruse_maps_split_h +#define _TEST__FL_fss_payload_header_map__abstruse_maps_split_h + +/** + * Test that the function works for abstruse_maps type. + * + * @see fl_fss_payload_header_maps() + */ +extern void test__fl_fss_payload_header_map__abstruse_maps__works_split(void **state); + +/** + * Callback to load the contents for the test. + * + * @param object + * The object parameter. + * @param contents + * The contents parameter. + * @param headers + * The headers parameter. +* @param state + * The state parameter. + * @param extra + * (optional) The extra parameter. + * Set to NULL to not use. + */ +extern void test__fl_fss_payload_header_map__abstruse_maps__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra); + +#endif // _TEST__FL_fss_payload_header_map__abstruse_maps_split_h diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map.c index d70104d..978d605 100644 --- a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map.c +++ b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map.c @@ -8,7 +8,7 @@ void test__fl_fss_payload_header_map__parameter_checking(void **void_state) { const f_abstruse_maps_t headers = f_abstruse_maps_t_initialize; f_state_t state = f_state_t_initialize; - f_fss_payload_header_state_t data = f_fss_payload_header_state_t_initialize; + fl_fss_payload_header_state_t data = fl_fss_payload_header_state_t_initialize; f_string_dynamic_t cache = f_string_dynamic_t_initialize; f_string_maps_t destinations = f_string_maps_t_initialize; @@ -57,7 +57,7 @@ void test__fl_fss_payload_header_map__returns_data_not(void **void_state) { const f_abstruse_maps_t headers = f_abstruse_maps_t_initialize; f_state_t state = f_state_t_initialize; - f_fss_payload_header_state_t data = f_fss_payload_header_state_t_initialize; + fl_fss_payload_header_state_t data = fl_fss_payload_header_state_t_initialize; f_string_dynamic_t cache = f_string_dynamic_t_initialize; f_string_maps_t destinations = f_string_maps_t_initialize; diff --git a/level_1/fl_fss/tests/unit/c/test-fss.c b/level_1/fl_fss/tests/unit/c/test-fss.c index 5e3934f..5685825 100644 --- a/level_1/fl_fss/tests/unit/c/test-fss.c +++ b/level_1/fl_fss/tests/unit/c/test-fss.c @@ -73,6 +73,12 @@ int main(void) { cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_int64s__works_split), cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_map__works_join), cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_map__works_split), + cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_map_multi__works_join), + cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_map_multi__works_split), + cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_map_multis__works_join), + cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_map_multis__works_split), + cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_maps__works_join), + cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_maps__works_split), cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_signed__works_join), cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_signeds__works_join), cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_signeds__works_split), diff --git a/level_1/fl_fss/tests/unit/c/test-fss.h b/level_1/fl_fss/tests/unit/c/test-fss.h index b6b0516..78fe05b 100644 --- a/level_1/fl_fss/tests/unit/c/test-fss.h +++ b/level_1/fl_fss/tests/unit/c/test-fss.h @@ -75,6 +75,12 @@ #include "test-fss-payload_header_map-abstruse_int64s-split.h" #include "test-fss-payload_header_map-abstruse_map-join.h" #include "test-fss-payload_header_map-abstruse_map-split.h" +#include "test-fss-payload_header_map-abstruse_map_multi-join.h" +#include "test-fss-payload_header_map-abstruse_map_multi-split.h" +#include "test-fss-payload_header_map-abstruse_map_multis-join.h" +#include "test-fss-payload_header_map-abstruse_map_multis-split.h" +#include "test-fss-payload_header_map-abstruse_maps-join.h" +#include "test-fss-payload_header_map-abstruse_maps-split.h" #include "test-fss-payload_header_map-abstruse_signed-join.h" #include "test-fss-payload_header_map-abstruse_signeds-join.h" #include "test-fss-payload_header_map-abstruse_signeds-split.h"