Run astyle

pull/7822/head
Donatien Garnier 2018-08-24 17:59:30 +01:00
parent 6c4fe20f09
commit 8e8ce973c6
19 changed files with 90 additions and 76 deletions

View File

@ -44,8 +44,7 @@ class SimpleMessageParser :
MessageParser::Delegate,
URIParser::Delegate,
TextParser::Delegate,
MimeParser::Delegate
{
MimeParser::Delegate {
public:
/**
* Delegate invoked when the parser raise an event.

View File

@ -34,7 +34,8 @@ bool MessageBuilder::append_record(
const RecordType &type,
const RecordPayload &payload,
bool is_last_record
) {
)
{
Record record(
type,
payload,

View File

@ -279,7 +279,8 @@ uint8_t MessageParser::extract_id_length(parsing_state_t &s, uint8_t header)
return (header & Header::id_length_bit) ? *s.it++ : 0;
}
void MessageParser::report_parsing_started() {
void MessageParser::report_parsing_started()
{
if (_delegate) {
_delegate->on_parsing_started();
}

View File

@ -72,7 +72,8 @@ Mime& Mime::operator=(const Mime &to_copy)
void Mime::set_mime(
const Span<const uint8_t> &mime_type,
const Span<const uint8_t> &content
) {
)
{
delete[] _mime;
_mime = new uint8_t[mime_type.size() + content.size()];
@ -95,7 +96,8 @@ Span<const uint8_t> Mime::get_mime_content() const
bool Mime::append_as_record(
MessageBuilder &message_builder,
bool is_last_record
) {
)
{
return message_builder.append_record(
RecordType(
RecordType::media_type,
@ -110,7 +112,8 @@ void Mime::move_data(
uint8_t *mime_record,
size_t mime_type_size,
size_t mime_content_size
) {
)
{
delete[] _mime;
_mime = mime_record;
_type_size = mime_type_size;

View File

@ -89,7 +89,8 @@ void SimpleMessageParser::on_parsing_terminated()
void SimpleMessageParser::on_record_parsed(
const URI &uri,
const RecordID &id
) {
)
{
if (_delegate) {
_delegate->on_uri_parsed(uri, id);
}
@ -98,7 +99,8 @@ void SimpleMessageParser::on_record_parsed(
void SimpleMessageParser::on_record_parsed(
const Text &text,
const RecordID &id
) {
)
{
if (_delegate) {
_delegate->on_text_parsed(text, id);
}
@ -107,7 +109,8 @@ void SimpleMessageParser::on_record_parsed(
void SimpleMessageParser::on_record_parsed(
const Mime &mime,
const RecordID &id
) {
)
{
if (_delegate) {
_delegate->on_mime_parsed(mime, id);
}

View File

@ -82,7 +82,8 @@ void Text::set_text(
encoding_t text_encoding,
const Span<const uint8_t> &language_code,
const Span<const uint8_t> &text
) {
)
{
delete[] _text_record;
_text_record_size = header_size + language_code.size() + text.size();
@ -107,14 +108,16 @@ Text::encoding_t Text::get_encoding() const
return (_text_record[header_index] & utf16_encoding_bit) ? UTF16 : UTF8;
}
Span<const uint8_t> Text::get_language_code() const {
Span<const uint8_t> Text::get_language_code() const
{
return make_const_Span(
_text_record + language_code_index,
_text_record[header_index] & language_code_size_mask
);
}
Span<const uint8_t> Text::get_text() const {
Span<const uint8_t> Text::get_text() const
{
size_t language_code_size = get_language_code().size();
return make_const_Span(
@ -123,7 +126,8 @@ Span<const uint8_t> Text::get_text() const {
);
}
void Text::move_data(uint8_t *text, size_t size) {
void Text::move_data(uint8_t *text, size_t size)
{
delete[] _text_record;
_text_record = text;
_text_record_size = size;
@ -132,7 +136,8 @@ void Text::move_data(uint8_t *text, size_t size) {
bool Text::append_as_record(
MessageBuilder &message_builder,
bool is_last_record
) {
)
{
// Build the record type
RecordType type(
RecordType::well_known_type,

View File

@ -32,7 +32,8 @@ namespace common {
URI::URI() :
_uri(NULL),
_uri_size(0) {
_uri_size(0)
{
}
URI::URI(uri_identifier_code_t id, const Span<const uint8_t> &uri_field) :
@ -74,7 +75,8 @@ URI& URI::operator=(const URI &other)
void URI::set_uri(
uri_identifier_code_t id,
const Span<const uint8_t> &uri_field
) {
)
{
delete[] _uri;
if (uri_field.empty()) {