From 7c39e62dd53a0f2ac915fa76d67372ee43503426 Mon Sep 17 00:00:00 2001 From: Juri Glass Date: Mon, 22 Aug 2011 18:13:36 +0200 Subject: [PATCH] unified error check code style --- sml/src/sml_attention_response.c | 3 --- sml/src/sml_get_list_request.c | 14 +++++--------- sml/src/sml_get_list_response.c | 6 ------ sml/src/sml_get_profile_pack_request.c | 8 +++++++- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/sml/src/sml_attention_response.c b/sml/src/sml_attention_response.c index ddb5d82..04b8d0c 100644 --- a/sml/src/sml_attention_response.c +++ b/sml/src/sml_attention_response.c @@ -41,13 +41,10 @@ sml_attention_response *sml_attention_response_parse(sml_buffer *buf){ msg->server_id = sml_octet_string_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->attention_number = sml_octet_string_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->attention_message = sml_octet_string_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->attention_details = sml_tree_parse(buf); if (sml_buf_has_errors(buf)) goto error; diff --git a/sml/src/sml_get_list_request.c b/sml/src/sml_get_list_request.c index ddaa6e0..62fc8d1 100644 --- a/sml/src/sml_get_list_request.c +++ b/sml/src/sml_get_list_request.c @@ -54,19 +54,15 @@ sml_get_list_request *sml_get_list_request_parse(sml_buffer *buf) { } msg->client_id = sml_octet_string_parse(buf); - if (sml_buf_has_errors(buf)) goto error; - + if (sml_buf_has_errors(buf)) goto error; msg->server_id = sml_octet_string_parse(buf); - if (sml_buf_has_errors(buf)) goto error; - + if (sml_buf_has_errors(buf)) goto error; msg->username = sml_octet_string_parse(buf); - if (sml_buf_has_errors(buf)) goto error; - + if (sml_buf_has_errors(buf)) goto error; msg->password = sml_octet_string_parse(buf); - if (sml_buf_has_errors(buf)) goto error; - + if (sml_buf_has_errors(buf)) goto error; msg->list_name = sml_octet_string_parse(buf); - if (sml_buf_has_errors(buf)) goto error; + if (sml_buf_has_errors(buf)) goto error; return msg; diff --git a/sml/src/sml_get_list_response.c b/sml/src/sml_get_list_response.c index fbd6518..e4afc52 100644 --- a/sml/src/sml_get_list_response.c +++ b/sml/src/sml_get_list_response.c @@ -41,22 +41,16 @@ sml_get_list_response *sml_get_list_response_parse(sml_buffer *buf) { msg->client_id = sml_octet_string_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->server_id = sml_octet_string_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->list_name = sml_octet_string_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->act_sensor_time = sml_time_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->val_list = sml_list_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->list_signature = sml_octet_string_parse(buf); if (sml_buf_has_errors(buf)) goto error; - msg->act_gateway_time = sml_time_parse(buf); if (sml_buf_has_errors(buf)) goto error; diff --git a/sml/src/sml_get_profile_pack_request.c b/sml/src/sml_get_profile_pack_request.c index a0636c3..c5ed180 100644 --- a/sml/src/sml_get_profile_pack_request.c +++ b/sml/src/sml_get_profile_pack_request.c @@ -74,12 +74,19 @@ sml_get_profile_pack_request *sml_get_profile_pack_request_parse(sml_buffer *buf } msg->server_id = sml_octet_string_parse(buf); + if (sml_buf_has_errors(buf)) goto error; msg->username = sml_octet_string_parse(buf); + if (sml_buf_has_errors(buf)) goto error; msg->password = sml_octet_string_parse(buf); + if (sml_buf_has_errors(buf)) goto error; msg->with_rawdata = sml_boolean_parse(buf); + if (sml_buf_has_errors(buf)) goto error; msg->begin_time = sml_time_parse(buf); + if (sml_buf_has_errors(buf)) goto error; msg->end_time = sml_time_parse(buf); + if (sml_buf_has_errors(buf)) goto error; msg->parameter_tree_path = sml_tree_path_parse(buf); + if (sml_buf_has_errors(buf)) goto error; if (!sml_buf_optional_is_skipped(buf)) { if (sml_buf_get_next_type(buf) != SML_TYPE_LIST) { @@ -106,7 +113,6 @@ sml_get_profile_pack_request *sml_get_profile_pack_request_parse(sml_buffer *buf } msg->das_details = sml_tree_parse(buf); - if (sml_buf_has_errors(buf)) goto error; return msg;