struct rfc822_parser_context parser;
string_t *content_type;
+ if (astream->part.content_type != NULL)
+ return;
+
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
rfc822_skip_lwsp(&parser);
T_BEGIN {
content_type = t_str_new(64);
- if (rfc822_parse_content_type(&parser, content_type) >= 0) {
- i_free(astream->part.content_type);
- astream->part.content_type =
- i_strdup(str_c(content_type));
- }
+ (void)rfc822_parse_content_type(&parser, content_type);
+ astream->part.content_type = i_strdup(str_c(content_type));
} T_END;
}
struct rfc822_parser_context parser;
const char *const *results;
string_t *str;
+ int ret;
if (ctx->content_type != NULL)
return;
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
rfc822_skip_lwsp(&parser);
str = t_str_new(64);
- if (rfc822_parse_content_type(&parser, str) < 0)
- return;
+ ret = rfc822_parse_content_type(&parser, str);
ctx->content_type = i_strdup(str_c(str));
+ if (ret < 0)
+ return;
rfc2231_parse(&parser, &results);
for (; *results != NULL; results += 2) {
struct rfc822_parser_context parser;
const char *const *results;
string_t *content_type;
+ int ret;
if (ctx->part_seen_content_type)
return;
rfc822_skip_lwsp(&parser);
content_type = t_str_new(64);
- if (rfc822_parse_content_type(&parser, content_type) < 0)
- return;
+ ret = rfc822_parse_content_type(&parser, content_type);
if (strcasecmp(str_c(content_type), "message/rfc822") == 0)
ctx->part->flags |= MESSAGE_PART_FLAG_MESSAGE_RFC822;
ctx->part->flags |= MESSAGE_PART_FLAG_MULTIPART_DIGEST;
}
+ if (ret < 0)
+ return;
if ((ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0 ||
ctx->last_boundary != NULL)
return;
rfc822_skip_lwsp(&parser);
content_type = t_str_new(64);
- if (rfc822_parse_content_type(&parser, content_type) >= 0) {
- ctx->content_type_text =
- strncasecmp(str_c(content_type), "text/", 5) == 0 ||
- strncasecmp(str_c(content_type), "message/", 8) == 0;
- }
+ (void)rfc822_parse_content_type(&parser, content_type);
+ ctx->content_type_text =
+ strncasecmp(str_c(content_type), "text/", 5) == 0 ||
+ strncasecmp(str_c(content_type), "message/", 8) == 0;
}
static void handle_header(struct message_search_context *ctx,
struct rfc822_parser_context parser;
string_t *content_type;
+ if (ctx->content_type != NULL)
+ return;
+
rfc822_parser_init(&parser, hdr->full_value, hdr->full_value_len, NULL);
rfc822_skip_lwsp(&parser);
T_BEGIN {
content_type = t_str_new(64);
- if (rfc822_parse_content_type(&parser, content_type) >= 0) {
- i_free(ctx->content_type);
- ctx->content_type =
- str_lcase(i_strdup(str_c(content_type)));
- }
+ (void)rfc822_parse_content_type(&parser, content_type);
+ ctx->content_type = str_lcase(i_strdup(str_c(content_type)));
} T_END;
}