From ae83e88440d4a3910bb5db2302820ddd7c34be96 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Fri, 24 May 2013 11:52:51 +0000 Subject: [PATCH] removed struct initialization with designated initializer, instead the elements of an initializer to appear in a fixed order --- src/bt_control_iphone.m | 17 +++++++++------- src/sdp_parser.c | 43 ++++++++++++++++++++++------------------- src/sdp_query_rfcomm.c | 10 +++++----- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/bt_control_iphone.m b/src/bt_control_iphone.m index c8541dfdf..488b1c8f9 100644 --- a/src/bt_control_iphone.m +++ b/src/bt_control_iphone.m @@ -707,13 +707,16 @@ int bt_control_iphone_power_management_enabled(void){ // single instance bt_control_t bt_control_iphone = { - .on = iphone_on, - .off = iphone_off, - .sleep = iphone_sleep, - .wake = iphone_wake, - .valid = iphone_valid, - .name = iphone_name, - .register_for_power_notifications = iphone_register_for_power_notifications + iphone_on, // on + iphone_off, // off + iphone_sleep, // sleep + iphone_wake, // wake + iphone_valid, // valid + iphone_name, // name + NULL, // baudrate_cmd + NULL, // next_cmd + iphone_register_for_power_notifications, // register_for_power_notifications + NULL // hw_error }; int iphone_system_bt_enabled(void){ diff --git a/src/sdp_parser.c b/src/sdp_parser.c index 164883fae..9c872f4ec 100644 --- a/src/sdp_parser.c +++ b/src/sdp_parser.c @@ -160,35 +160,38 @@ void parse(uint8_t eventByte){ case GET_ATTRIBUTE_VALUE_LENGTH: attribute_bytes_received++; + { sdp_parser_attribute_value_event_t attribute_value_event = { - .type = SDP_PARSER_ATTRIBUTE_VALUE, - .record_id = record_counter, - .attribute_id = attribute_id, - .attribute_length = attribute_value_size, - .data_offset = attribute_bytes_delivered++, - .data = eventByte + SDP_PARSER_ATTRIBUTE_VALUE, + record_counter, + attribute_id, + attribute_value_size, + attribute_bytes_delivered++, + eventByte }; (*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&attribute_value_event); - - if (!de_state_size(eventByte, &de_header_state)) break; + } + if (!de_state_size(eventByte, &de_header_state)) break; attribute_value_size = de_header_state.de_size + attribute_bytes_received; state = GET_ATTRIBUTE_VALUE; break; - case GET_ATTRIBUTE_VALUE: + case GET_ATTRIBUTE_VALUE: attribute_bytes_received++; - - sdp_parser_attribute_value_event_t attribute_value_event1 = { - .type = SDP_PARSER_ATTRIBUTE_VALUE, - .record_id = record_counter, - .attribute_id = attribute_id, - .attribute_length = attribute_value_size, - .data_offset = attribute_bytes_delivered++, - .data = eventByte + { + sdp_parser_attribute_value_event_t attribute_value_event = { + SDP_PARSER_ATTRIBUTE_VALUE, + record_counter, + attribute_id, + attribute_value_size, + attribute_bytes_delivered++, + eventByte }; - (*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&attribute_value_event1); + + (*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&attribute_value_event); + } // printf("paser: attribute_bytes_received %u, attribute_value_size %u\n", attribute_bytes_received, attribute_value_size); if (attribute_bytes_received < attribute_value_size) break; @@ -235,8 +238,8 @@ void sdp_parser_handle_chunk(uint8_t * data, uint16_t size){ void sdp_parser_handle_done(uint8_t status){ sdp_parser_complete_event_t complete_event = { - .type = SDP_PARSER_COMPLETE, - .status = status + SDP_PARSER_COMPLETE, + status }; (*sdp_query_rfcomm_callback)((sdp_parser_event_t*)&complete_event); } diff --git a/src/sdp_query_rfcomm.c b/src/sdp_query_rfcomm.c index 7ee9ea7c8..6224c5750 100644 --- a/src/sdp_query_rfcomm.c +++ b/src/sdp_query_rfcomm.c @@ -229,9 +229,9 @@ void handleServiceNameData(uint32_t attribute_value_length, uint32_t data_offset // notify on last char if (data_offset == attribute_value_length - 1 && sdp_rfcom_channel_nr!=0){ sdp_query_rfcomm_service_event_t value_event = { - .type = SDP_QUERY_RFCOMM_SERVICE, - .service_name = (uint8_t *) sdp_service_name, - .channel_nr = sdp_rfcom_channel_nr + SDP_QUERY_RFCOMM_SERVICE, + sdp_rfcom_channel_nr, + (uint8_t *) sdp_service_name }; printf("Service found %s\n", sdp_service_name); (*sdp_app_callback)((sdp_query_event_t*)&value_event, sdp_app_context); @@ -267,8 +267,8 @@ static void handle_sdp_parser_event(sdp_parser_event_t * event){ case SDP_PARSER_COMPLETE: ce = (sdp_parser_complete_event_t*) event; sdp_query_complete_event_t c_event = { - .type = SDP_QUERY_COMPLETE, - .status = ce->status + SDP_QUERY_COMPLETE, + ce->status }; (*sdp_app_callback)((sdp_query_event_t*)&c_event, sdp_app_context); break;