From 9c08bb95553539d1880a5ac81ba5608d4ad874de Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 28 Jan 2023 20:12:17 +0000 Subject: [PATCH] AK: Remove `try_` prefix from FixedArray creation functions --- AK/DisjointChunks.h | 6 ++---- AK/FixedArray.h | 18 +++++++++--------- Kernel/Bus/USB/USBConfiguration.cpp | 2 +- Kernel/Credentials.cpp | 2 +- Kernel/Memory/AnonymousVMObject.cpp | 4 ++-- Kernel/Memory/VMObject.cpp | 4 ++-- Tests/AK/TestDisjointChunks.cpp | 6 +++--- .../3DFileViewer/WavefrontOBJLoader.cpp | 6 +++--- .../SoundPlayer/PlaybackManager.cpp | 2 +- .../SoundPlayer/VisualizationWidget.h | 2 +- Userland/Applications/Terminal/main.cpp | 2 +- Userland/Demos/Tubes/Tubes.cpp | 2 +- .../Libraries/LibAudio/ConnectionToServer.h | 2 +- Userland/Libraries/LibAudio/MP3Loader.cpp | 2 +- Userland/Libraries/LibAudio/WavLoader.cpp | 2 +- Userland/Libraries/LibCompress/Brotli.h | 2 +- Userland/Libraries/LibCore/MemoryStream.cpp | 2 +- Userland/Libraries/LibCore/System.cpp | 12 ++++++------ Userland/Libraries/LibDSP/Track.cpp | 2 +- .../Libraries/LibGfx/Font/OpenType/Font.cpp | 2 +- Userland/Libraries/LibGfx/PNGWriter.cpp | 2 +- .../LibSoftGPU/Buffer/Typed3DBuffer.h | 2 +- Userland/Libraries/LibVideo/VP9/Context.h | 10 +++++----- Userland/Libraries/LibVideo/VP9/Decoder.cpp | 6 +++--- Userland/Libraries/LibVideo/VP9/Parser.cpp | 4 ++-- Userland/Libraries/LibVideo/VideoFrame.cpp | 10 +++++----- 26 files changed, 57 insertions(+), 59 deletions(-) diff --git a/AK/DisjointChunks.h b/AK/DisjointChunks.h index 596c3f34350..8b6033f9455 100644 --- a/AK/DisjointChunks.h +++ b/AK/DisjointChunks.h @@ -226,12 +226,10 @@ FixedArray shatter_chunk(FixedArray& source_chunk, size_t start, size_t sl if constexpr (IsTriviallyConstructible) { TypedTransfer::move(new_chunk.data(), wanted_slice.data(), wanted_slice.size()); } else { - // FIXME: propagate errors - auto copied_chunk = MUST(FixedArray::try_create(wanted_slice)); + auto copied_chunk = FixedArray::create(wanted_slice).release_value_but_fixme_should_propagate_errors(); new_chunk.swap(copied_chunk); } - // FIXME: propagate errors - auto rest_of_chunk = MUST(FixedArray::try_create(source_chunk.span().slice(start))); + auto rest_of_chunk = FixedArray::create(source_chunk.span().slice(start)).release_value_but_fixme_should_propagate_errors(); source_chunk.swap(rest_of_chunk); return new_chunk; } diff --git a/AK/FixedArray.h b/AK/FixedArray.h index fe3da718be3..a12fbd973e3 100644 --- a/AK/FixedArray.h +++ b/AK/FixedArray.h @@ -22,9 +22,9 @@ class FixedArray { public: FixedArray() = default; - static ErrorOr> try_create(std::initializer_list initializer) + static ErrorOr> create(std::initializer_list initializer) { - auto array = TRY(try_create(initializer.size())); + auto array = TRY(create(initializer.size())); auto it = initializer.begin(); for (size_t i = 0; i < array.size(); ++i) { array[i] = move(*it); @@ -33,7 +33,7 @@ public: return array; } - static ErrorOr> try_create(size_t size) + static ErrorOr> create(size_t size) { if (size == 0) return FixedArray(); @@ -48,17 +48,17 @@ public: static FixedArray must_create_but_fixme_should_propagate_errors(size_t size) { - return MUST(try_create(size)); + return MUST(create(size)); } template - static ErrorOr> try_create(T (&&array)[N]) + static ErrorOr> create(T (&&array)[N]) { - return try_create(Span(array, N)); + return create(Span(array, N)); } template - static ErrorOr> try_create(Span span) + static ErrorOr> create(Span span) { if (span.size() == 0) return FixedArray(); @@ -71,9 +71,9 @@ public: return FixedArray(new_storage); } - ErrorOr> try_clone() const + ErrorOr> clone() const { - return try_create(span()); + return create(span()); } static size_t storage_allocation_size(size_t size) diff --git a/Kernel/Bus/USB/USBConfiguration.cpp b/Kernel/Bus/USB/USBConfiguration.cpp index bf913f00069..ecf86aaf48e 100644 --- a/Kernel/Bus/USB/USBConfiguration.cpp +++ b/Kernel/Bus/USB/USBConfiguration.cpp @@ -15,7 +15,7 @@ namespace Kernel::USB { ErrorOr USBConfiguration::enumerate_interfaces() { - auto descriptor_hierarchy_buffer = TRY(FixedArray::try_create(m_descriptor.total_length)); // Buffer for us to store the entire hierarchy into + auto descriptor_hierarchy_buffer = TRY(FixedArray::create(m_descriptor.total_length)); // Buffer for us to store the entire hierarchy into // The USB spec is a little bit janky here... Interface and Endpoint descriptors aren't fetched // through a `GET_DESCRIPTOR` request to the device. Instead, the _entire_ hierarchy is returned diff --git a/Kernel/Credentials.cpp b/Kernel/Credentials.cpp index 3fb155dbc11..ba97a34be2c 100644 --- a/Kernel/Credentials.cpp +++ b/Kernel/Credentials.cpp @@ -12,7 +12,7 @@ namespace Kernel { ErrorOr> Credentials::create(UserID uid, GroupID gid, UserID euid, GroupID egid, UserID suid, GroupID sgid, Span extra_gids, SessionID sid, ProcessGroupID pgid) { - auto extra_gids_array = TRY(FixedArray::try_create(extra_gids)); + auto extra_gids_array = TRY(FixedArray::create(extra_gids)); return adopt_nonnull_ref_or_enomem(new (nothrow) Credentials(uid, gid, euid, egid, suid, sgid, move(extra_gids_array), sid, pgid)); } diff --git a/Kernel/Memory/AnonymousVMObject.cpp b/Kernel/Memory/AnonymousVMObject.cpp index 3dc4f90ccd3..29712b5f161 100644 --- a/Kernel/Memory/AnonymousVMObject.cpp +++ b/Kernel/Memory/AnonymousVMObject.cpp @@ -92,7 +92,7 @@ ErrorOr> AnonymousVMObject::try_create_phys { auto contiguous_physical_pages = TRY(MM.allocate_contiguous_physical_pages(size)); - auto new_physical_pages = TRY(FixedArray>::try_create(contiguous_physical_pages.span())); + auto new_physical_pages = TRY(FixedArray>::create(contiguous_physical_pages.span())); return adopt_nonnull_lock_ref_or_enomem(new (nothrow) AnonymousVMObject(move(new_physical_pages))); } @@ -113,7 +113,7 @@ ErrorOr> AnonymousVMObject::try_create_purg ErrorOr> AnonymousVMObject::try_create_with_physical_pages(Span> physical_pages) { - auto new_physical_pages = TRY(FixedArray>::try_create(physical_pages)); + auto new_physical_pages = TRY(FixedArray>::create(physical_pages)); return adopt_nonnull_lock_ref_or_enomem(new (nothrow) AnonymousVMObject(move(new_physical_pages))); } diff --git a/Kernel/Memory/VMObject.cpp b/Kernel/Memory/VMObject.cpp index 3d241a66062..2f8daf8d4b5 100644 --- a/Kernel/Memory/VMObject.cpp +++ b/Kernel/Memory/VMObject.cpp @@ -19,12 +19,12 @@ SpinlockProtected& VMObject::all_ins ErrorOr>> VMObject::try_clone_physical_pages() const { - return m_physical_pages.try_clone(); + return m_physical_pages.clone(); } ErrorOr>> VMObject::try_create_physical_pages(size_t size) { - return FixedArray>::try_create(ceil_div(size, static_cast(PAGE_SIZE))); + return FixedArray>::create(ceil_div(size, static_cast(PAGE_SIZE))); } VMObject::VMObject(FixedArray>&& new_physical_pages) diff --git a/Tests/AK/TestDisjointChunks.cpp b/Tests/AK/TestDisjointChunks.cpp index c23806fd4e9..15fd5319b3d 100644 --- a/Tests/AK/TestDisjointChunks.cpp +++ b/Tests/AK/TestDisjointChunks.cpp @@ -61,15 +61,15 @@ TEST_CASE(fixed_array) EXPECT(chunks.is_empty()); chunks.append({}); EXPECT(chunks.is_empty()); - chunks.append(MUST(FixedArray::try_create({ 0, 1 }))); + chunks.append(MUST(FixedArray::create({ 0, 1 }))); EXPECT(!chunks.is_empty()); chunks.append({}); - chunks.append(MUST(FixedArray::try_create(3))); + chunks.append(MUST(FixedArray::create(3))); chunks.last_chunk()[0] = 2; chunks.last_chunk()[1] = 3; chunks.last_chunk()[2] = 4; chunks.append({}); - chunks.append(MUST(FixedArray::try_create(1))); + chunks.append(MUST(FixedArray::create(1))); chunks.last_chunk()[0] = 5; for (size_t i = 0; i < 6u; ++i) diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp index ebe71058f50..e5b7f5b9d1f 100644 --- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp +++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp @@ -78,9 +78,9 @@ ErrorOr> WavefrontOBJLoader::load(Core::File& file) return Error::from_string_literal("Wavefront: Malformed face line."); } - auto vertex_indices = TRY(FixedArray::try_create(number_of_vertices)); - auto tex_coord_indices = TRY(FixedArray::try_create(number_of_vertices)); - auto normal_indices = TRY(FixedArray::try_create(number_of_vertices)); + auto vertex_indices = TRY(FixedArray::create(number_of_vertices)); + auto tex_coord_indices = TRY(FixedArray::create(number_of_vertices)); + auto normal_indices = TRY(FixedArray::create(number_of_vertices)); for (size_t i = 0; i < number_of_vertices; ++i) { auto vertex_parts = face_line.at(i).split_view('/', SplitBehavior::KeepEmpty); diff --git a/Userland/Applications/SoundPlayer/PlaybackManager.cpp b/Userland/Applications/SoundPlayer/PlaybackManager.cpp index 4af3be2f0b5..3f0f81182b4 100644 --- a/Userland/Applications/SoundPlayer/PlaybackManager.cpp +++ b/Userland/Applications/SoundPlayer/PlaybackManager.cpp @@ -124,7 +124,7 @@ void PlaybackManager::next_buffer() m_resampler->reset(); // FIXME: Handle OOM better. - auto resampled = MUST(FixedArray::try_create(m_resampler->resample(move(m_current_buffer)).span())); + auto resampled = MUST(FixedArray::create(m_resampler->resample(move(m_current_buffer)).span())); m_current_buffer.swap(resampled); MUST(m_connection->async_enqueue(m_current_buffer)); } diff --git a/Userland/Applications/SoundPlayer/VisualizationWidget.h b/Userland/Applications/SoundPlayer/VisualizationWidget.h index 82f73067443..8ad02136e95 100644 --- a/Userland/Applications/SoundPlayer/VisualizationWidget.h +++ b/Userland/Applications/SoundPlayer/VisualizationWidget.h @@ -70,7 +70,7 @@ public: ErrorOr set_render_sample_count(size_t count) { - auto new_buffer = TRY(FixedArray::try_create(count)); + auto new_buffer = TRY(FixedArray::create(count)); m_render_buffer.swap(new_buffer); return {}; } diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 775f69cafd4..95efadf5877 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -159,7 +159,7 @@ static ErrorOr run_command(DeprecatedString command, bool keep_open) arguments.append("-c"sv); arguments.append(command); } - auto env = TRY(FixedArray::try_create({ "TERM=xterm"sv, "PAGER=more"sv, "PATH="sv DEFAULT_PATH_SV })); + auto env = TRY(FixedArray::create({ "TERM=xterm"sv, "PAGER=more"sv, "PATH="sv DEFAULT_PATH_SV })); TRY(Core::System::exec(shell, arguments, Core::System::SearchInPath::No, env.span())); VERIFY_NOT_REACHED(); } diff --git a/Userland/Demos/Tubes/Tubes.cpp b/Userland/Demos/Tubes/Tubes.cpp index 8fa6680dbe2..e3cc9273e1a 100644 --- a/Userland/Demos/Tubes/Tubes.cpp +++ b/Userland/Demos/Tubes/Tubes.cpp @@ -75,7 +75,7 @@ static IntVector3 vector_for_direction(Direction direction) } Tubes::Tubes(int interval) - : m_grid(MUST(FixedArray::try_create(grid_resolution * grid_resolution * grid_resolution))) + : m_grid(MUST(FixedArray::create(grid_resolution * grid_resolution * grid_resolution))) { on_screensaver_exit = []() { GUI::Application::the()->quit(); }; start_timer(interval); diff --git a/Userland/Libraries/LibAudio/ConnectionToServer.h b/Userland/Libraries/LibAudio/ConnectionToServer.h index bd63e226a1c..c98ecb973e7 100644 --- a/Userland/Libraries/LibAudio/ConnectionToServer.h +++ b/Userland/Libraries/LibAudio/ConnectionToServer.h @@ -36,7 +36,7 @@ public: template Samples> ErrorOr async_enqueue(Samples&& samples) { - return async_enqueue(TRY(FixedArray::try_create(samples.span()))); + return async_enqueue(TRY(FixedArray::create(samples.span()))); } ErrorOr async_enqueue(FixedArray&& samples); diff --git a/Userland/Libraries/LibAudio/MP3Loader.cpp b/Userland/Libraries/LibAudio/MP3Loader.cpp index dd60f5cca9c..5f972b1540c 100644 --- a/Userland/Libraries/LibAudio/MP3Loader.cpp +++ b/Userland/Libraries/LibAudio/MP3Loader.cpp @@ -91,7 +91,7 @@ MaybeLoaderError MP3LoaderPlugin::seek(int const position) LoaderSamples MP3LoaderPlugin::get_more_samples(size_t max_samples_to_read_from_input) { - FixedArray samples = LOADER_TRY(FixedArray::try_create(max_samples_to_read_from_input)); + FixedArray samples = LOADER_TRY(FixedArray::create(max_samples_to_read_from_input)); size_t samples_to_read = max_samples_to_read_from_input; while (samples_to_read > 0) { diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp index be382c92746..746d6b5529d 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -114,7 +114,7 @@ static ErrorOr read_sample(Core::Stream::Stream& stream) LoaderSamples WavLoaderPlugin::samples_from_pcm_data(Bytes const& data, size_t samples_to_read) const { - FixedArray samples = LOADER_TRY(FixedArray::try_create(samples_to_read)); + FixedArray samples = LOADER_TRY(FixedArray::create(samples_to_read)); auto stream = LOADER_TRY(Core::Stream::FixedMemoryStream::construct(move(data))); switch (m_sample_format) { diff --git a/Userland/Libraries/LibCompress/Brotli.h b/Userland/Libraries/LibCompress/Brotli.h index 9daef3d9220..879a66a3e61 100644 --- a/Userland/Libraries/LibCompress/Brotli.h +++ b/Userland/Libraries/LibCompress/Brotli.h @@ -67,7 +67,7 @@ public: public: static ErrorOr try_create(size_t size) { - auto buffer = TRY(FixedArray::try_create(size)); + auto buffer = TRY(FixedArray::create(size)); return LookbackBuffer { buffer }; } diff --git a/Userland/Libraries/LibCore/MemoryStream.cpp b/Userland/Libraries/LibCore/MemoryStream.cpp index 1d4d0361862..09241ba63c3 100644 --- a/Userland/Libraries/LibCore/MemoryStream.cpp +++ b/Userland/Libraries/LibCore/MemoryStream.cpp @@ -212,7 +212,7 @@ ErrorOr> AllocatingMemoryStream::offset_of(ReadonlyBytes needle VERIFY(m_chunks.size() * chunk_size - m_write_offset < chunk_size); auto chunk_count = m_chunks.size(); - auto search_spans = TRY(FixedArray::try_create(chunk_count)); + auto search_spans = TRY(FixedArray::create(chunk_count)); for (size_t i = 0; i < chunk_count; i++) { search_spans[i] = m_chunks[i].span(); diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 99e8cb66c46..512a4db08ff 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -1118,7 +1118,7 @@ ErrorOr exec(StringView filename, Span arguments, SearchInPath #ifdef AK_OS_SERENITY Syscall::SC_execve_params params; - auto argument_strings = TRY(FixedArray::try_create(arguments.size())); + auto argument_strings = TRY(FixedArray::create(arguments.size())); for (size_t i = 0; i < arguments.size(); ++i) { argument_strings[i] = { arguments[i].characters_without_null_termination(), arguments[i].length() }; } @@ -1133,7 +1133,7 @@ ErrorOr exec(StringView filename, Span arguments, SearchInPath ++env_count; } - auto environment_strings = TRY(FixedArray::try_create(env_count)); + auto environment_strings = TRY(FixedArray::create(env_count)); if (environment.has_value()) { for (size_t i = 0; i < env_count; ++i) { environment_strings[i] = { environment->at(i).characters_without_null_termination(), environment->at(i).length() }; @@ -1172,8 +1172,8 @@ ErrorOr exec(StringView filename, Span arguments, SearchInPath #else DeprecatedString filename_string { filename }; - auto argument_strings = TRY(FixedArray::try_create(arguments.size())); - auto argv = TRY(FixedArray::try_create(arguments.size() + 1)); + auto argument_strings = TRY(FixedArray::create(arguments.size())); + auto argv = TRY(FixedArray::create(arguments.size() + 1)); for (size_t i = 0; i < arguments.size(); ++i) { argument_strings[i] = arguments[i].to_deprecated_string(); argv[i] = const_cast(argument_strings[i].characters()); @@ -1182,8 +1182,8 @@ ErrorOr exec(StringView filename, Span arguments, SearchInPath int rc = 0; if (environment.has_value()) { - auto environment_strings = TRY(FixedArray::try_create(environment->size())); - auto envp = TRY(FixedArray::try_create(environment->size() + 1)); + auto environment_strings = TRY(FixedArray::create(environment->size())); + auto envp = TRY(FixedArray::create(environment->size() + 1)); for (size_t i = 0; i < environment->size(); ++i) { environment_strings[i] = environment->at(i).to_deprecated_string(); envp[i] = const_cast(environment_strings[i].characters()); diff --git a/Userland/Libraries/LibDSP/Track.cpp b/Userland/Libraries/LibDSP/Track.cpp index aa80b88b001..557db34d521 100644 --- a/Userland/Libraries/LibDSP/Track.cpp +++ b/Userland/Libraries/LibDSP/Track.cpp @@ -63,7 +63,7 @@ bool NoteTrack::check_processor_chain_valid() const ErrorOr Track::resize_internal_buffers_to(size_t buffer_size) { - m_secondary_sample_buffer = TRY(FixedArray::try_create(buffer_size)); + m_secondary_sample_buffer = TRY(FixedArray::create(buffer_size)); return {}; } diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp index eb5dbf44e64..b203c94ae45 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp @@ -180,7 +180,7 @@ ErrorOr Kern::from_slice(ReadonlyBytes slice) return Error::from_string_literal("Kern table does not contain any subtables"); // Read all subtable offsets - auto subtable_offsets = TRY(FixedArray::try_create(number_of_subtables)); + auto subtable_offsets = TRY(FixedArray::create(number_of_subtables)); size_t offset = sizeof(Header); for (size_t i = 0; i < number_of_subtables; ++i) { if (slice.size() < offset + sizeof(SubtableHeader)) diff --git a/Userland/Libraries/LibGfx/PNGWriter.cpp b/Userland/Libraries/LibGfx/PNGWriter.cpp index 6291c0dc89d..4e6fd7d2aef 100644 --- a/Userland/Libraries/LibGfx/PNGWriter.cpp +++ b/Userland/Libraries/LibGfx/PNGWriter.cpp @@ -175,7 +175,7 @@ ErrorOr PNGWriter::add_IDAT_chunk(Gfx::Bitmap const& bitmap) ByteBuffer uncompressed_block_data; TRY(uncompressed_block_data.try_ensure_capacity(bitmap.size_in_bytes() + bitmap.height())); - auto dummy_scanline = TRY(FixedArray::try_create(bitmap.width())); + auto dummy_scanline = TRY(FixedArray::create(bitmap.width())); auto const* scanline_minus_1 = dummy_scanline.data(); for (int y = 0; y < bitmap.height(); ++y) { diff --git a/Userland/Libraries/LibSoftGPU/Buffer/Typed3DBuffer.h b/Userland/Libraries/LibSoftGPU/Buffer/Typed3DBuffer.h index 567ffdd6ad7..c6aebd9e58d 100644 --- a/Userland/Libraries/LibSoftGPU/Buffer/Typed3DBuffer.h +++ b/Userland/Libraries/LibSoftGPU/Buffer/Typed3DBuffer.h @@ -25,7 +25,7 @@ public: static ErrorOr>> try_create(int width, int height, int depth) { VERIFY(width > 0 && height > 0 && depth > 0); - auto data = TRY(FixedArray::try_create(width * height * depth)); + auto data = TRY(FixedArray::create(width * height * depth)); return adopt_ref(*new Typed3DBuffer(width, height, depth, move(data))); } diff --git a/Userland/Libraries/LibVideo/VP9/Context.h b/Userland/Libraries/LibVideo/VP9/Context.h index f4b5871853e..a86c621fdab 100644 --- a/Userland/Libraries/LibVideo/VP9/Context.h +++ b/Userland/Libraries/LibVideo/VP9/Context.h @@ -143,9 +143,9 @@ private: static ErrorOr create_non_zero_tokens(u32 size_in_sub_blocks, bool subsampling) { return NonZeroTokens { - TRY(FixedArray::try_create(size_in_sub_blocks)), - TRY(FixedArray::try_create(size_in_sub_blocks >>= subsampling)), - TRY(FixedArray::try_create(size_in_sub_blocks)), + TRY(FixedArray::create(size_in_sub_blocks)), + TRY(FixedArray::create(size_in_sub_blocks >>= subsampling)), + TRY(FixedArray::create(size_in_sub_blocks)), }; } @@ -191,9 +191,9 @@ public: above_partition_context, above_non_zero_tokens, above_segmentation_ids, - TRY(PartitionContext::try_create(superblocks_to_blocks(blocks_ceiled_to_superblocks(height)))), + TRY(PartitionContext::create(superblocks_to_blocks(blocks_ceiled_to_superblocks(height)))), TRY(create_non_zero_tokens(blocks_to_sub_blocks(height), frame_context.color_config.subsampling_y)), - TRY(SegmentationPredictionContext::try_create(height)), + TRY(SegmentationPredictionContext::create(height)), }; } diff --git a/Userland/Libraries/LibVideo/VP9/Decoder.cpp b/Userland/Libraries/LibVideo/VP9/Decoder.cpp index 3212b752b76..4aec4df7b8c 100644 --- a/Userland/Libraries/LibVideo/VP9/Decoder.cpp +++ b/Userland/Libraries/LibVideo/VP9/Decoder.cpp @@ -153,9 +153,9 @@ DecoderErrorOr Decoder::create_video_frame(FrameContext const& frame_conte output_y_size.height() >> frame_context.color_config.subsampling_y, }; Array, 3> output_buffers = { - DECODER_TRY_ALLOC(FixedArray::try_create(output_y_size.width() * output_y_size.height())), - DECODER_TRY_ALLOC(FixedArray::try_create(output_uv_size.width() * output_uv_size.height())), - DECODER_TRY_ALLOC(FixedArray::try_create(output_uv_size.width() * output_uv_size.height())), + DECODER_TRY_ALLOC(FixedArray::create(output_y_size.width() * output_y_size.height())), + DECODER_TRY_ALLOC(FixedArray::create(output_uv_size.width() * output_uv_size.height())), + DECODER_TRY_ALLOC(FixedArray::create(output_uv_size.width() * output_uv_size.height())), }; for (u8 plane = 0; plane < 3; plane++) { auto& buffer = output_buffers[plane]; diff --git a/Userland/Libraries/LibVideo/VP9/Parser.cpp b/Userland/Libraries/LibVideo/VP9/Parser.cpp index b7a584a38f1..77854b0e0dd 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.cpp +++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp @@ -858,9 +858,9 @@ DecoderErrorOr Parser::decode_tiles(FrameContext& frame_context) auto tile_cols = 1 << log2_dimensions.width(); auto tile_rows = 1 << log2_dimensions.height(); - PartitionContext above_partition_context = DECODER_TRY_ALLOC(PartitionContext::try_create(superblocks_to_blocks(frame_context.superblock_columns()))); + PartitionContext above_partition_context = DECODER_TRY_ALLOC(PartitionContext::create(superblocks_to_blocks(frame_context.superblock_columns()))); NonZeroTokens above_non_zero_tokens = DECODER_TRY_ALLOC(create_non_zero_tokens(blocks_to_sub_blocks(frame_context.columns()), frame_context.color_config.subsampling_x)); - SegmentationPredictionContext above_segmentation_ids = DECODER_TRY_ALLOC(SegmentationPredictionContext::try_create(frame_context.columns())); + SegmentationPredictionContext above_segmentation_ids = DECODER_TRY_ALLOC(SegmentationPredictionContext::create(frame_context.columns())); // FIXME: To implement tiled decoding, we'll need to pre-parse the tile positions and sizes into a 2D vector of ReadonlyBytes, // then run through each column of tiles in top to bottom order afterward. Each column can be sent to a worker thread diff --git a/Userland/Libraries/LibVideo/VideoFrame.cpp b/Userland/Libraries/LibVideo/VideoFrame.cpp index 718bb66fc31..e8ee01d2ce2 100644 --- a/Userland/Libraries/LibVideo/VideoFrame.cpp +++ b/Userland/Libraries/LibVideo/VideoFrame.cpp @@ -18,9 +18,9 @@ ErrorOr> SubsampledYUVFrame::try_create( bool subsampling_horizontal, bool subsampling_vertical, Span plane_y, Span plane_u, Span plane_v) { - auto plane_y_array = TRY(FixedArray::try_create(plane_y)); - auto plane_u_array = TRY(FixedArray::try_create(plane_u)); - auto plane_v_array = TRY(FixedArray::try_create(plane_v)); + auto plane_y_array = TRY(FixedArray::create(plane_y)); + auto plane_u_array = TRY(FixedArray::create(plane_u)); + auto plane_v_array = TRY(FixedArray::create(plane_v)); return adopt_nonnull_own_or_enomem(new (nothrow) SubsampledYUVFrame(size, bit_depth, cicp, subsampling_horizontal, subsampling_vertical, plane_y_array, plane_u_array, plane_v_array)); } @@ -28,8 +28,8 @@ DecoderErrorOr SubsampledYUVFrame::output_to_bitmap(Gfx::Bitmap& bitmap) { size_t width = this->width(); size_t height = this->height(); - auto u_sample_row = DECODER_TRY_ALLOC(FixedArray::try_create(width)); - auto v_sample_row = DECODER_TRY_ALLOC(FixedArray::try_create(width)); + auto u_sample_row = DECODER_TRY_ALLOC(FixedArray::create(width)); + auto v_sample_row = DECODER_TRY_ALLOC(FixedArray::create(width)); size_t uv_width = width >> m_subsampling_horizontal; auto converter = TRY(ColorConverter::create(bit_depth(), cicp()));