From 04b0e33c15ba4774a3fc914399594340e87dc706 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Thu, 19 Oct 2023 21:33:37 -0500 Subject: multipart-parser: use emplace_back clang-17 will have a stronger 'modernize-use-emplace' check and fails with the following warning: ``` ../include/multipart_parser.hpp:308:33: error: use emplace_back instead of push_back [modernize-use-emplace,-warnings-as-errors] 308 | mime_fields.push_back({}); | ^~~~~~~~~~~~ | emplace_back( ``` The vector::emplace_back needed an extra hint, as it would not directly coerce an initializer-list into the vector's value_type, so we need to use the value_type constructor. Signed-off-by: Patrick Williams Change-Id: I74417e0ff5a6e0991bfbe4936b4814f6ee4c1269 --- include/multipart_parser.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/multipart_parser.hpp b/include/multipart_parser.hpp index f707abfa5a..94983f2456 100644 --- a/include/multipart_parser.hpp +++ b/include/multipart_parser.hpp @@ -105,7 +105,7 @@ class MultipartParser return ParserError::ERROR_BOUNDARY_LF; } index = 0; - mime_fields.push_back({}); + mime_fields.emplace_back(FormPart{}); state = State::HEADER_FIELD_START; break; } @@ -305,7 +305,7 @@ class MultipartParser { // unset the PART_BOUNDARY flag flags = Boundary::NON_BOUNDARY; - mime_fields.push_back({}); + mime_fields.emplace_back(FormPart{}); state = State::HEADER_FIELD_START; return ParserError::PARSER_SUCCESS; } -- cgit v1.2.3