1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

file: Avoid some unnecessary string copies

This commit is contained in:
Linus Groh 2021-05-07 14:33:17 +01:00
parent dd633b9dd1
commit a9fcdc767e

View file

@ -19,7 +19,7 @@ static Optional<String> description_only(String description, [[maybe_unused]] co
} }
// FIXME: Ideally Gfx::ImageDecoder could tell us the image type directly. // FIXME: Ideally Gfx::ImageDecoder could tell us the image type directly.
static Optional<String> image_details(const String description, const String& path) static Optional<String> image_details(const String& description, const String& path)
{ {
auto file_or_error = MappedFile::map(path); auto file_or_error = MappedFile::map(path);
if (file_or_error.is_error()) if (file_or_error.is_error())
@ -55,7 +55,7 @@ static Optional<String> image_details(const String description, const String& pa
ENUMERATE_DESCRIPTION_CONTENTS(V) ENUMERATE_DESCRIPTION_CONTENTS(V)
#undef V #undef V
static Optional<String> get_description_from_mime_type(String& mime, String path) static Optional<String> get_description_from_mime_type(const String& mime, const String& path)
{ {
#define V(var_name, mime_type, description, details) \ #define V(var_name, mime_type, description, details) \
if (String(mime_type) == mime) \ if (String(mime_type) == mime) \