From 73aec263b16994df4d2dc49ec41392629d519625 Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Mon, 1 Aug 2022 19:33:27 +0200 Subject: [PATCH] LibWeb: Move is_basic_latin() to Blob.{cpp,h} This method needs to be accessible from both Blob and File. --- Userland/Libraries/LibWeb/FileAPI/Blob.cpp | 9 +++++++++ Userland/Libraries/LibWeb/FileAPI/Blob.h | 1 + Userland/Libraries/LibWeb/FileAPI/File.cpp | 9 --------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp index d8ba575232..c6887f89bd 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp @@ -96,6 +96,15 @@ ErrorOr process_blob_parts(Vector const& blob_parts, Optio return bytes; } +bool is_basic_latin(StringView view) +{ + for (auto code_point : view) { + if (code_point < 0x0020 || code_point > 0x007E) + return false; + } + return true; +} + Blob::Blob(ByteBuffer byte_buffer, String type) : m_byte_buffer(move(byte_buffer)) , m_type(move(type)) diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.h b/Userland/Libraries/LibWeb/FileAPI/Blob.h index 4bd8a56864..b9ff185a54 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.h +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.h @@ -28,6 +28,7 @@ struct BlobPropertyBag { [[nodiscard]] ErrorOr convert_line_endings_to_native(String const& string); [[nodiscard]] ErrorOr process_blob_parts(Vector const& blob_parts, Optional const& options = {}); +[[nodiscard]] bool is_basic_latin(StringView view); class Blob : public RefCounted diff --git a/Userland/Libraries/LibWeb/FileAPI/File.cpp b/Userland/Libraries/LibWeb/FileAPI/File.cpp index 9548f3f7a7..4498789aef 100644 --- a/Userland/Libraries/LibWeb/FileAPI/File.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/File.cpp @@ -8,15 +8,6 @@ namespace Web::FileAPI { -static bool is_basic_latin(StringView view) -{ - for (auto code_point : view) { - if (code_point < 0x0020 || code_point > 0x007E) - return false; - } - return true; -} - File::File(ByteBuffer byte_buffer, String file_name, String type, i64 last_modified) : Blob(move(byte_buffer), move(type)) , m_name(move(file_name))