renamed mc_sml_buf_get_current_byte to

sml_buf_get_current_byte
This commit is contained in:
Juri Glass 2011-06-16 16:49:19 +02:00
parent 92820c83b8
commit a31efa8215
7 changed files with 10 additions and 10 deletions

View file

@ -91,7 +91,7 @@ int sml_buf_has_errors(sml_buffer *buf);
int sml_buf_get_next_type(sml_buffer *buf);
// Returns the current byte.
unsigned char mc_sml_buf_get_current_byte(sml_buffer *buf);
unsigned char sml_buf_get_current_byte(sml_buffer *buf);
// Returns a pointer to the current buffer position.
unsigned char *mc_sml_buf_get_current_buf(sml_buffer *buf);

View file

@ -64,7 +64,7 @@ sml_file *sml_file_parse(unsigned char *buffer, size_t buffer_len) {
// parsing all messages
for (; buf->cursor < buf->buffer_len;) {
if(mc_sml_buf_get_current_byte(buf) == SML_MESSAGE_END) {
if(sml_buf_get_current_byte(buf) == SML_MESSAGE_END) {
// reading trailing zeroed bytes
mc_sml_buf_update_read_bytes(buf, 1);
continue;

View file

@ -67,7 +67,7 @@ sml_message *sml_message_parse(sml_buffer *buf) {
msg->crc = mc_sml_parse_u16(buf);
if (sml_buf_has_errors(buf)) goto error;
if (mc_sml_buf_get_current_byte(buf) == SML_MESSAGE_END) {
if (sml_buf_get_current_byte(buf) == SML_MESSAGE_END) {
mc_sml_buf_update_read_bytes(buf, 1);
}
return msg;

View file

@ -41,7 +41,7 @@ u64 mc_sml_parse_number(sml_buffer *buf, unsigned char type, int max_size) {
// maybe this one is fixed too?
for (i = 0; i < l; i++) {
n <<= 8;
n |= mc_sml_buf_get_current_byte(buf);
n |= sml_buf_get_current_byte(buf);
mc_sml_buf_update_read_bytes(buf, 1);
}
return n;

View file

@ -23,11 +23,11 @@
int sml_buf_get_next_length(sml_buffer *buf) {
int length = 0;
unsigned char byte = mc_sml_buf_get_current_byte(buf);
unsigned char byte = sml_buf_get_current_byte(buf);
int list = ((byte & SML_TYPE_FIELD) == SML_TYPE_LIST) ? 0 : -1;
for (;buf->cursor < buf->buffer_len;) {
byte = mc_sml_buf_get_current_byte(buf);
byte = sml_buf_get_current_byte(buf);
length <<= 4;
length |= (byte & SML_LENGTH_FIELD);
@ -85,7 +85,7 @@ int sml_buf_get_next_type(sml_buffer *buf) {
return (buf->buffer[buf->cursor] & SML_TYPE_FIELD);
}
unsigned char mc_sml_buf_get_current_byte(sml_buffer *buf) {
unsigned char sml_buf_get_current_byte(sml_buffer *buf) {
return buf->buffer[buf->cursor];
}
@ -122,7 +122,7 @@ void sml_buffer_free(sml_buffer *buf) {
}
int mc_sml_is_optional_skipped(sml_buffer *buf) {
if (mc_sml_buf_get_current_byte(buf) == SML_OPTIONAL_SKIPPED) {
if (sml_buf_get_current_byte(buf) == SML_OPTIONAL_SKIPPED) {
mc_sml_buf_update_read_bytes(buf, 1);
return 1;
}

View file

@ -22,7 +22,7 @@
sml_status *sml_status_parse(sml_buffer *buf) {
int type = sml_buf_get_next_type(buf);
unsigned char byte = mc_sml_buf_get_current_byte(buf);
unsigned char byte = sml_buf_get_current_byte(buf);
sml_status *state = (sml_status *) malloc(sizeof(sml_status));
switch (type) {

View file

@ -23,7 +23,7 @@
sml_value *sml_value_parse(sml_buffer *buf) {
int type = sml_buf_get_next_type(buf);
unsigned char byte = mc_sml_buf_get_current_byte(buf);
unsigned char byte = sml_buf_get_current_byte(buf);
sml_value *value = (sml_value *) malloc(sizeof(sml_value));
value->type = type;