renamed mc_sml_buf_has_errors to

sml_buf_has_errors
This commit is contained in:
Juri Glass 2011-06-16 16:45:36 +02:00
parent 35974730bf
commit eb76c84331
16 changed files with 58 additions and 58 deletions

View file

@ -85,7 +85,7 @@ int sml_buf_get_next_length(sml_buffer *buf);
void sml_buf_set_type_and_length(sml_buffer *buf, unsigned int type, unsigned int l);
// Checks if a error is occured.
int mc_sml_buf_has_errors(sml_buffer *buf);
int sml_buf_has_errors(sml_buffer *buf);
// Returns the type field of the current byte.
int mc_sml_buf_get_current_type(sml_buffer *buf);

View file

@ -72,7 +72,7 @@ sml_file *sml_file_parse(unsigned char *buffer, size_t buffer_len) {
msg = sml_message_parse(buf);
if (mc_sml_buf_has_errors(buf)) {
if (sml_buf_has_errors(buf)) {
printf("warning: could not read the whole file\n");
break;
}

View file

@ -35,16 +35,16 @@ sml_attention_response *sml_attention_response_parse(sml_buffer *buf){
}
msg->server_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->attention_number = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->attention_message = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->attention_details = SML_SKIP_OPTIONAL sml_tree_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
return msg;

View file

@ -50,7 +50,7 @@ sml_close_request * sml_close_request_parse(sml_buffer *buf) {
}
msg->global_signature = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
return msg;

View file

@ -36,7 +36,7 @@ sml_close_response *sml_close_response_parse(sml_buffer *buf) {
}
msg->global_signature = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
return msg;

View file

@ -71,19 +71,19 @@ sml_get_list_request *sml_get_list_request_parse(sml_buffer *buf) {
}
msg->client_id = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->server_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->username = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->password = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->list_name = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
return msg;

View file

@ -37,25 +37,25 @@ sml_get_list_response *sml_get_list_response_parse(sml_buffer *buf) {
}
msg->client_id = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->server_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->list_name = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->act_sensor_time = SML_SKIP_OPTIONAL sml_time_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->val_list = sml_list_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->list_signature = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->act_gateway_time = SML_SKIP_OPTIONAL sml_time_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
return msg;

View file

@ -89,25 +89,25 @@ sml_get_profile_pack_request *sml_get_profile_pack_request_parse(sml_buffer *buf
printf("TODO:sml_get_profile_pack_request_parse -> not implemented yet");
/* msg->client_id = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->server_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->list_name = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
*/
/*msg->act_sensor_time = SML_SKIP_OPTIONAL sml_time_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->val_list = sml_list_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->list_signature = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->act_gateway_time = SML_SKIP_OPTIONAL sml_time_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
*/
return msg;

View file

@ -70,25 +70,25 @@ sml_list *sml_list_parse(sml_buffer *buf) {
}
cur->obj_name = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
cur->status = SML_SKIP_OPTIONAL sml_status_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
cur->val_time = SML_SKIP_OPTIONAL sml_time_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
cur->unit = SML_SKIP_OPTIONAL mc_sml_parse_u8(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
cur->scaler = SML_SKIP_OPTIONAL mc_sml_parse_i8(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
cur->value = SML_SKIP_OPTIONAL sml_value_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
cur->value_signature = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
cur->next = 0;
}

View file

@ -53,19 +53,19 @@ sml_message *sml_message_parse(sml_buffer *buf) {
}
msg->transaction_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->group_id = mc_sml_parse_u8(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->abort_on_error = mc_sml_parse_u8(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->message_body = sml_message_body_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->crc = mc_sml_parse_u16(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
if (mc_sml_buf_get_current_byte(buf) == SML_MESSAGE_END) {
mc_sml_buf_update_read_bytes(buf, 1);
@ -131,7 +131,7 @@ sml_message_body *sml_message_body_parse(sml_buffer *buf) {
}
msg_body->tag = mc_sml_parse_u16(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
switch (msg_body->tag) {
case SML_MESSAGE_OPEN_REQUEST:

View file

@ -83,25 +83,25 @@ sml_open_request *sml_open_request_parse(sml_buffer *buf) {
}
msg->codepage = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->client_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->req_file_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->server_id = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->username = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->password = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->sml_version = SML_SKIP_OPTIONAL mc_sml_parse_u8(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
return msg;

View file

@ -36,22 +36,22 @@ sml_open_response *sml_open_response_parse(sml_buffer *buf) {
}
msg->codepage = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->client_id = SML_SKIP_OPTIONAL sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->req_file_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->server_id = sml_octet_string_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->ref_time = SML_SKIP_OPTIONAL sml_time_parse(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
msg->sml_version = SML_SKIP_OPTIONAL mc_sml_parse_u8(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
return msg;
error:

View file

@ -77,7 +77,7 @@ void sml_buf_set_type_and_length(sml_buffer *buf, unsigned int type, unsigned in
buf->cursor++;
}
int mc_sml_buf_has_errors(sml_buffer *buf) {
int sml_buf_has_errors(sml_buffer *buf) {
return buf->error != 0;
}

View file

@ -53,7 +53,7 @@ sml_status *sml_status_parse(sml_buffer *buf) {
buf->error = 1;
break;
}
if (mc_sml_buf_has_errors(buf)) {
if (sml_buf_has_errors(buf)) {
free(state);
return 0;
}

View file

@ -36,10 +36,10 @@ sml_time *sml_time_parse(sml_buffer *buf) {
}
tme->tag = mc_sml_parse_u8(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
tme->data = mc_sml_parse_u32(buf);
if (mc_sml_buf_has_errors(buf)) goto error;
if (sml_buf_has_errors(buf)) goto error;
return tme;

View file

@ -95,7 +95,7 @@ sml_value *sml_value_parse(sml_buffer *buf) {
buf->error = 1;
break;
}
if (mc_sml_buf_has_errors(buf)) {
if (sml_buf_has_errors(buf)) {
free(value);
return 0;
}