diff --git a/c/src/acquisition.c b/c/src/acquisition.c index 427b6b1478..2f5c4e1b96 100644 --- a/c/src/acquisition.c +++ b/c/src/acquisition.c @@ -115,9 +115,6 @@ int sbp_msg_acq_result_cmp(const sbp_msg_acq_result_t *a, } ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -221,9 +218,6 @@ int sbp_msg_acq_result_dep_c_cmp(const sbp_msg_acq_result_dep_c_t *a, } ret = sbp_gnss_signal_dep_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -327,9 +321,6 @@ int sbp_msg_acq_result_dep_b_cmp(const sbp_msg_acq_result_dep_b_t *a, } ret = sbp_gnss_signal_dep_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -433,9 +424,6 @@ int sbp_msg_acq_result_dep_a_cmp(const sbp_msg_acq_result_dep_a_t *a, } ret = sbp_u8_cmp(&a->prn, &b->prn); - if (ret != 0) { - return ret; - } return ret; } @@ -611,9 +599,6 @@ int sbp_acq_sv_profile_cmp(const sbp_acq_sv_profile_t *a, } ret = sbp_u32_cmp(&a->cp, &b->cp); - if (ret != 0) { - return ret; - } return ret; } @@ -790,9 +775,6 @@ int sbp_acq_sv_profile_dep_cmp(const sbp_acq_sv_profile_dep_t *a, } ret = sbp_u32_cmp(&a->cp, &b->cp); - if (ret != 0) { - return ret; - } return ret; } @@ -871,12 +853,15 @@ int sbp_msg_acq_sv_profile_cmp(const sbp_msg_acq_sv_profile_t *a, int ret = 0; ret = sbp_u8_cmp(&a->n_acq_sv_profile, &b->n_acq_sv_profile); - for (uint8_t i = 0; ret == 0 && i < a->n_acq_sv_profile; i++) { - ret = sbp_acq_sv_profile_cmp(&a->acq_sv_profile[i], &b->acq_sv_profile[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_acq_sv_profile; i++) { + ret = sbp_acq_sv_profile_cmp(&a->acq_sv_profile[i], &b->acq_sv_profile[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -957,12 +942,15 @@ int sbp_msg_acq_sv_profile_dep_cmp(const sbp_msg_acq_sv_profile_dep_t *a, int ret = 0; ret = sbp_u8_cmp(&a->n_acq_sv_profile, &b->n_acq_sv_profile); - for (uint8_t i = 0; ret == 0 && i < a->n_acq_sv_profile; i++) { - ret = sbp_acq_sv_profile_dep_cmp(&a->acq_sv_profile[i], - &b->acq_sv_profile[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_acq_sv_profile; i++) { + ret = sbp_acq_sv_profile_dep_cmp(&a->acq_sv_profile[i], + &b->acq_sv_profile[i]); + if (ret != 0) { + return ret; + } + } return ret; } diff --git a/c/src/bootload.c b/c/src/bootload.c index 1c4acb4a22..6339d0ba5f 100644 --- a/c/src/bootload.c +++ b/c/src/bootload.c @@ -264,9 +264,6 @@ int sbp_msg_bootloader_handshake_resp_cmp( } ret = sbp_msg_bootloader_handshake_resp_version_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -338,9 +335,6 @@ int sbp_msg_bootloader_jump_to_app_cmp( int ret = 0; ret = sbp_u8_cmp(&a->jump, &b->jump); - if (ret != 0) { - return ret; - } return ret; } @@ -482,12 +476,11 @@ int sbp_msg_nap_device_dna_resp_cmp(const sbp_msg_nap_device_dna_resp_t *a, const sbp_msg_nap_device_dna_resp_t *b) { int ret = 0; - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_NAP_DEVICE_DNA_RESP_DNA_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_NAP_DEVICE_DNA_RESP_DNA_MAX; i++) { ret = sbp_u8_cmp(&a->dna[i], &b->dna[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -662,8 +655,5 @@ int sbp_msg_bootloader_handshake_dep_a_cmp( int ret = 0; ret = sbp_msg_bootloader_handshake_dep_a_handshake_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/ext_events.c b/c/src/ext_events.c index 4aa438f3b6..3167fa6172 100644 --- a/c/src/ext_events.c +++ b/c/src/ext_events.c @@ -126,8 +126,5 @@ int sbp_msg_ext_event_cmp(const sbp_msg_ext_event_t *a, } ret = sbp_u8_cmp(&a->pin, &b->pin); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/file_io.c b/c/src/file_io.c index 08ba0eca77..d64592db67 100644 --- a/c/src/file_io.c +++ b/c/src/file_io.c @@ -218,9 +218,6 @@ int sbp_msg_fileio_read_req_cmp(const sbp_msg_fileio_read_req_t *a, } ret = sbp_msg_fileio_read_req_filename_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -311,12 +308,15 @@ int sbp_msg_fileio_read_resp_cmp(const sbp_msg_fileio_read_resp_t *a, } ret = sbp_u8_cmp(&a->n_contents, &b->n_contents); - for (uint8_t i = 0; ret == 0 && i < a->n_contents; i++) { - ret = sbp_u8_cmp(&a->contents[i], &b->contents[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_contents; i++) { + ret = sbp_u8_cmp(&a->contents[i], &b->contents[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -509,9 +509,6 @@ int sbp_msg_fileio_read_dir_req_cmp(const sbp_msg_fileio_read_dir_req_t *a, } ret = sbp_msg_fileio_read_dir_req_dirname_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -686,9 +683,6 @@ int sbp_msg_fileio_read_dir_resp_cmp(const sbp_msg_fileio_read_dir_resp_t *a, } ret = sbp_msg_fileio_read_dir_resp_contents_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -859,9 +853,6 @@ int sbp_msg_fileio_remove_cmp(const sbp_msg_fileio_remove_t *a, int ret = 0; ret = sbp_msg_fileio_remove_filename_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1075,12 +1066,15 @@ int sbp_msg_fileio_write_req_cmp(const sbp_msg_fileio_write_req_t *a, } ret = sbp_u8_cmp(&a->n_data, &b->n_data); - for (uint8_t i = 0; ret == 0 && i < a->n_data; i++) { - ret = sbp_u8_cmp(&a->data[i], &b->data[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_data; i++) { + ret = sbp_u8_cmp(&a->data[i], &b->data[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1151,9 +1145,6 @@ int sbp_msg_fileio_write_resp_cmp(const sbp_msg_fileio_write_resp_t *a, int ret = 0; ret = sbp_u32_cmp(&a->sequence, &b->sequence); - if (ret != 0) { - return ret; - } return ret; } @@ -1224,9 +1215,6 @@ int sbp_msg_fileio_config_req_cmp(const sbp_msg_fileio_config_req_t *a, int ret = 0; ret = sbp_u32_cmp(&a->sequence, &b->sequence); - if (ret != 0) { - return ret; - } return ret; } @@ -1330,8 +1318,5 @@ int sbp_msg_fileio_config_resp_cmp(const sbp_msg_fileio_config_resp_t *a, } ret = sbp_u32_cmp(&a->fileio_version, &b->fileio_version); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/flash.c b/c/src/flash.c index fdabc64cf1..7dfbcfe438 100644 --- a/c/src/flash.c +++ b/c/src/flash.c @@ -116,9 +116,11 @@ int sbp_msg_flash_program_cmp(const sbp_msg_flash_program_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_FLASH_PROGRAM_ADDR_START_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_FLASH_PROGRAM_ADDR_START_MAX; i++) { ret = sbp_u8_cmp(&a->addr_start[i], &b->addr_start[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -130,12 +132,15 @@ int sbp_msg_flash_program_cmp(const sbp_msg_flash_program_t *a, } ret = sbp_u8_cmp(&a->addr_len, &b->addr_len); - for (uint8_t i = 0; ret == 0 && i < a->addr_len; i++) { - ret = sbp_u8_cmp(&a->data[i], &b->data[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->addr_len; i++) { + ret = sbp_u8_cmp(&a->data[i], &b->data[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -204,9 +209,6 @@ int sbp_msg_flash_done_cmp(const sbp_msg_flash_done_t *a, int ret = 0; ret = sbp_u8_cmp(&a->response, &b->response); - if (ret != 0) { - return ret; - } return ret; } @@ -296,18 +298,17 @@ int sbp_msg_flash_read_req_cmp(const sbp_msg_flash_read_req_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_FLASH_READ_REQ_ADDR_START_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_FLASH_READ_REQ_ADDR_START_MAX; i++) { ret = sbp_u8_cmp(&a->addr_start[i], &b->addr_start[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u8_cmp(&a->addr_len, &b->addr_len); - if (ret != 0) { - return ret; - } return ret; } @@ -397,18 +398,17 @@ int sbp_msg_flash_read_resp_cmp(const sbp_msg_flash_read_resp_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_FLASH_READ_RESP_ADDR_START_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_FLASH_READ_RESP_ADDR_START_MAX; i++) { ret = sbp_u8_cmp(&a->addr_start[i], &b->addr_start[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u8_cmp(&a->addr_len, &b->addr_len); - if (ret != 0) { - return ret; - } return ret; } @@ -488,9 +488,6 @@ int sbp_msg_flash_erase_cmp(const sbp_msg_flash_erase_t *a, } ret = sbp_u32_cmp(&a->sector_num, &b->sector_num); - if (ret != 0) { - return ret; - } return ret; } @@ -562,9 +559,6 @@ int sbp_msg_stm_flash_lock_sector_cmp( int ret = 0; ret = sbp_u32_cmp(&a->sector, &b->sector); - if (ret != 0) { - return ret; - } return ret; } @@ -636,9 +630,6 @@ int sbp_msg_stm_flash_unlock_sector_cmp( int ret = 0; ret = sbp_u32_cmp(&a->sector, &b->sector); - if (ret != 0) { - return ret; - } return ret; } @@ -780,12 +771,11 @@ int sbp_msg_stm_unique_id_resp_cmp(const sbp_msg_stm_unique_id_resp_t *a, const sbp_msg_stm_unique_id_resp_t *b) { int ret = 0; - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_STM_UNIQUE_ID_RESP_STM_ID_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_STM_UNIQUE_ID_RESP_STM_ID_MAX; i++) { ret = sbp_u8_cmp(&a->stm_id[i], &b->stm_id[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -861,12 +851,11 @@ int sbp_msg_m25_flash_write_status_cmp( const sbp_msg_m25_flash_write_status_t *b) { int ret = 0; - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_M25_FLASH_WRITE_STATUS_STATUS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_M25_FLASH_WRITE_STATUS_STATUS_MAX; i++) { ret = sbp_u8_cmp(&a->status[i], &b->status[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } diff --git a/c/src/gnss.c b/c/src/gnss.c index 7ab62b659e..48eae61d36 100644 --- a/c/src/gnss.c +++ b/c/src/gnss.c @@ -79,9 +79,6 @@ int sbp_v4_gnss_signal_cmp(const sbp_v4_gnss_signal_t *a, } ret = sbp_u8_cmp(&a->code, &b->code); - if (ret != 0) { - return ret; - } return ret; } @@ -144,9 +141,6 @@ int sbp_sv_id_cmp(const sbp_sv_id_t *a, const sbp_sv_id_t *b) { } ret = sbp_u8_cmp(&a->constellation, &b->constellation); - if (ret != 0) { - return ret; - } return ret; } @@ -223,9 +217,6 @@ int sbp_gnss_signal_dep_cmp(const sbp_gnss_signal_dep_t *a, } ret = sbp_u8_cmp(&a->reserved, &b->reserved); - if (ret != 0) { - return ret; - } return ret; } @@ -291,9 +282,6 @@ int sbp_gps_time_dep_cmp(const sbp_gps_time_dep_t *a, } ret = sbp_u16_cmp(&a->wn, &b->wn); - if (ret != 0) { - return ret; - } return ret; } @@ -359,9 +347,6 @@ int sbp_gps_time_sec_cmp(const sbp_gps_time_sec_t *a, } ret = sbp_u16_cmp(&a->wn, &b->wn); - if (ret != 0) { - return ret; - } return ret; } @@ -438,9 +423,6 @@ int sbp_v4_gps_time_cmp(const sbp_v4_gps_time_t *a, } ret = sbp_u16_cmp(&a->wn, &b->wn); - if (ret != 0) { - return ret; - } return ret; } @@ -506,8 +488,5 @@ int sbp_carrier_phase_cmp(const sbp_carrier_phase_t *a, } ret = sbp_u8_cmp(&a->f, &b->f); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/imu.c b/c/src/imu.c index d29d818dd2..4560f3bde0 100644 --- a/c/src/imu.c +++ b/c/src/imu.c @@ -157,9 +157,6 @@ int sbp_msg_imu_raw_cmp(const sbp_msg_imu_raw_t *a, } ret = sbp_s16_cmp(&a->gyr_z, &b->gyr_z); - if (ret != 0) { - return ret; - } return ret; } @@ -248,8 +245,5 @@ int sbp_msg_imu_aux_cmp(const sbp_msg_imu_aux_t *a, } ret = sbp_u8_cmp(&a->imu_conf, &b->imu_conf); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/integrity.c b/c/src/integrity.c index 23ab5c295d..34e539ba4c 100644 --- a/c/src/integrity.c +++ b/c/src/integrity.c @@ -136,9 +136,6 @@ int sbp_integrity_ssr_header_cmp(const sbp_integrity_ssr_header_t *a, } ret = sbp_u8_cmp(&a->chain_id, &b->chain_id); - if (ret != 0) { - return ret; - } return ret; } @@ -335,9 +332,11 @@ int sbp_msg_ssr_flag_high_level_cmp(const sbp_msg_ssr_flag_high_level_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_SSR_FLAG_HIGH_LEVEL_RESERVED_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_SSR_FLAG_HIGH_LEVEL_RESERVED_MAX; i++) { ret = sbp_u8_cmp(&a->reserved[i], &b->reserved[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -360,9 +359,6 @@ int sbp_msg_ssr_flag_high_level_cmp(const sbp_msg_ssr_flag_high_level_t *a, ret = sbp_u8_cmp(&a->use_iono_grid_point_sat_los, &b->use_iono_grid_point_sat_los); - if (ret != 0) { - return ret; - } return ret; } @@ -519,12 +515,15 @@ int sbp_msg_ssr_flag_satellites_cmp(const sbp_msg_ssr_flag_satellites_t *a, } ret = sbp_u8_cmp(&a->n_faulty_sats, &b->n_faulty_sats); - for (uint8_t i = 0; ret == 0 && i < a->n_faulty_sats; i++) { - ret = sbp_u8_cmp(&a->faulty_sats[i], &b->faulty_sats[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_faulty_sats; i++) { + ret = sbp_u8_cmp(&a->faulty_sats[i], &b->faulty_sats[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -627,12 +626,15 @@ int sbp_msg_ssr_flag_tropo_grid_points_cmp( } ret = sbp_u8_cmp(&a->n_faulty_points, &b->n_faulty_points); - for (uint8_t i = 0; ret == 0 && i < a->n_faulty_points; i++) { - ret = sbp_u16_cmp(&a->faulty_points[i], &b->faulty_points[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_faulty_points; i++) { + ret = sbp_u16_cmp(&a->faulty_points[i], &b->faulty_points[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -735,12 +737,15 @@ int sbp_msg_ssr_flag_iono_grid_points_cmp( } ret = sbp_u8_cmp(&a->n_faulty_points, &b->n_faulty_points); - for (uint8_t i = 0; ret == 0 && i < a->n_faulty_points; i++) { - ret = sbp_u16_cmp(&a->faulty_points[i], &b->faulty_points[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_faulty_points; i++) { + ret = sbp_u16_cmp(&a->faulty_points[i], &b->faulty_points[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -843,12 +848,15 @@ int sbp_msg_ssr_flag_iono_tile_sat_los_cmp( } ret = sbp_u8_cmp(&a->n_faulty_los, &b->n_faulty_los); - for (uint8_t i = 0; ret == 0 && i < a->n_faulty_los; i++) { - ret = sbp_sv_id_cmp(&a->faulty_los[i], &b->faulty_los[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_faulty_los; i++) { + ret = sbp_sv_id_cmp(&a->faulty_los[i], &b->faulty_los[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -965,12 +973,15 @@ int sbp_msg_ssr_flag_iono_grid_point_sat_los_cmp( } ret = sbp_u8_cmp(&a->n_faulty_los, &b->n_faulty_los); - for (uint8_t i = 0; ret == 0 && i < a->n_faulty_los; i++) { - ret = sbp_sv_id_cmp(&a->faulty_los[i], &b->faulty_los[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_faulty_los; i++) { + ret = sbp_sv_id_cmp(&a->faulty_los[i], &b->faulty_los[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1095,8 +1106,5 @@ int sbp_msg_acknowledge_cmp(const sbp_msg_acknowledge_t *a, } ret = sbp_u8_cmp(&a->solution_id, &b->solution_id); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/linux.c b/c/src/linux.c index 6d050c2b42..33aea91ace 100644 --- a/c/src/linux.c +++ b/c/src/linux.c @@ -226,18 +226,17 @@ int sbp_msg_linux_cpu_state_dep_a_cmp( return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_LINUX_CPU_STATE_DEP_A_TNAME_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_LINUX_CPU_STATE_DEP_A_TNAME_MAX; i++) { ret = sbp_char_cmp(&a->tname[i], &b->tname[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_msg_linux_cpu_state_dep_a_cmdline_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -450,18 +449,17 @@ int sbp_msg_linux_mem_state_dep_a_cmp( return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_LINUX_MEM_STATE_DEP_A_TNAME_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_LINUX_MEM_STATE_DEP_A_TNAME_MAX; i++) { ret = sbp_char_cmp(&a->tname[i], &b->tname[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_msg_linux_mem_state_dep_a_cmdline_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -588,9 +586,6 @@ int sbp_msg_linux_sys_state_dep_a_cmp( } ret = sbp_u16_cmp(&a->pid_count, &b->pid_count); - if (ret != 0) { - return ret; - } return ret; } @@ -819,9 +814,6 @@ int sbp_msg_linux_process_socket_counts_cmp( } ret = sbp_msg_linux_process_socket_counts_cmdline_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1073,19 +1065,17 @@ int sbp_msg_linux_process_socket_queues_cmp( } for (uint8_t i = 0; - ret == 0 && - i < SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES_ADDRESS_OF_LARGEST_MAX; - i++) { + i < SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES_ADDRESS_OF_LARGEST_MAX; i++) { ret = sbp_char_cmp(&a->address_of_largest[i], &b->address_of_largest[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_msg_linux_process_socket_queues_cmdline_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1195,21 +1185,23 @@ int sbp_msg_linux_socket_usage_cmp(const sbp_msg_linux_socket_usage_t *a, return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_LINUX_SOCKET_USAGE_SOCKET_STATE_COUNTS_MAX; + for (uint8_t i = 0; i < SBP_MSG_LINUX_SOCKET_USAGE_SOCKET_STATE_COUNTS_MAX; i++) { ret = sbp_u16_cmp(&a->socket_state_counts[i], &b->socket_state_counts[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_LINUX_SOCKET_USAGE_SOCKET_TYPE_COUNTS_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_LINUX_SOCKET_USAGE_SOCKET_TYPE_COUNTS_MAX; + i++) { ret = sbp_u16_cmp(&a->socket_type_counts[i], &b->socket_type_counts[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -1414,9 +1406,6 @@ int sbp_msg_linux_process_fd_count_cmp( } ret = sbp_msg_linux_process_fd_count_cmdline_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1602,9 +1591,6 @@ int sbp_msg_linux_process_fd_summary_cmp( } ret = sbp_msg_linux_process_fd_summary_most_opened_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1839,17 +1825,17 @@ int sbp_msg_linux_cpu_state_cmp(const sbp_msg_linux_cpu_state_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_LINUX_CPU_STATE_TNAME_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_LINUX_CPU_STATE_TNAME_MAX; i++) { ret = sbp_char_cmp(&a->tname[i], &b->tname[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_msg_linux_cpu_state_cmdline_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -2084,17 +2070,17 @@ int sbp_msg_linux_mem_state_cmp(const sbp_msg_linux_mem_state_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_LINUX_MEM_STATE_TNAME_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_LINUX_MEM_STATE_TNAME_MAX; i++) { ret = sbp_char_cmp(&a->tname[i], &b->tname[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_msg_linux_mem_state_cmdline_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -2241,8 +2227,5 @@ int sbp_msg_linux_sys_state_cmp(const sbp_msg_linux_sys_state_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/logging.c b/c/src/logging.c index c0ca0edd3a..f34dda0c69 100644 --- a/c/src/logging.c +++ b/c/src/logging.c @@ -165,9 +165,6 @@ int sbp_msg_log_cmp(const sbp_msg_log_t *a, const sbp_msg_log_t *b) { } ret = sbp_msg_log_text_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -263,12 +260,15 @@ int sbp_msg_fwd_cmp(const sbp_msg_fwd_t *a, const sbp_msg_fwd_t *b) { } ret = sbp_u8_cmp(&a->n_fwd_payload, &b->n_fwd_payload); - for (uint8_t i = 0; ret == 0 && i < a->n_fwd_payload; i++) { - ret = sbp_u8_cmp(&a->fwd_payload[i], &b->fwd_payload[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_fwd_payload; i++) { + ret = sbp_u8_cmp(&a->fwd_payload[i], &b->fwd_payload[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -419,8 +419,5 @@ int sbp_msg_print_dep_cmp(const sbp_msg_print_dep_t *a, int ret = 0; ret = sbp_msg_print_dep_text_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/mag.c b/c/src/mag.c index de9c63bc3c..c92640959f 100644 --- a/c/src/mag.c +++ b/c/src/mag.c @@ -124,8 +124,5 @@ int sbp_msg_mag_raw_cmp(const sbp_msg_mag_raw_t *a, } ret = sbp_s16_cmp(&a->mag_z, &b->mag_z); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/navigation.c b/c/src/navigation.c index 1f1328933c..641487066d 100644 --- a/c/src/navigation.c +++ b/c/src/navigation.c @@ -113,9 +113,6 @@ int sbp_msg_gps_time_cmp(const sbp_msg_gps_time_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -217,9 +214,6 @@ int sbp_msg_gps_time_gnss_cmp(const sbp_msg_gps_time_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -374,9 +368,6 @@ int sbp_msg_utc_time_cmp(const sbp_msg_utc_time_t *a, } ret = sbp_u32_cmp(&a->ns, &b->ns); - if (ret != 0) { - return ret; - } return ret; } @@ -533,9 +524,6 @@ int sbp_msg_utc_time_gnss_cmp(const sbp_msg_utc_time_gnss_t *a, } ret = sbp_u32_cmp(&a->ns, &b->ns); - if (ret != 0) { - return ret; - } return ret; } @@ -666,9 +654,6 @@ int sbp_msg_dops_cmp(const sbp_msg_dops_t *a, const sbp_msg_dops_t *b) { } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -801,9 +786,6 @@ int sbp_msg_pos_ecef_cmp(const sbp_msg_pos_ecef_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -993,9 +975,6 @@ int sbp_msg_pos_ecef_cov_cmp(const sbp_msg_pos_ecef_cov_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1139,9 +1118,6 @@ int sbp_msg_pos_llh_cmp(const sbp_msg_pos_llh_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1331,9 +1307,6 @@ int sbp_msg_pos_llh_cov_cmp(const sbp_msg_pos_llh_cov_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1414,9 +1387,6 @@ int sbp_estimated_horizontal_error_ellipse_cmp( } ret = sbp_float_cmp(&a->orientation, &b->orientation); - if (ret != 0) { - return ret; - } return ret; } @@ -1620,9 +1590,6 @@ int sbp_msg_pos_llh_acc_cmp(const sbp_msg_pos_llh_acc_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1757,9 +1724,6 @@ int sbp_msg_baseline_ecef_cmp(const sbp_msg_baseline_ecef_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1905,9 +1869,6 @@ int sbp_msg_baseline_ned_cmp(const sbp_msg_baseline_ned_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -2040,9 +2001,6 @@ int sbp_msg_vel_ecef_cmp(const sbp_msg_vel_ecef_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -2232,9 +2190,6 @@ int sbp_msg_vel_ecef_cov_cmp(const sbp_msg_vel_ecef_cov_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -2378,9 +2333,6 @@ int sbp_msg_vel_ned_cmp(const sbp_msg_vel_ned_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -2570,9 +2522,6 @@ int sbp_msg_vel_ned_cov_cmp(const sbp_msg_vel_ned_cov_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -2707,9 +2656,6 @@ int sbp_msg_pos_ecef_gnss_cmp(const sbp_msg_pos_ecef_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -2901,9 +2847,6 @@ int sbp_msg_pos_ecef_cov_gnss_cmp(const sbp_msg_pos_ecef_cov_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -3049,9 +2992,6 @@ int sbp_msg_pos_llh_gnss_cmp(const sbp_msg_pos_llh_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -3243,9 +3183,6 @@ int sbp_msg_pos_llh_cov_gnss_cmp(const sbp_msg_pos_llh_cov_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -3380,9 +3317,6 @@ int sbp_msg_vel_ecef_gnss_cmp(const sbp_msg_vel_ecef_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -3574,9 +3508,6 @@ int sbp_msg_vel_ecef_cov_gnss_cmp(const sbp_msg_vel_ecef_cov_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -3722,9 +3653,6 @@ int sbp_msg_vel_ned_gnss_cmp(const sbp_msg_vel_ned_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -3916,9 +3844,6 @@ int sbp_msg_vel_ned_cov_gnss_cmp(const sbp_msg_vel_ned_cov_gnss_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -4106,9 +4031,6 @@ int sbp_msg_vel_body_cmp(const sbp_msg_vel_body_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -4252,9 +4174,6 @@ int sbp_msg_vel_cog_cmp(const sbp_msg_vel_cog_t *a, } ret = sbp_u16_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -4335,9 +4254,6 @@ int sbp_msg_age_corrections_cmp(const sbp_msg_age_corrections_t *a, } ret = sbp_u16_cmp(&a->age, &b->age); - if (ret != 0) { - return ret; - } return ret; } @@ -4440,9 +4356,6 @@ int sbp_msg_gps_time_dep_a_cmp(const sbp_msg_gps_time_dep_a_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -4566,9 +4479,6 @@ int sbp_msg_dops_dep_a_cmp(const sbp_msg_dops_dep_a_t *a, } ret = sbp_u16_cmp(&a->vdop, &b->vdop); - if (ret != 0) { - return ret; - } return ret; } @@ -4704,9 +4614,6 @@ int sbp_msg_pos_ecef_dep_a_cmp(const sbp_msg_pos_ecef_dep_a_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -4852,9 +4759,6 @@ int sbp_msg_pos_llh_dep_a_cmp(const sbp_msg_pos_llh_dep_a_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -4991,9 +4895,6 @@ int sbp_msg_baseline_ecef_dep_a_cmp(const sbp_msg_baseline_ecef_dep_a_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -5141,9 +5042,6 @@ int sbp_msg_baseline_ned_dep_a_cmp(const sbp_msg_baseline_ned_dep_a_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -5279,9 +5177,6 @@ int sbp_msg_vel_ecef_dep_a_cmp(const sbp_msg_vel_ecef_dep_a_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -5427,9 +5322,6 @@ int sbp_msg_vel_ned_dep_a_cmp(const sbp_msg_vel_ned_dep_a_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -5534,9 +5426,6 @@ int sbp_msg_baseline_heading_dep_a_cmp( } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -5674,9 +5563,6 @@ int sbp_msg_protection_level_dep_a_cmp( } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -5967,9 +5853,6 @@ int sbp_msg_protection_level_cmp(const sbp_msg_protection_level_t *a, } ret = sbp_u32_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -6127,9 +6010,6 @@ int sbp_msg_utc_leap_second_cmp(const sbp_msg_utc_leap_second_t *a, } ret = sbp_s8_cmp(&a->count_after, &b->count_after); - if (ret != 0) { - return ret; - } return ret; } @@ -6327,17 +6207,21 @@ int sbp_msg_reference_frame_param_cmp( return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_REFERENCE_FRAME_PARAM_SN_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_REFERENCE_FRAME_PARAM_SN_MAX; i++) { ret = sbp_char_cmp(&a->sn[i], &b->sn[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_REFERENCE_FRAME_PARAM_TN_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_REFERENCE_FRAME_PARAM_TN_MAX; i++) { ret = sbp_char_cmp(&a->tn[i], &b->tn[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -6424,9 +6308,6 @@ int sbp_msg_reference_frame_param_cmp( } ret = sbp_s16_cmp(&a->dot_scale, &b->dot_scale); - if (ret != 0) { - return ret; - } return ret; } @@ -6644,8 +6525,11 @@ int sbp_msg_pose_relative_cmp(const sbp_msg_pose_relative_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_POSE_RELATIVE_TRANS_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_POSE_RELATIVE_TRANS_MAX; i++) { ret = sbp_s32_cmp(&a->trans[i], &b->trans[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -6732,8 +6616,5 @@ int sbp_msg_pose_relative_cmp(const sbp_msg_pose_relative_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/ndb.c b/c/src/ndb.c index 09358b7df7..29913d3fe0 100644 --- a/c/src/ndb.c +++ b/c/src/ndb.c @@ -159,8 +159,5 @@ int sbp_msg_ndb_event_cmp(const sbp_msg_ndb_event_t *a, } ret = sbp_u16_cmp(&a->original_sender, &b->original_sender); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/observation.c b/c/src/observation.c index e8707ebe17..0894fb73c5 100644 --- a/c/src/observation.c +++ b/c/src/observation.c @@ -80,9 +80,6 @@ int sbp_observation_header_cmp(const sbp_observation_header_t *a, } ret = sbp_u8_cmp(&a->n_obs, &b->n_obs); - if (ret != 0) { - return ret; - } return ret; } @@ -146,9 +143,6 @@ int sbp_doppler_cmp(const sbp_doppler_t *a, const sbp_doppler_t *b) { } ret = sbp_u8_cmp(&a->f, &b->f); - if (ret != 0) { - return ret; - } return ret; } @@ -270,9 +264,6 @@ int sbp_packed_obs_content_cmp(const sbp_packed_obs_content_t *a, } ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -405,9 +396,6 @@ int sbp_packed_osr_content_cmp(const sbp_packed_osr_content_t *a, } ret = sbp_u16_cmp(&a->range_std, &b->range_std); - if (ret != 0) { - return ret; - } return ret; } @@ -493,12 +481,15 @@ int sbp_msg_obs_cmp(const sbp_msg_obs_t *a, const sbp_msg_obs_t *b) { } ret = sbp_u8_cmp(&a->n_obs, &b->n_obs); - for (uint8_t i = 0; ret == 0 && i < a->n_obs; i++) { - ret = sbp_packed_obs_content_cmp(&a->obs[i], &b->obs[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_obs; i++) { + ret = sbp_packed_obs_content_cmp(&a->obs[i], &b->obs[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -589,9 +580,6 @@ int sbp_msg_base_pos_llh_cmp(const sbp_msg_base_pos_llh_t *a, } ret = sbp_double_cmp(&a->height, &b->height); - if (ret != 0) { - return ret; - } return ret; } @@ -682,9 +670,6 @@ int sbp_msg_base_pos_ecef_cmp(const sbp_msg_base_pos_ecef_t *a, } ret = sbp_double_cmp(&a->z, &b->z); - if (ret != 0) { - return ret; - } return ret; } @@ -796,9 +781,6 @@ int sbp_ephemeris_common_content_cmp(const sbp_ephemeris_common_content_t *a, } ret = sbp_u8_cmp(&a->health_bits, &b->health_bits); - if (ret != 0) { - return ret; - } return ret; } @@ -911,9 +893,6 @@ int sbp_ephemeris_common_content_dep_b_cmp( } ret = sbp_u8_cmp(&a->health_bits, &b->health_bits); - if (ret != 0) { - return ret; - } return ret; } @@ -1026,9 +1005,6 @@ int sbp_ephemeris_common_content_dep_a_cmp( } ret = sbp_u8_cmp(&a->health_bits, &b->health_bits); - if (ret != 0) { - return ret; - } return ret; } @@ -1341,9 +1317,6 @@ int sbp_msg_ephemeris_gps_dep_e_cmp(const sbp_msg_ephemeris_gps_dep_e_t *a, } ret = sbp_u16_cmp(&a->iodc, &b->iodc); - if (ret != 0) { - return ret; - } return ret; } @@ -1656,9 +1629,6 @@ int sbp_msg_ephemeris_gps_dep_f_cmp(const sbp_msg_ephemeris_gps_dep_f_t *a, } ret = sbp_u16_cmp(&a->iodc, &b->iodc); - if (ret != 0) { - return ret; - } return ret; } @@ -1969,9 +1939,6 @@ int sbp_msg_ephemeris_gps_cmp(const sbp_msg_ephemeris_gps_t *a, } ret = sbp_u16_cmp(&a->iodc, &b->iodc); - if (ret != 0) { - return ret; - } return ret; } @@ -2283,9 +2250,6 @@ int sbp_msg_ephemeris_qzss_cmp(const sbp_msg_ephemeris_qzss_t *a, } ret = sbp_u16_cmp(&a->iodc, &b->iodc); - if (ret != 0) { - return ret; - } return ret; } @@ -2607,9 +2571,6 @@ int sbp_msg_ephemeris_bds_cmp(const sbp_msg_ephemeris_bds_t *a, } ret = sbp_u16_cmp(&a->iodc, &b->iodc); - if (ret != 0) { - return ret; - } return ret; } @@ -2933,9 +2894,6 @@ int sbp_msg_ephemeris_gal_dep_a_cmp(const sbp_msg_ephemeris_gal_dep_a_t *a, } ret = sbp_u16_cmp(&a->iodc, &b->iodc); - if (ret != 0) { - return ret; - } return ret; } @@ -3268,9 +3226,6 @@ int sbp_msg_ephemeris_gal_cmp(const sbp_msg_ephemeris_gal_t *a, } ret = sbp_u8_cmp(&a->source, &b->source); - if (ret != 0) { - return ret; - } return ret; } @@ -3387,25 +3342,31 @@ int sbp_msg_ephemeris_sbas_dep_a_cmp(const sbp_msg_ephemeris_sbas_dep_a_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_DEP_A_POS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_DEP_A_POS_MAX; i++) { ret = sbp_double_cmp(&a->pos[i], &b->pos[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_DEP_A_VEL_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_DEP_A_VEL_MAX; i++) { ret = sbp_double_cmp(&a->vel[i], &b->vel[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_DEP_A_ACC_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_DEP_A_ACC_MAX; i++) { ret = sbp_double_cmp(&a->acc[i], &b->acc[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -3417,9 +3378,6 @@ int sbp_msg_ephemeris_sbas_dep_a_cmp(const sbp_msg_ephemeris_sbas_dep_a_t *a, } ret = sbp_double_cmp(&a->a_gf1, &b->a_gf1); - if (ret != 0) { - return ret; - } return ret; } @@ -3546,28 +3504,31 @@ int sbp_msg_ephemeris_glo_dep_a_cmp(const sbp_msg_ephemeris_glo_dep_a_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_A_POS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_A_POS_MAX; i++) { ret = sbp_double_cmp(&a->pos[i], &b->pos[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_A_VEL_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_A_VEL_MAX; i++) { ret = sbp_double_cmp(&a->vel[i], &b->vel[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_A_ACC_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_A_ACC_MAX; i++) { ret = sbp_double_cmp(&a->acc[i], &b->acc[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -3685,25 +3646,31 @@ int sbp_msg_ephemeris_sbas_dep_b_cmp(const sbp_msg_ephemeris_sbas_dep_b_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_DEP_B_POS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_DEP_B_POS_MAX; i++) { ret = sbp_double_cmp(&a->pos[i], &b->pos[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_DEP_B_VEL_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_DEP_B_VEL_MAX; i++) { ret = sbp_double_cmp(&a->vel[i], &b->vel[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_DEP_B_ACC_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_DEP_B_ACC_MAX; i++) { ret = sbp_double_cmp(&a->acc[i], &b->acc[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -3715,9 +3682,6 @@ int sbp_msg_ephemeris_sbas_dep_b_cmp(const sbp_msg_ephemeris_sbas_dep_b_t *a, } ret = sbp_double_cmp(&a->a_gf1, &b->a_gf1); - if (ret != 0) { - return ret; - } return ret; } @@ -3833,22 +3797,31 @@ int sbp_msg_ephemeris_sbas_cmp(const sbp_msg_ephemeris_sbas_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_POS_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_POS_MAX; i++) { ret = sbp_double_cmp(&a->pos[i], &b->pos[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_VEL_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_VEL_MAX; i++) { ret = sbp_float_cmp(&a->vel[i], &b->vel[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_SBAS_ACC_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_SBAS_ACC_MAX; i++) { ret = sbp_float_cmp(&a->acc[i], &b->acc[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -3860,9 +3833,6 @@ int sbp_msg_ephemeris_sbas_cmp(const sbp_msg_ephemeris_sbas_t *a, } ret = sbp_float_cmp(&a->a_gf1, &b->a_gf1); - if (ret != 0) { - return ret; - } return ret; } @@ -3989,28 +3959,31 @@ int sbp_msg_ephemeris_glo_dep_b_cmp(const sbp_msg_ephemeris_glo_dep_b_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_B_POS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_B_POS_MAX; i++) { ret = sbp_double_cmp(&a->pos[i], &b->pos[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_B_VEL_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_B_VEL_MAX; i++) { ret = sbp_double_cmp(&a->vel[i], &b->vel[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_B_ACC_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_B_ACC_MAX; i++) { ret = sbp_double_cmp(&a->acc[i], &b->acc[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -4155,34 +4128,37 @@ int sbp_msg_ephemeris_glo_dep_c_cmp(const sbp_msg_ephemeris_glo_dep_c_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_C_POS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_C_POS_MAX; i++) { ret = sbp_double_cmp(&a->pos[i], &b->pos[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_C_VEL_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_C_VEL_MAX; i++) { ret = sbp_double_cmp(&a->vel[i], &b->vel[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_C_ACC_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_C_ACC_MAX; i++) { ret = sbp_double_cmp(&a->acc[i], &b->acc[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u8_cmp(&a->fcn, &b->fcn); - if (ret != 0) { - return ret; - } return ret; } @@ -4332,25 +4308,31 @@ int sbp_msg_ephemeris_glo_dep_d_cmp(const sbp_msg_ephemeris_glo_dep_d_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_D_POS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_D_POS_MAX; i++) { ret = sbp_double_cmp(&a->pos[i], &b->pos[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_D_VEL_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_D_VEL_MAX; i++) { ret = sbp_double_cmp(&a->vel[i], &b->vel[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_DEP_D_ACC_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_DEP_D_ACC_MAX; i++) { ret = sbp_double_cmp(&a->acc[i], &b->acc[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -4362,9 +4344,6 @@ int sbp_msg_ephemeris_glo_dep_d_cmp(const sbp_msg_ephemeris_glo_dep_d_t *a, } ret = sbp_u8_cmp(&a->iod, &b->iod); - if (ret != 0) { - return ret; - } return ret; } @@ -4512,22 +4491,31 @@ int sbp_msg_ephemeris_glo_cmp(const sbp_msg_ephemeris_glo_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_POS_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_POS_MAX; i++) { ret = sbp_double_cmp(&a->pos[i], &b->pos[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_VEL_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_VEL_MAX; i++) { ret = sbp_double_cmp(&a->vel[i], &b->vel[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_EPHEMERIS_GLO_ACC_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_EPHEMERIS_GLO_ACC_MAX; i++) { ret = sbp_float_cmp(&a->acc[i], &b->acc[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -4539,9 +4527,6 @@ int sbp_msg_ephemeris_glo_cmp(const sbp_msg_ephemeris_glo_t *a, } ret = sbp_u8_cmp(&a->iod, &b->iod); - if (ret != 0) { - return ret; - } return ret; } @@ -4919,9 +4904,6 @@ int sbp_msg_ephemeris_dep_d_cmp(const sbp_msg_ephemeris_dep_d_t *a, } ret = sbp_u32_cmp(&a->reserved, &b->reserved); - if (ret != 0) { - return ret; - } return ret; } @@ -5266,9 +5248,6 @@ int sbp_msg_ephemeris_dep_a_cmp(const sbp_msg_ephemeris_dep_a_t *a, } ret = sbp_u8_cmp(&a->prn, &b->prn); - if (ret != 0) { - return ret; - } return ret; } @@ -5624,9 +5603,6 @@ int sbp_msg_ephemeris_dep_b_cmp(const sbp_msg_ephemeris_dep_b_t *a, } ret = sbp_u8_cmp(&a->iode, &b->iode); - if (ret != 0) { - return ret; - } return ret; } @@ -6004,9 +5980,6 @@ int sbp_msg_ephemeris_dep_c_cmp(const sbp_msg_ephemeris_dep_c_t *a, } ret = sbp_u32_cmp(&a->reserved, &b->reserved); - if (ret != 0) { - return ret; - } return ret; } @@ -6074,9 +6047,6 @@ int sbp_observation_header_dep_cmp(const sbp_observation_header_dep_t *a, } ret = sbp_u8_cmp(&a->n_obs, &b->n_obs); - if (ret != 0) { - return ret; - } return ret; } @@ -6143,9 +6113,6 @@ int sbp_carrier_phase_dep_a_cmp(const sbp_carrier_phase_dep_a_t *a, } ret = sbp_u8_cmp(&a->f, &b->f); - if (ret != 0) { - return ret; - } return ret; } @@ -6246,9 +6213,6 @@ int sbp_packed_obs_content_dep_a_cmp(const sbp_packed_obs_content_dep_a_t *a, } ret = sbp_u8_cmp(&a->prn, &b->prn); - if (ret != 0) { - return ret; - } return ret; } @@ -6349,9 +6313,6 @@ int sbp_packed_obs_content_dep_b_cmp(const sbp_packed_obs_content_dep_b_t *a, } ret = sbp_gnss_signal_dep_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -6452,9 +6413,6 @@ int sbp_packed_obs_content_dep_c_cmp(const sbp_packed_obs_content_dep_c_t *a, } ret = sbp_gnss_signal_dep_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -6544,12 +6502,15 @@ int sbp_msg_obs_dep_a_cmp(const sbp_msg_obs_dep_a_t *a, } ret = sbp_u8_cmp(&a->n_obs, &b->n_obs); - for (uint8_t i = 0; ret == 0 && i < a->n_obs; i++) { - ret = sbp_packed_obs_content_dep_a_cmp(&a->obs[i], &b->obs[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_obs; i++) { + ret = sbp_packed_obs_content_dep_a_cmp(&a->obs[i], &b->obs[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -6639,12 +6600,15 @@ int sbp_msg_obs_dep_b_cmp(const sbp_msg_obs_dep_b_t *a, } ret = sbp_u8_cmp(&a->n_obs, &b->n_obs); - for (uint8_t i = 0; ret == 0 && i < a->n_obs; i++) { - ret = sbp_packed_obs_content_dep_b_cmp(&a->obs[i], &b->obs[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_obs; i++) { + ret = sbp_packed_obs_content_dep_b_cmp(&a->obs[i], &b->obs[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -6734,12 +6698,15 @@ int sbp_msg_obs_dep_c_cmp(const sbp_msg_obs_dep_c_t *a, } ret = sbp_u8_cmp(&a->n_obs, &b->n_obs); - for (uint8_t i = 0; ret == 0 && i < a->n_obs; i++) { - ret = sbp_packed_obs_content_dep_c_cmp(&a->obs[i], &b->obs[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_obs; i++) { + ret = sbp_packed_obs_content_dep_c_cmp(&a->obs[i], &b->obs[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -6892,9 +6859,6 @@ int sbp_msg_iono_cmp(const sbp_msg_iono_t *a, const sbp_msg_iono_t *b) { } ret = sbp_double_cmp(&a->b3, &b->b3); - if (ret != 0) { - return ret; - } return ret; } @@ -6977,9 +6941,6 @@ int sbp_msg_sv_configuration_gps_dep_cmp( } ret = sbp_u32_cmp(&a->l2c_mask, &b->l2c_mask); - if (ret != 0) { - return ret; - } return ret; } @@ -7187,9 +7148,6 @@ int sbp_gnss_capb_cmp(const sbp_gnss_capb_t *a, const sbp_gnss_capb_t *b) { } ret = sbp_u64_cmp(&a->gal_e5, &b->gal_e5); - if (ret != 0) { - return ret; - } return ret; } @@ -7269,9 +7227,6 @@ int sbp_msg_gnss_capb_cmp(const sbp_msg_gnss_capb_t *a, } ret = sbp_gnss_capb_cmp(&a->gc, &b->gc); - if (ret != 0) { - return ret; - } return ret; } @@ -7397,9 +7352,6 @@ int sbp_msg_group_delay_dep_a_cmp(const sbp_msg_group_delay_dep_a_t *a, } ret = sbp_s16_cmp(&a->isc_l2c, &b->isc_l2c); - if (ret != 0) { - return ret; - } return ret; } @@ -7525,9 +7477,6 @@ int sbp_msg_group_delay_dep_b_cmp(const sbp_msg_group_delay_dep_b_t *a, } ret = sbp_s16_cmp(&a->isc_l2c, &b->isc_l2c); - if (ret != 0) { - return ret; - } return ret; } @@ -7651,9 +7600,6 @@ int sbp_msg_group_delay_cmp(const sbp_msg_group_delay_t *a, } ret = sbp_s16_cmp(&a->isc_l2c, &b->isc_l2c); - if (ret != 0) { - return ret; - } return ret; } @@ -7765,9 +7711,6 @@ int sbp_almanac_common_content_cmp(const sbp_almanac_common_content_t *a, } ret = sbp_u8_cmp(&a->health_bits, &b->health_bits); - if (ret != 0) { - return ret; - } return ret; } @@ -7880,9 +7823,6 @@ int sbp_almanac_common_content_dep_cmp( } ret = sbp_u8_cmp(&a->health_bits, &b->health_bits); - if (ret != 0) { - return ret; - } return ret; } @@ -8051,9 +7991,6 @@ int sbp_msg_almanac_gps_dep_cmp(const sbp_msg_almanac_gps_dep_t *a, } ret = sbp_double_cmp(&a->af1, &b->af1); - if (ret != 0) { - return ret; - } return ret; } @@ -8221,9 +8158,6 @@ int sbp_msg_almanac_gps_cmp(const sbp_msg_almanac_gps_t *a, } ret = sbp_double_cmp(&a->af1, &b->af1); - if (ret != 0) { - return ret; - } return ret; } @@ -8370,9 +8304,6 @@ int sbp_msg_almanac_glo_dep_cmp(const sbp_msg_almanac_glo_dep_t *a, } ret = sbp_double_cmp(&a->omega, &b->omega); - if (ret != 0) { - return ret; - } return ret; } @@ -8518,9 +8449,6 @@ int sbp_msg_almanac_glo_cmp(const sbp_msg_almanac_glo_t *a, } ret = sbp_double_cmp(&a->omega, &b->omega); - if (ret != 0) { - return ret; - } return ret; } @@ -8633,9 +8561,6 @@ int sbp_msg_glo_biases_cmp(const sbp_msg_glo_biases_t *a, } ret = sbp_s16_cmp(&a->l2p_bias, &b->l2p_bias); - if (ret != 0) { - return ret; - } return ret; } @@ -8710,9 +8635,6 @@ int sbp_sv_az_el_cmp(const sbp_sv_az_el_t *a, const sbp_sv_az_el_t *b) { } ret = sbp_s8_cmp(&a->el, &b->el); - if (ret != 0) { - return ret; - } return ret; } @@ -8788,12 +8710,15 @@ int sbp_msg_sv_az_el_cmp(const sbp_msg_sv_az_el_t *a, int ret = 0; ret = sbp_u8_cmp(&a->n_azel, &b->n_azel); - for (uint8_t i = 0; ret == 0 && i < a->n_azel; i++) { - ret = sbp_sv_az_el_cmp(&a->azel[i], &b->azel[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_azel; i++) { + ret = sbp_sv_az_el_cmp(&a->azel[i], &b->azel[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -8879,11 +8804,14 @@ int sbp_msg_osr_cmp(const sbp_msg_osr_t *a, const sbp_msg_osr_t *b) { } ret = sbp_u8_cmp(&a->n_obs, &b->n_obs); - for (uint8_t i = 0; ret == 0 && i < a->n_obs; i++) { - ret = sbp_packed_osr_content_cmp(&a->obs[i], &b->obs[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_obs; i++) { + ret = sbp_packed_osr_content_cmp(&a->obs[i], &b->obs[i]); + if (ret != 0) { + return ret; + } + } return ret; } diff --git a/c/src/orientation.c b/c/src/orientation.c index d43b8e0f0e..93054c53a0 100644 --- a/c/src/orientation.c +++ b/c/src/orientation.c @@ -117,9 +117,6 @@ int sbp_msg_baseline_heading_cmp(const sbp_msg_baseline_heading_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -287,9 +284,6 @@ int sbp_msg_orient_quat_cmp(const sbp_msg_orient_quat_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -435,9 +429,6 @@ int sbp_msg_orient_euler_cmp(const sbp_msg_orient_euler_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -550,8 +541,5 @@ int sbp_msg_angular_rate_cmp(const sbp_msg_angular_rate_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/piksi.c b/c/src/piksi.c index 586442e36a..325f32a003 100644 --- a/c/src/piksi.c +++ b/c/src/piksi.c @@ -207,9 +207,6 @@ int sbp_msg_reset_cmp(const sbp_msg_reset_t *a, const sbp_msg_reset_t *b) { int ret = 0; ret = sbp_u32_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -474,9 +471,6 @@ int sbp_msg_reset_filters_cmp(const sbp_msg_reset_filters_t *a, int ret = 0; ret = sbp_u8_cmp(&a->filter, &b->filter); - if (ret != 0) { - return ret; - } return ret; } @@ -626,8 +620,11 @@ int sbp_msg_thread_state_cmp(const sbp_msg_thread_state_t *a, const sbp_msg_thread_state_t *b) { int ret = 0; - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_THREAD_STATE_NAME_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_THREAD_STATE_NAME_MAX; i++) { ret = sbp_char_cmp(&a->name[i], &b->name[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -639,9 +636,6 @@ int sbp_msg_thread_state_cmp(const sbp_msg_thread_state_t *a, } ret = sbp_u32_cmp(&a->stack_free, &b->stack_free); - if (ret != 0) { - return ret; - } return ret; } @@ -751,9 +745,6 @@ int sbp_uart_channel_cmp(const sbp_uart_channel_t *a, } ret = sbp_u8_cmp(&a->rx_buffer_level, &b->rx_buffer_level); - if (ret != 0) { - return ret; - } return ret; } @@ -839,9 +830,6 @@ int sbp_period_cmp(const sbp_period_t *a, const sbp_period_t *b) { } ret = sbp_s32_cmp(&a->current, &b->current); - if (ret != 0) { - return ret; - } return ret; } @@ -927,9 +915,6 @@ int sbp_latency_cmp(const sbp_latency_t *a, const sbp_latency_t *b) { } ret = sbp_s32_cmp(&a->current, &b->current); - if (ret != 0) { - return ret; - } return ret; } @@ -1042,9 +1027,6 @@ int sbp_msg_uart_state_cmp(const sbp_msg_uart_state_t *a, } ret = sbp_period_cmp(&a->obs_period, &b->obs_period); - if (ret != 0) { - return ret; - } return ret; } @@ -1147,9 +1129,6 @@ int sbp_msg_uart_state_depa_cmp(const sbp_msg_uart_state_depa_t *a, } ret = sbp_latency_cmp(&a->latency, &b->latency); - if (ret != 0) { - return ret; - } return ret; } @@ -1218,9 +1197,6 @@ int sbp_msg_iar_state_cmp(const sbp_msg_iar_state_t *a, int ret = 0; ret = sbp_u32_cmp(&a->num_hyps, &b->num_hyps); - if (ret != 0) { - return ret; - } return ret; } @@ -1301,9 +1277,6 @@ int sbp_msg_mask_satellite_cmp(const sbp_msg_mask_satellite_t *a, } ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -1385,9 +1358,6 @@ int sbp_msg_mask_satellite_dep_cmp(const sbp_msg_mask_satellite_dep_t *a, } ret = sbp_gnss_signal_dep_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -1501,9 +1471,6 @@ int sbp_msg_device_monitor_cmp(const sbp_msg_device_monitor_t *a, } ret = sbp_s16_cmp(&a->fe_temperature, &b->fe_temperature); - if (ret != 0) { - return ret; - } return ret; } @@ -1680,9 +1647,6 @@ int sbp_msg_command_req_cmp(const sbp_msg_command_req_t *a, } ret = sbp_msg_command_req_command_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1762,9 +1726,6 @@ int sbp_msg_command_resp_cmp(const sbp_msg_command_resp_t *a, } ret = sbp_s32_cmp(&a->code, &b->code); - if (ret != 0) { - return ret; - } return ret; } @@ -1943,9 +1904,6 @@ int sbp_msg_command_output_cmp(const sbp_msg_command_output_t *a, } ret = sbp_msg_command_output_line_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -2137,9 +2095,11 @@ int sbp_msg_network_state_resp_cmp(const sbp_msg_network_state_resp_t *a, const sbp_msg_network_state_resp_t *b) { int ret = 0; - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_NETWORK_STATE_RESP_IPV4_ADDRESS_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_NETWORK_STATE_RESP_IPV4_ADDRESS_MAX; i++) { ret = sbp_u8_cmp(&a->ipv4_address[i], &b->ipv4_address[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -2150,9 +2110,11 @@ int sbp_msg_network_state_resp_cmp(const sbp_msg_network_state_resp_t *a, return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_NETWORK_STATE_RESP_IPV6_ADDRESS_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_NETWORK_STATE_RESP_IPV6_ADDRESS_MAX; i++) { ret = sbp_u8_cmp(&a->ipv6_address[i], &b->ipv6_address[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -2173,18 +2135,17 @@ int sbp_msg_network_state_resp_cmp(const sbp_msg_network_state_resp_t *a, return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_NETWORK_STATE_RESP_INTERFACE_NAME_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_NETWORK_STATE_RESP_INTERFACE_NAME_MAX; i++) { ret = sbp_char_cmp(&a->interface_name[i], &b->interface_name[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u32_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -2286,12 +2247,11 @@ int sbp_network_usage_cmp(const sbp_network_usage_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_NETWORK_USAGE_INTERFACE_NAME_MAX; - i++) { + for (uint8_t i = 0; i < SBP_NETWORK_USAGE_INTERFACE_NAME_MAX; i++) { ret = sbp_char_cmp(&a->interface_name[i], &b->interface_name[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -2373,12 +2333,15 @@ int sbp_msg_network_bandwidth_usage_cmp( int ret = 0; ret = sbp_u8_cmp(&a->n_interfaces, &b->n_interfaces); - for (uint8_t i = 0; ret == 0 && i < a->n_interfaces; i++) { - ret = sbp_network_usage_cmp(&a->interfaces[i], &b->interfaces[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_interfaces; i++) { + ret = sbp_network_usage_cmp(&a->interfaces[i], &b->interfaces[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -2480,12 +2443,15 @@ int sbp_msg_cell_modem_status_cmp(const sbp_msg_cell_modem_status_t *a, } ret = sbp_u8_cmp(&a->n_reserved, &b->n_reserved); - for (uint8_t i = 0; ret == 0 && i < a->n_reserved; i++) { - ret = sbp_u8_cmp(&a->reserved[i], &b->reserved[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_reserved; i++) { + ret = sbp_u8_cmp(&a->reserved[i], &b->reserved[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -2629,12 +2595,15 @@ int sbp_msg_specan_dep_cmp(const sbp_msg_specan_dep_t *a, } ret = sbp_u8_cmp(&a->n_amplitude_value, &b->n_amplitude_value); - for (uint8_t i = 0; ret == 0 && i < a->n_amplitude_value; i++) { - ret = sbp_u8_cmp(&a->amplitude_value[i], &b->amplitude_value[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_amplitude_value; i++) { + ret = sbp_u8_cmp(&a->amplitude_value[i], &b->amplitude_value[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -2775,12 +2744,15 @@ int sbp_msg_specan_cmp(const sbp_msg_specan_t *a, const sbp_msg_specan_t *b) { } ret = sbp_u8_cmp(&a->n_amplitude_value, &b->n_amplitude_value); - for (uint8_t i = 0; ret == 0 && i < a->n_amplitude_value; i++) { - ret = sbp_u8_cmp(&a->amplitude_value[i], &b->amplitude_value[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_amplitude_value; i++) { + ret = sbp_u8_cmp(&a->amplitude_value[i], &b->amplitude_value[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -2863,18 +2835,21 @@ int sbp_msg_front_end_gain_cmp(const sbp_msg_front_end_gain_t *a, const sbp_msg_front_end_gain_t *b) { int ret = 0; - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_FRONT_END_GAIN_RF_GAIN_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_FRONT_END_GAIN_RF_GAIN_MAX; i++) { ret = sbp_s8_cmp(&a->rf_gain[i], &b->rf_gain[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_FRONT_END_GAIN_IF_GAIN_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_FRONT_END_GAIN_IF_GAIN_MAX; i++) { ret = sbp_s8_cmp(&a->if_gain[i], &b->if_gain[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } diff --git a/c/src/sbas.c b/c/src/sbas.c index fe6b5ebea9..f74aa18f18 100644 --- a/c/src/sbas.c +++ b/c/src/sbas.c @@ -116,11 +116,11 @@ int sbp_msg_sbas_raw_cmp(const sbp_msg_sbas_raw_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_SBAS_RAW_DATA_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_SBAS_RAW_DATA_MAX; i++) { ret = sbp_u8_cmp(&a->data[i], &b->data[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } diff --git a/c/src/settings.c b/c/src/settings.c index 1920a4232c..a594f72e92 100644 --- a/c/src/settings.c +++ b/c/src/settings.c @@ -239,9 +239,6 @@ int sbp_msg_settings_write_cmp(const sbp_msg_settings_write_t *a, int ret = 0; ret = sbp_msg_settings_write_setting_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -416,9 +413,6 @@ int sbp_msg_settings_write_resp_cmp(const sbp_msg_settings_write_resp_t *a, } ret = sbp_msg_settings_write_resp_setting_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -581,9 +575,6 @@ int sbp_msg_settings_read_req_cmp(const sbp_msg_settings_read_req_t *a, int ret = 0; ret = sbp_msg_settings_read_req_setting_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -747,9 +738,6 @@ int sbp_msg_settings_read_resp_cmp(const sbp_msg_settings_read_resp_t *a, int ret = 0; ret = sbp_msg_settings_read_resp_setting_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -821,9 +809,6 @@ int sbp_msg_settings_read_by_index_req_cmp( int ret = 0; ret = sbp_u16_cmp(&a->index, &b->index); - if (ret != 0) { - return ret; - } return ret; } @@ -1002,9 +987,6 @@ int sbp_msg_settings_read_by_index_resp_cmp( } ret = sbp_msg_settings_read_by_index_resp_setting_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1236,9 +1218,6 @@ int sbp_msg_settings_register_cmp(const sbp_msg_settings_register_t *a, int ret = 0; ret = sbp_msg_settings_register_setting_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1414,8 +1393,5 @@ int sbp_msg_settings_register_resp_cmp( } ret = sbp_msg_settings_register_resp_setting_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/signing.c b/c/src/signing.c index ede796c855..d9f5720a96 100644 --- a/c/src/signing.c +++ b/c/src/signing.c @@ -132,9 +132,6 @@ int sbp_utc_time_cmp(const sbp_utc_time_t *a, const sbp_utc_time_t *b) { } ret = sbp_u32_cmp(&a->ns, &b->ns); - if (ret != 0) { - return ret; - } return ret; } @@ -203,11 +200,11 @@ int sbp_ecdsa_signature_cmp(const sbp_ecdsa_signature_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_ECDSA_SIGNATURE_DATA_MAX; i++) { + for (uint8_t i = 0; i < SBP_ECDSA_SIGNATURE_DATA_MAX; i++) { ret = sbp_u8_cmp(&a->data[i], &b->data[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -314,9 +311,11 @@ int sbp_msg_ecdsa_certificate_cmp(const sbp_msg_ecdsa_certificate_t *a, return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ECDSA_CERTIFICATE_CERTIFICATE_ID_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ECDSA_CERTIFICATE_CERTIFICATE_ID_MAX; i++) { ret = sbp_u8_cmp(&a->certificate_id[i], &b->certificate_id[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -328,12 +327,15 @@ int sbp_msg_ecdsa_certificate_cmp(const sbp_msg_ecdsa_certificate_t *a, } ret = sbp_u8_cmp(&a->n_certificate_bytes, &b->n_certificate_bytes); - for (uint8_t i = 0; ret == 0 && i < a->n_certificate_bytes; i++) { - ret = sbp_u8_cmp(&a->certificate_bytes[i], &b->certificate_bytes[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_certificate_bytes; i++) { + ret = sbp_u8_cmp(&a->certificate_bytes[i], &b->certificate_bytes[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -443,29 +445,35 @@ int sbp_msg_certificate_chain_cmp(const sbp_msg_certificate_chain_t *a, const sbp_msg_certificate_chain_t *b) { int ret = 0; - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_CERTIFICATE_CHAIN_ROOT_CERTIFICATE_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_CERTIFICATE_CHAIN_ROOT_CERTIFICATE_MAX; i++) { ret = sbp_u8_cmp(&a->root_certificate[i], &b->root_certificate[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_CERTIFICATE_CHAIN_INTERMEDIATE_CERTIFICATE_MAX; - i++) { + i < SBP_MSG_CERTIFICATE_CHAIN_INTERMEDIATE_CERTIFICATE_MAX; i++) { ret = sbp_u8_cmp(&a->intermediate_certificate[i], &b->intermediate_certificate[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_CERTIFICATE_CHAIN_CORRECTIONS_CERTIFICATE_MAX; + for (uint8_t i = 0; i < SBP_MSG_CERTIFICATE_CHAIN_CORRECTIONS_CERTIFICATE_MAX; i++) { ret = sbp_u8_cmp(&a->corrections_certificate[i], &b->corrections_certificate[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -477,9 +485,6 @@ int sbp_msg_certificate_chain_cmp(const sbp_msg_certificate_chain_t *a, } ret = sbp_ecdsa_signature_cmp(&a->signature, &b->signature); - if (ret != 0) { - return ret; - } return ret; } @@ -596,32 +601,36 @@ int sbp_msg_certificate_chain_dep_cmp( const sbp_msg_certificate_chain_dep_t *b) { int ret = 0; - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_CERTIFICATE_CHAIN_DEP_ROOT_CERTIFICATE_MAX; + for (uint8_t i = 0; i < SBP_MSG_CERTIFICATE_CHAIN_DEP_ROOT_CERTIFICATE_MAX; i++) { ret = sbp_u8_cmp(&a->root_certificate[i], &b->root_certificate[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } for (uint8_t i = 0; - ret == 0 && - i < SBP_MSG_CERTIFICATE_CHAIN_DEP_INTERMEDIATE_CERTIFICATE_MAX; - i++) { + i < SBP_MSG_CERTIFICATE_CHAIN_DEP_INTERMEDIATE_CERTIFICATE_MAX; i++) { ret = sbp_u8_cmp(&a->intermediate_certificate[i], &b->intermediate_certificate[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } for (uint8_t i = 0; - ret == 0 && - i < SBP_MSG_CERTIFICATE_CHAIN_DEP_CORRECTIONS_CERTIFICATE_MAX; - i++) { + i < SBP_MSG_CERTIFICATE_CHAIN_DEP_CORRECTIONS_CERTIFICATE_MAX; i++) { ret = sbp_u8_cmp(&a->corrections_certificate[i], &b->corrections_certificate[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -632,12 +641,11 @@ int sbp_msg_certificate_chain_dep_cmp( return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_CERTIFICATE_CHAIN_DEP_SIGNATURE_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_CERTIFICATE_CHAIN_DEP_SIGNATURE_MAX; i++) { ret = sbp_u8_cmp(&a->signature[i], &b->signature[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -765,9 +773,11 @@ int sbp_msg_ecdsa_signature_cmp(const sbp_msg_ecdsa_signature_t *a, return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ECDSA_SIGNATURE_CERTIFICATE_ID_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ECDSA_SIGNATURE_CERTIFICATE_ID_MAX; i++) { ret = sbp_u8_cmp(&a->certificate_id[i], &b->certificate_id[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -779,12 +789,15 @@ int sbp_msg_ecdsa_signature_cmp(const sbp_msg_ecdsa_signature_t *a, } ret = sbp_u8_cmp(&a->n_signed_messages, &b->n_signed_messages); - for (uint8_t i = 0; ret == 0 && i < a->n_signed_messages; i++) { - ret = sbp_u8_cmp(&a->signed_messages[i], &b->signed_messages[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_signed_messages; i++) { + ret = sbp_u8_cmp(&a->signed_messages[i], &b->signed_messages[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -925,9 +938,12 @@ int sbp_msg_ecdsa_signature_dep_b_cmp( return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ECDSA_SIGNATURE_DEP_B_CERTIFICATE_ID_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ECDSA_SIGNATURE_DEP_B_CERTIFICATE_ID_MAX; + i++) { ret = sbp_u8_cmp(&a->certificate_id[i], &b->certificate_id[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; @@ -938,21 +954,26 @@ int sbp_msg_ecdsa_signature_dep_b_cmp( return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ECDSA_SIGNATURE_DEP_B_SIGNATURE_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ECDSA_SIGNATURE_DEP_B_SIGNATURE_MAX; i++) { ret = sbp_u8_cmp(&a->signature[i], &b->signature[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u8_cmp(&a->n_signed_messages, &b->n_signed_messages); - for (uint8_t i = 0; ret == 0 && i < a->n_signed_messages; i++) { - ret = sbp_u8_cmp(&a->signed_messages[i], &b->signed_messages[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_signed_messages; i++) { + ret = sbp_u8_cmp(&a->signed_messages[i], &b->signed_messages[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1087,29 +1108,37 @@ int sbp_msg_ecdsa_signature_dep_a_cmp( return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ECDSA_SIGNATURE_DEP_A_CERTIFICATE_ID_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ECDSA_SIGNATURE_DEP_A_CERTIFICATE_ID_MAX; + i++) { ret = sbp_u8_cmp(&a->certificate_id[i], &b->certificate_id[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ECDSA_SIGNATURE_DEP_A_SIGNATURE_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ECDSA_SIGNATURE_DEP_A_SIGNATURE_MAX; i++) { ret = sbp_u8_cmp(&a->signature[i], &b->signature[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u8_cmp(&a->n_signed_messages, &b->n_signed_messages); - for (uint8_t i = 0; ret == 0 && i < a->n_signed_messages; i++) { - ret = sbp_u8_cmp(&a->signed_messages[i], &b->signed_messages[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_signed_messages; i++) { + ret = sbp_u8_cmp(&a->signed_messages[i], &b->signed_messages[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1211,21 +1240,27 @@ int sbp_msg_ed25519_certificate_dep_cmp( return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ED25519_CERTIFICATE_DEP_FINGERPRINT_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ED25519_CERTIFICATE_DEP_FINGERPRINT_MAX; + i++) { ret = sbp_u8_cmp(&a->fingerprint[i], &b->fingerprint[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u8_cmp(&a->n_certificate_bytes, &b->n_certificate_bytes); - for (uint8_t i = 0; ret == 0 && i < a->n_certificate_bytes; i++) { - ret = sbp_u8_cmp(&a->certificate_bytes[i], &b->certificate_bytes[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_certificate_bytes; i++) { + ret = sbp_u8_cmp(&a->certificate_bytes[i], &b->certificate_bytes[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1326,29 +1361,37 @@ int sbp_msg_ed25519_signature_dep_a_cmp( const sbp_msg_ed25519_signature_dep_a_t *b) { int ret = 0; - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ED25519_SIGNATURE_DEP_A_SIGNATURE_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ED25519_SIGNATURE_DEP_A_SIGNATURE_MAX; i++) { ret = sbp_u8_cmp(&a->signature[i], &b->signature[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ED25519_SIGNATURE_DEP_A_FINGERPRINT_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ED25519_SIGNATURE_DEP_A_FINGERPRINT_MAX; + i++) { ret = sbp_u8_cmp(&a->fingerprint[i], &b->fingerprint[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u8_cmp(&a->n_signed_messages, &b->n_signed_messages); - for (uint8_t i = 0; ret == 0 && i < a->n_signed_messages; i++) { - ret = sbp_u32_cmp(&a->signed_messages[i], &b->signed_messages[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_signed_messages; i++) { + ret = sbp_u32_cmp(&a->signed_messages[i], &b->signed_messages[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1471,28 +1514,36 @@ int sbp_msg_ed25519_signature_dep_b_cmp( return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ED25519_SIGNATURE_DEP_B_SIGNATURE_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ED25519_SIGNATURE_DEP_B_SIGNATURE_MAX; i++) { ret = sbp_u8_cmp(&a->signature[i], &b->signature[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; - ret == 0 && i < SBP_MSG_ED25519_SIGNATURE_DEP_B_FINGERPRINT_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_ED25519_SIGNATURE_DEP_B_FINGERPRINT_MAX; + i++) { ret = sbp_u8_cmp(&a->fingerprint[i], &b->fingerprint[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } ret = sbp_u8_cmp(&a->n_signed_messages, &b->n_signed_messages); - for (uint8_t i = 0; ret == 0 && i < a->n_signed_messages; i++) { - ret = sbp_u32_cmp(&a->signed_messages[i], &b->signed_messages[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_signed_messages; i++) { + ret = sbp_u32_cmp(&a->signed_messages[i], &b->signed_messages[i]); + if (ret != 0) { + return ret; + } + } return ret; } diff --git a/c/src/solution_meta.c b/c/src/solution_meta.c index 8b0d0e9d6a..6465426e3c 100644 --- a/c/src/solution_meta.c +++ b/c/src/solution_meta.c @@ -80,9 +80,6 @@ int sbp_solution_input_type_cmp(const sbp_solution_input_type_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -250,12 +247,15 @@ int sbp_msg_soln_meta_dep_a_cmp(const sbp_msg_soln_meta_dep_a_t *a, } ret = sbp_u8_cmp(&a->n_sol_in, &b->n_sol_in); - for (uint8_t i = 0; ret == 0 && i < a->n_sol_in; i++) { - ret = sbp_solution_input_type_cmp(&a->sol_in[i], &b->sol_in[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_sol_in; i++) { + ret = sbp_solution_input_type_cmp(&a->sol_in[i], &b->sol_in[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -400,12 +400,15 @@ int sbp_msg_soln_meta_cmp(const sbp_msg_soln_meta_t *a, } ret = sbp_u8_cmp(&a->n_sol_in, &b->n_sol_in); - for (uint8_t i = 0; ret == 0 && i < a->n_sol_in; i++) { - ret = sbp_solution_input_type_cmp(&a->sol_in[i], &b->sol_in[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_sol_in; i++) { + ret = sbp_solution_input_type_cmp(&a->sol_in[i], &b->sol_in[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -460,9 +463,6 @@ int sbp_gnss_input_type_cmp(const sbp_gnss_input_type_t *a, int ret = 0; ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -517,9 +517,6 @@ int sbp_imu_input_type_cmp(const sbp_imu_input_type_t *a, int ret = 0; ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -574,8 +571,5 @@ int sbp_odo_input_type_cmp(const sbp_odo_input_type_t *a, int ret = 0; ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/ssr.c b/c/src/ssr.c index 6ebb09fda7..4064f3ae20 100644 --- a/c/src/ssr.c +++ b/c/src/ssr.c @@ -80,9 +80,6 @@ int sbp_code_biases_content_cmp(const sbp_code_biases_content_t *a, } ret = sbp_s16_cmp(&a->value, &b->value); - if (ret != 0) { - return ret; - } return ret; } @@ -184,9 +181,6 @@ int sbp_phase_biases_content_cmp(const sbp_phase_biases_content_t *a, } ret = sbp_s32_cmp(&a->bias, &b->bias); - if (ret != 0) { - return ret; - } return ret; } @@ -307,9 +301,6 @@ int sbp_stec_header_cmp(const sbp_stec_header_t *a, } ret = sbp_u8_cmp(&a->iod_atmo, &b->iod_atmo); - if (ret != 0) { - return ret; - } return ret; } @@ -444,9 +435,6 @@ int sbp_gridded_correction_header_cmp( } ret = sbp_u8_cmp(&a->tropo_quality_indicator, &b->tropo_quality_indicator); - if (ret != 0) { - return ret; - } return ret; } @@ -526,12 +514,11 @@ int sbp_stec_sat_element_cmp(const sbp_stec_sat_element_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_STEC_SAT_ELEMENT_STEC_COEFF_MAX; - i++) { + for (uint8_t i = 0; i < SBP_STEC_SAT_ELEMENT_STEC_COEFF_MAX; i++) { ret = sbp_s16_cmp(&a->stec_coeff[i], &b->stec_coeff[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -602,9 +589,6 @@ int sbp_tropospheric_delay_correction_no_std_cmp( } ret = sbp_s8_cmp(&a->wet, &b->wet); - if (ret != 0) { - return ret; - } return ret; } @@ -684,9 +668,6 @@ int sbp_tropospheric_delay_correction_cmp( } ret = sbp_u8_cmp(&a->stddev, &b->stddev); - if (ret != 0) { - return ret; - } return ret; } @@ -754,9 +735,6 @@ int sbp_stec_residual_no_std_cmp(const sbp_stec_residual_no_std_t *a, } ret = sbp_s16_cmp(&a->residual, &b->residual); - if (ret != 0) { - return ret; - } return ret; } @@ -833,9 +811,6 @@ int sbp_stec_residual_cmp(const sbp_stec_residual_t *a, } ret = sbp_u8_cmp(&a->stddev, &b->stddev); - if (ret != 0) { - return ret; - } return ret; } @@ -1048,9 +1023,6 @@ int sbp_msg_ssr_orbit_clock_cmp(const sbp_msg_ssr_orbit_clock_t *a, } ret = sbp_s32_cmp(&a->c2, &b->c2); - if (ret != 0) { - return ret; - } return ret; } @@ -1174,12 +1146,15 @@ int sbp_msg_ssr_code_biases_cmp(const sbp_msg_ssr_code_biases_t *a, } ret = sbp_u8_cmp(&a->n_biases, &b->n_biases); - for (uint8_t i = 0; ret == 0 && i < a->n_biases; i++) { - ret = sbp_code_biases_content_cmp(&a->biases[i], &b->biases[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_biases; i++) { + ret = sbp_code_biases_content_cmp(&a->biases[i], &b->biases[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1348,12 +1323,15 @@ int sbp_msg_ssr_phase_biases_cmp(const sbp_msg_ssr_phase_biases_t *a, } ret = sbp_u8_cmp(&a->n_biases, &b->n_biases); - for (uint8_t i = 0; ret == 0 && i < a->n_biases; i++) { - ret = sbp_phase_biases_content_cmp(&a->biases[i], &b->biases[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_biases; i++) { + ret = sbp_phase_biases_content_cmp(&a->biases[i], &b->biases[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1445,12 +1423,15 @@ int sbp_msg_ssr_stec_correction_dep_cmp( } ret = sbp_u8_cmp(&a->n_stec_sat_list, &b->n_stec_sat_list); - for (uint8_t i = 0; ret == 0 && i < a->n_stec_sat_list; i++) { - ret = sbp_stec_sat_element_cmp(&a->stec_sat_list[i], &b->stec_sat_list[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_stec_sat_list; i++) { + ret = sbp_stec_sat_element_cmp(&a->stec_sat_list[i], &b->stec_sat_list[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1549,9 +1530,6 @@ int sbp_bounds_header_cmp(const sbp_bounds_header_t *a, } ret = sbp_u8_cmp(&a->sol_id, &b->sol_id); - if (ret != 0) { - return ret; - } return ret; } @@ -1686,12 +1664,15 @@ int sbp_msg_ssr_stec_correction_cmp(const sbp_msg_ssr_stec_correction_t *a, } ret = sbp_u8_cmp(&a->n_sats, &b->n_sats); - for (uint8_t i = 0; ret == 0 && i < a->n_sats; i++) { - ret = sbp_stec_sat_element_cmp(&a->stec_sat_list[i], &b->stec_sat_list[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_sats; i++) { + ret = sbp_stec_sat_element_cmp(&a->stec_sat_list[i], &b->stec_sat_list[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1808,12 +1789,15 @@ int sbp_msg_ssr_gridded_correction_cmp( } ret = sbp_u8_cmp(&a->n_stec_residuals, &b->n_stec_residuals); - for (uint8_t i = 0; ret == 0 && i < a->n_stec_residuals; i++) { - ret = sbp_stec_residual_cmp(&a->stec_residuals[i], &b->stec_residuals[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_stec_residuals; i++) { + ret = sbp_stec_residual_cmp(&a->stec_residuals[i], &b->stec_residuals[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1915,9 +1899,6 @@ int sbp_stec_sat_element_integrity_cmp( } ret = sbp_u8_cmp(&a->stec_bound_sig_dot, &b->stec_bound_sig_dot); - if (ret != 0) { - return ret; - } return ret; } @@ -2136,13 +2117,16 @@ int sbp_msg_ssr_gridded_correction_bounds_cmp( } ret = sbp_u8_cmp(&a->n_sats, &b->n_sats); - for (uint8_t i = 0; ret == 0 && i < a->n_sats; i++) { - ret = sbp_stec_sat_element_integrity_cmp(&a->stec_sat_list[i], - &b->stec_sat_list[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_sats; i++) { + ret = sbp_stec_sat_element_integrity_cmp(&a->stec_sat_list[i], + &b->stec_sat_list[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -2302,9 +2286,6 @@ int sbp_msg_ssr_tile_definition_dep_a_cmp( } ret = sbp_u64_cmp(&a->bitmask, &b->bitmask); - if (ret != 0) { - return ret; - } return ret; } @@ -2475,9 +2456,6 @@ int sbp_msg_ssr_tile_definition_dep_b_cmp( } ret = sbp_u64_cmp(&a->bitmask, &b->bitmask); - if (ret != 0) { - return ret; - } return ret; } @@ -2680,9 +2658,6 @@ int sbp_msg_ssr_tile_definition_cmp(const sbp_msg_ssr_tile_definition_t *a, } ret = sbp_u64_cmp(&a->bitmask, &b->bitmask); - if (ret != 0) { - return ret; - } return ret; } @@ -2783,18 +2758,21 @@ int sbp_satellite_apc_cmp(const sbp_satellite_apc_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_SATELLITE_APC_PCO_MAX; i++) { + for (uint8_t i = 0; i < SBP_SATELLITE_APC_PCO_MAX; i++) { ret = sbp_s16_cmp(&a->pco[i], &b->pco[i]); + if (ret != 0) { + return ret; + } } if (ret != 0) { return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_SATELLITE_APC_PCV_MAX; i++) { + for (uint8_t i = 0; i < SBP_SATELLITE_APC_PCV_MAX; i++) { ret = sbp_s8_cmp(&a->pcv[i], &b->pcv[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -2876,12 +2854,15 @@ int sbp_msg_ssr_satellite_apc_dep_cmp( int ret = 0; ret = sbp_u8_cmp(&a->n_apc, &b->n_apc); - for (uint8_t i = 0; ret == 0 && i < a->n_apc; i++) { - ret = sbp_satellite_apc_cmp(&a->apc[i], &b->apc[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_apc; i++) { + ret = sbp_satellite_apc_cmp(&a->apc[i], &b->apc[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -3005,12 +2986,15 @@ int sbp_msg_ssr_satellite_apc_cmp(const sbp_msg_ssr_satellite_apc_t *a, } ret = sbp_u8_cmp(&a->n_apc, &b->n_apc); - for (uint8_t i = 0; ret == 0 && i < a->n_apc; i++) { - ret = sbp_satellite_apc_cmp(&a->apc[i], &b->apc[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_apc; i++) { + ret = sbp_satellite_apc_cmp(&a->apc[i], &b->apc[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -3225,9 +3209,6 @@ int sbp_msg_ssr_orbit_clock_dep_a_cmp( } ret = sbp_s32_cmp(&a->c2, &b->c2); - if (ret != 0) { - return ret; - } return ret; } @@ -3326,9 +3307,6 @@ int sbp_stec_header_dep_a_cmp(const sbp_stec_header_dep_a_t *a, } ret = sbp_u8_cmp(&a->iod_atmo, &b->iod_atmo); - if (ret != 0) { - return ret; - } return ret; } @@ -3441,9 +3419,6 @@ int sbp_gridded_correction_header_dep_a_cmp( } ret = sbp_u8_cmp(&a->tropo_quality_indicator, &b->tropo_quality_indicator); - if (ret != 0) { - return ret; - } return ret; } @@ -3556,9 +3531,6 @@ int sbp_grid_definition_header_dep_a_cmp( } ret = sbp_u8_cmp(&a->seq_num, &b->seq_num); - if (ret != 0) { - return ret; - } return ret; } @@ -3650,12 +3622,15 @@ int sbp_msg_ssr_stec_correction_dep_a_cmp( } ret = sbp_u8_cmp(&a->n_stec_sat_list, &b->n_stec_sat_list); - for (uint8_t i = 0; ret == 0 && i < a->n_stec_sat_list; i++) { - ret = sbp_stec_sat_element_cmp(&a->stec_sat_list[i], &b->stec_sat_list[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_stec_sat_list; i++) { + ret = sbp_stec_sat_element_cmp(&a->stec_sat_list[i], &b->stec_sat_list[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -3778,13 +3753,16 @@ int sbp_msg_ssr_gridded_correction_no_std_dep_a_cmp( } ret = sbp_u8_cmp(&a->n_stec_residuals, &b->n_stec_residuals); - for (uint8_t i = 0; ret == 0 && i < a->n_stec_residuals; i++) { - ret = sbp_stec_residual_no_std_cmp(&a->stec_residuals[i], - &b->stec_residuals[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_stec_residuals; i++) { + ret = sbp_stec_residual_no_std_cmp(&a->stec_residuals[i], + &b->stec_residuals[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -3901,12 +3879,15 @@ int sbp_msg_ssr_gridded_correction_dep_a_cmp( } ret = sbp_u8_cmp(&a->n_stec_residuals, &b->n_stec_residuals); - for (uint8_t i = 0; ret == 0 && i < a->n_stec_residuals; i++) { - ret = sbp_stec_residual_cmp(&a->stec_residuals[i], &b->stec_residuals[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_stec_residuals; i++) { + ret = sbp_stec_residual_cmp(&a->stec_residuals[i], &b->stec_residuals[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -3998,12 +3979,15 @@ int sbp_msg_ssr_grid_definition_dep_a_cmp( } ret = sbp_u8_cmp(&a->n_rle_list, &b->n_rle_list); - for (uint8_t i = 0; ret == 0 && i < a->n_rle_list; i++) { - ret = sbp_u8_cmp(&a->rle_list[i], &b->rle_list[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_rle_list; i++) { + ret = sbp_u8_cmp(&a->rle_list[i], &b->rle_list[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -4146,9 +4130,6 @@ int sbp_orbit_clock_bound_cmp(const sbp_orbit_clock_bound_t *a, } ret = sbp_u8_cmp(&a->clock_bound_sig, &b->clock_bound_sig); - if (ret != 0) { - return ret; - } return ret; } @@ -4275,13 +4256,16 @@ int sbp_msg_ssr_orbit_clock_bounds_cmp( } ret = sbp_u8_cmp(&a->n_sats, &b->n_sats); - for (uint8_t i = 0; ret == 0 && i < a->n_sats; i++) { - ret = sbp_orbit_clock_bound_cmp(&a->orbit_clock_bounds[i], - &b->orbit_clock_bounds[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_sats; i++) { + ret = sbp_orbit_clock_bound_cmp(&a->orbit_clock_bounds[i], + &b->orbit_clock_bounds[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -4394,9 +4378,6 @@ int sbp_code_phase_biases_sat_sig_cmp( } ret = sbp_u8_cmp(&a->phase_bias_bound_sig, &b->phase_bias_bound_sig); - if (ret != 0) { - return ret; - } return ret; } @@ -4524,13 +4505,16 @@ int sbp_msg_ssr_code_phase_biases_bounds_cmp( } ret = sbp_u8_cmp(&a->n_sats_signals, &b->n_sats_signals); - for (uint8_t i = 0; ret == 0 && i < a->n_sats_signals; i++) { - ret = sbp_code_phase_biases_sat_sig_cmp(&a->satellites_signals[i], - &b->satellites_signals[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_sats_signals; i++) { + ret = sbp_code_phase_biases_sat_sig_cmp(&a->satellites_signals[i], + &b->satellites_signals[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -4665,9 +4649,6 @@ int sbp_orbit_clock_bound_degradation_cmp( } ret = sbp_u8_cmp(&a->clock_bound_sig_dot, &b->clock_bound_sig_dot); - if (ret != 0) { - return ret; - } return ret; } @@ -4789,8 +4770,5 @@ int sbp_msg_ssr_orbit_clock_bounds_degradation_cmp( ret = sbp_orbit_clock_bound_degradation_cmp( &a->orbit_clock_bounds_degradation, &b->orbit_clock_bounds_degradation); - if (ret != 0) { - return ret; - } return ret; } diff --git a/c/src/system.c b/c/src/system.c index 25a9a4064c..4882e05487 100644 --- a/c/src/system.c +++ b/c/src/system.c @@ -102,9 +102,6 @@ int sbp_msg_startup_cmp(const sbp_msg_startup_t *a, } ret = sbp_u16_cmp(&a->reserved, &b->reserved); - if (ret != 0) { - return ret; - } return ret; } @@ -303,9 +300,6 @@ int sbp_msg_dgnss_status_cmp(const sbp_msg_dgnss_status_t *a, } ret = sbp_msg_dgnss_status_source_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -374,9 +368,6 @@ int sbp_msg_heartbeat_cmp(const sbp_msg_heartbeat_t *a, int ret = 0; ret = sbp_u32_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -453,9 +444,6 @@ int sbp_sub_system_report_cmp(const sbp_sub_system_report_t *a, } ret = sbp_u8_cmp(&a->specific, &b->specific); - if (ret != 0) { - return ret; - } return ret; } @@ -577,12 +565,15 @@ int sbp_msg_status_report_cmp(const sbp_msg_status_report_t *a, } ret = sbp_u8_cmp(&a->n_status, &b->n_status); - for (uint8_t i = 0; ret == 0 && i < a->n_status; i++) { - ret = sbp_sub_system_report_cmp(&a->status[i], &b->status[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_status; i++) { + ret = sbp_sub_system_report_cmp(&a->status[i], &b->status[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -649,9 +640,6 @@ int sbp_status_journal_item_cmp(const sbp_status_journal_item_t *a, } ret = sbp_sub_system_report_cmp(&a->report, &b->report); - if (ret != 0) { - return ret; - } return ret; } @@ -775,12 +763,15 @@ int sbp_msg_status_journal_cmp(const sbp_msg_status_journal_t *a, } ret = sbp_u8_cmp(&a->n_journal, &b->n_journal); - for (uint8_t i = 0; ret == 0 && i < a->n_journal; i++) { - ret = sbp_status_journal_item_cmp(&a->journal[i], &b->journal[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_journal; i++) { + ret = sbp_status_journal_item_cmp(&a->journal[i], &b->journal[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -849,9 +840,6 @@ int sbp_msg_ins_status_cmp(const sbp_msg_ins_status_t *a, int ret = 0; ret = sbp_u32_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1034,9 +1022,6 @@ int sbp_msg_csac_telemetry_cmp(const sbp_msg_csac_telemetry_t *a, } ret = sbp_msg_csac_telemetry_telemetry_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1232,9 +1217,6 @@ int sbp_msg_csac_telemetry_labels_cmp( } ret = sbp_msg_csac_telemetry_labels_telemetry_labels_strcmp(a, b); - if (ret != 0) { - return ret; - } return ret; } @@ -1369,9 +1351,6 @@ int sbp_msg_ins_updates_cmp(const sbp_msg_ins_updates_t *a, } ret = sbp_u8_cmp(&a->zerovel, &b->zerovel); - if (ret != 0) { - return ret; - } return ret; } @@ -1475,9 +1454,6 @@ int sbp_msg_gnss_time_offset_cmp(const sbp_msg_gnss_time_offset_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1555,9 +1531,6 @@ int sbp_msg_pps_time_cmp(const sbp_msg_pps_time_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1705,9 +1678,6 @@ int sbp_msg_sensor_aid_event_cmp(const sbp_msg_sensor_aid_event_t *a, } ret = sbp_u32_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -1818,11 +1788,14 @@ int sbp_msg_group_meta_cmp(const sbp_msg_group_meta_t *a, } ret = sbp_u8_cmp(&a->n_group_msgs, &b->n_group_msgs); - for (uint8_t i = 0; ret == 0 && i < a->n_group_msgs; i++) { - ret = sbp_u16_cmp(&a->group_msgs[i], &b->group_msgs[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_group_msgs; i++) { + ret = sbp_u16_cmp(&a->group_msgs[i], &b->group_msgs[i]); + if (ret != 0) { + return ret; + } + } return ret; } diff --git a/c/src/telemetry.c b/c/src/telemetry.c index c42c830096..e0a52b0ec0 100644 --- a/c/src/telemetry.c +++ b/c/src/telemetry.c @@ -156,9 +156,6 @@ int sbp_telemetry_sv_cmp(const sbp_telemetry_sv_t *a, } ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); - if (ret != 0) { - return ret; - } return ret; } @@ -277,11 +274,14 @@ int sbp_msg_tel_sv_cmp(const sbp_msg_tel_sv_t *a, const sbp_msg_tel_sv_t *b) { } ret = sbp_u8_cmp(&a->n_sv_tel, &b->n_sv_tel); - for (uint8_t i = 0; ret == 0 && i < a->n_sv_tel; i++) { - ret = sbp_telemetry_sv_cmp(&a->sv_tel[i], &b->sv_tel[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_sv_tel; i++) { + ret = sbp_telemetry_sv_cmp(&a->sv_tel[i], &b->sv_tel[i]); + if (ret != 0) { + return ret; + } + } return ret; } diff --git a/c/src/tracking.c b/c/src/tracking.c index 7667fa1f1e..f76958ad42 100644 --- a/c/src/tracking.c +++ b/c/src/tracking.c @@ -305,9 +305,6 @@ int sbp_msg_tracking_state_detailed_dep_a_cmp( } ret = sbp_u8_cmp(&a->misc_flags, &b->misc_flags); - if (ret != 0) { - return ret; - } return ret; } @@ -599,9 +596,6 @@ int sbp_msg_tracking_state_detailed_dep_cmp( } ret = sbp_u8_cmp(&a->misc_flags, &b->misc_flags); - if (ret != 0) { - return ret; - } return ret; } @@ -680,9 +674,6 @@ int sbp_tracking_channel_state_cmp(const sbp_tracking_channel_state_t *a, } ret = sbp_u8_cmp(&a->cn0, &b->cn0); - if (ret != 0) { - return ret; - } return ret; } @@ -762,12 +753,15 @@ int sbp_msg_tracking_state_cmp(const sbp_msg_tracking_state_t *a, int ret = 0; ret = sbp_u8_cmp(&a->n_states, &b->n_states); - for (uint8_t i = 0; ret == 0 && i < a->n_states; i++) { - ret = sbp_tracking_channel_state_cmp(&a->states[i], &b->states[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_states; i++) { + ret = sbp_tracking_channel_state_cmp(&a->states[i], &b->states[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -833,9 +827,6 @@ int sbp_measurement_state_cmp(const sbp_measurement_state_t *a, } ret = sbp_u8_cmp(&a->cn0, &b->cn0); - if (ret != 0) { - return ret; - } return ret; } @@ -915,12 +906,15 @@ int sbp_msg_measurement_state_cmp(const sbp_msg_measurement_state_t *a, int ret = 0; ret = sbp_u8_cmp(&a->n_states, &b->n_states); - for (uint8_t i = 0; ret == 0 && i < a->n_states; i++) { - ret = sbp_measurement_state_cmp(&a->states[i], &b->states[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_states; i++) { + ret = sbp_measurement_state_cmp(&a->states[i], &b->states[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -989,9 +983,6 @@ int sbp_tracking_channel_correlation_cmp( } ret = sbp_s16_cmp(&a->Q, &b->Q); - if (ret != 0) { - return ret; - } return ret; } @@ -1087,11 +1078,11 @@ int sbp_msg_tracking_iq_cmp(const sbp_msg_tracking_iq_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_TRACKING_IQ_CORRS_MAX; i++) { + for (uint8_t i = 0; i < SBP_MSG_TRACKING_IQ_CORRS_MAX; i++) { ret = sbp_tracking_channel_correlation_cmp(&a->corrs[i], &b->corrs[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -1161,9 +1152,6 @@ int sbp_tracking_channel_correlation_dep_cmp( } ret = sbp_s32_cmp(&a->Q, &b->Q); - if (ret != 0) { - return ret; - } return ret; } @@ -1261,12 +1249,11 @@ int sbp_msg_tracking_iq_dep_b_cmp(const sbp_msg_tracking_iq_dep_b_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_TRACKING_IQ_DEP_B_CORRS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_TRACKING_IQ_DEP_B_CORRS_MAX; i++) { ret = sbp_tracking_channel_correlation_dep_cmp(&a->corrs[i], &b->corrs[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -1365,12 +1352,11 @@ int sbp_msg_tracking_iq_dep_a_cmp(const sbp_msg_tracking_iq_dep_a_t *a, return ret; } - for (uint8_t i = 0; ret == 0 && i < SBP_MSG_TRACKING_IQ_DEP_A_CORRS_MAX; - i++) { + for (uint8_t i = 0; i < SBP_MSG_TRACKING_IQ_DEP_A_CORRS_MAX; i++) { ret = sbp_tracking_channel_correlation_dep_cmp(&a->corrs[i], &b->corrs[i]); - } - if (ret != 0) { - return ret; + if (ret != 0) { + return ret; + } } return ret; } @@ -1451,9 +1437,6 @@ int sbp_tracking_channel_state_dep_a_cmp( } ret = sbp_float_cmp(&a->cn0, &b->cn0); - if (ret != 0) { - return ret; - } return ret; } @@ -1536,12 +1519,15 @@ int sbp_msg_tracking_state_dep_a_cmp(const sbp_msg_tracking_state_dep_a_t *a, int ret = 0; ret = sbp_u8_cmp(&a->n_states, &b->n_states); - for (uint8_t i = 0; ret == 0 && i < a->n_states; i++) { - ret = sbp_tracking_channel_state_dep_a_cmp(&a->states[i], &b->states[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_states; i++) { + ret = sbp_tracking_channel_state_dep_a_cmp(&a->states[i], &b->states[i]); + if (ret != 0) { + return ret; + } + } return ret; } @@ -1621,9 +1607,6 @@ int sbp_tracking_channel_state_dep_b_cmp( } ret = sbp_float_cmp(&a->cn0, &b->cn0); - if (ret != 0) { - return ret; - } return ret; } @@ -1706,11 +1689,14 @@ int sbp_msg_tracking_state_dep_b_cmp(const sbp_msg_tracking_state_dep_b_t *a, int ret = 0; ret = sbp_u8_cmp(&a->n_states, &b->n_states); - for (uint8_t i = 0; ret == 0 && i < a->n_states; i++) { - ret = sbp_tracking_channel_state_dep_b_cmp(&a->states[i], &b->states[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_states; i++) { + ret = sbp_tracking_channel_state_dep_b_cmp(&a->states[i], &b->states[i]); + if (ret != 0) { + return ret; + } + } return ret; } diff --git a/c/src/user.c b/c/src/user.c index 30a42a22bd..f438f0e92d 100644 --- a/c/src/user.c +++ b/c/src/user.c @@ -91,11 +91,14 @@ int sbp_msg_user_data_cmp(const sbp_msg_user_data_t *a, int ret = 0; ret = sbp_u8_cmp(&a->n_contents, &b->n_contents); - for (uint8_t i = 0; ret == 0 && i < a->n_contents; i++) { - ret = sbp_u8_cmp(&a->contents[i], &b->contents[i]); - } if (ret != 0) { return ret; } + for (uint8_t i = 0; i < a->n_contents; i++) { + ret = sbp_u8_cmp(&a->contents[i], &b->contents[i]); + if (ret != 0) { + return ret; + } + } return ret; } diff --git a/c/src/vehicle.c b/c/src/vehicle.c index 70689d4523..4af299b2b1 100644 --- a/c/src/vehicle.c +++ b/c/src/vehicle.c @@ -102,9 +102,6 @@ int sbp_msg_odometry_cmp(const sbp_msg_odometry_t *a, } ret = sbp_u8_cmp(&a->flags, &b->flags); - if (ret != 0) { - return ret; - } return ret; } @@ -206,8 +203,5 @@ int sbp_msg_wheeltick_cmp(const sbp_msg_wheeltick_t *a, } ret = sbp_s32_cmp(&a->ticks, &b->ticks); - if (ret != 0) { - return ret; - } return ret; } diff --git a/generator/sbpg/targets/resources/c/src/sbp_messages_template.c b/generator/sbpg/targets/resources/c/src/sbp_messages_template.c index fcc5d59ce3..d7232dc992 100644 --- a/generator/sbpg/targets/resources/c/src/sbp_messages_template.c +++ b/generator/sbpg/targets/resources/c/src/sbp_messages_template.c @@ -271,18 +271,22 @@ int (((m.cmp_fn)))(const (((m.type_name))) *a, const (((m.type_name))) *b) { ((*- else *)) ((*- if f.packing == "variable-array" *)) ret = sbp_u8_cmp(&a->(((f.size_fn))), &b->(((f.size_fn)))); + if (ret != 0) { return ret; } ((*- endif *)) ((*- if f.packing == "fixed-array" *)) ((*- set max_loop = f.max_items_macro *)) ((*- else *)) ((*- set max_loop = "a->" + f.size_fn *)) ((*- endif *)) - for (uint8_t i = 0; ret == 0 && i < (((max_loop))); i++) + for (uint8_t i = 0; i < (((max_loop))); i++) { ret = (((f.cmp_fn)))(&a->(((f.name)))[i], &b->(((f.name)))[i]); + if (ret != 0) { return ret; } } ((*- endif *)) + ((*- if not loop.last *)) if (ret != 0) { return ret; } + ((*- endif *)) ((*- endfor *)) return ret; }