diff options
author | Linus Groh <mail@linusgroh.de> | 2023-01-28 20:12:17 +0000 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-01-28 22:41:36 +0100 |
commit | 9c08bb95553539d1880a5ac81ba5608d4ad874de (patch) | |
tree | e3774fe4f7ce021b9331ddbac3846e62e25778a6 /Userland/Libraries | |
parent | 909c2a73c4aa2359e3670b7e93d9a5051ba3881e (diff) | |
download | serenity-9c08bb95553539d1880a5ac81ba5608d4ad874de.zip |
AK: Remove `try_` prefix from FixedArray creation functions
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibAudio/ConnectionToServer.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibAudio/MP3Loader.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibAudio/WavLoader.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCompress/Brotli.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/MemoryStream.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/System.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibDSP/Track.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Font/OpenType/Font.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/PNGWriter.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibSoftGPU/Buffer/Typed3DBuffer.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Context.h | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Decoder.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibVideo/VP9/Parser.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibVideo/VideoFrame.cpp | 10 |
14 files changed, 30 insertions, 30 deletions
diff --git a/Userland/Libraries/LibAudio/ConnectionToServer.h b/Userland/Libraries/LibAudio/ConnectionToServer.h index bd63e226a1..c98ecb973e 100644 --- a/Userland/Libraries/LibAudio/ConnectionToServer.h +++ b/Userland/Libraries/LibAudio/ConnectionToServer.h @@ -36,7 +36,7 @@ public: template<ArrayLike<Sample> Samples> ErrorOr<void> async_enqueue(Samples&& samples) { - return async_enqueue(TRY(FixedArray<Sample>::try_create(samples.span()))); + return async_enqueue(TRY(FixedArray<Sample>::create(samples.span()))); } ErrorOr<void> async_enqueue(FixedArray<Sample>&& samples); diff --git a/Userland/Libraries/LibAudio/MP3Loader.cpp b/Userland/Libraries/LibAudio/MP3Loader.cpp index dd60f5cca9..5f972b1540 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<Sample> samples = LOADER_TRY(FixedArray<Sample>::try_create(max_samples_to_read_from_input)); + FixedArray<Sample> samples = LOADER_TRY(FixedArray<Sample>::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 be382c9274..746d6b5529 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -114,7 +114,7 @@ static ErrorOr<double> read_sample(Core::Stream::Stream& stream) LoaderSamples WavLoaderPlugin::samples_from_pcm_data(Bytes const& data, size_t samples_to_read) const { - FixedArray<Sample> samples = LOADER_TRY(FixedArray<Sample>::try_create(samples_to_read)); + FixedArray<Sample> samples = LOADER_TRY(FixedArray<Sample>::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 9daef3d922..879a66a3e6 100644 --- a/Userland/Libraries/LibCompress/Brotli.h +++ b/Userland/Libraries/LibCompress/Brotli.h @@ -67,7 +67,7 @@ public: public: static ErrorOr<LookbackBuffer> try_create(size_t size) { - auto buffer = TRY(FixedArray<u8>::try_create(size)); + auto buffer = TRY(FixedArray<u8>::create(size)); return LookbackBuffer { buffer }; } diff --git a/Userland/Libraries/LibCore/MemoryStream.cpp b/Userland/Libraries/LibCore/MemoryStream.cpp index 1d4d036186..09241ba63c 100644 --- a/Userland/Libraries/LibCore/MemoryStream.cpp +++ b/Userland/Libraries/LibCore/MemoryStream.cpp @@ -212,7 +212,7 @@ ErrorOr<Optional<size_t>> 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<ReadonlyBytes>::try_create(chunk_count)); + auto search_spans = TRY(FixedArray<ReadonlyBytes>::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 99e8cb66c4..512a4db08f 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -1118,7 +1118,7 @@ ErrorOr<void> exec(StringView filename, Span<StringView> arguments, SearchInPath #ifdef AK_OS_SERENITY Syscall::SC_execve_params params; - auto argument_strings = TRY(FixedArray<Syscall::StringArgument>::try_create(arguments.size())); + auto argument_strings = TRY(FixedArray<Syscall::StringArgument>::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<void> exec(StringView filename, Span<StringView> arguments, SearchInPath ++env_count; } - auto environment_strings = TRY(FixedArray<Syscall::StringArgument>::try_create(env_count)); + auto environment_strings = TRY(FixedArray<Syscall::StringArgument>::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<void> exec(StringView filename, Span<StringView> arguments, SearchInPath #else DeprecatedString filename_string { filename }; - auto argument_strings = TRY(FixedArray<DeprecatedString>::try_create(arguments.size())); - auto argv = TRY(FixedArray<char*>::try_create(arguments.size() + 1)); + auto argument_strings = TRY(FixedArray<DeprecatedString>::create(arguments.size())); + auto argv = TRY(FixedArray<char*>::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<char*>(argument_strings[i].characters()); @@ -1182,8 +1182,8 @@ ErrorOr<void> exec(StringView filename, Span<StringView> arguments, SearchInPath int rc = 0; if (environment.has_value()) { - auto environment_strings = TRY(FixedArray<DeprecatedString>::try_create(environment->size())); - auto envp = TRY(FixedArray<char*>::try_create(environment->size() + 1)); + auto environment_strings = TRY(FixedArray<DeprecatedString>::create(environment->size())); + auto envp = TRY(FixedArray<char*>::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<char*>(environment_strings[i].characters()); diff --git a/Userland/Libraries/LibDSP/Track.cpp b/Userland/Libraries/LibDSP/Track.cpp index aa80b88b00..557db34d52 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<void> Track::resize_internal_buffers_to(size_t buffer_size) { - m_secondary_sample_buffer = TRY(FixedArray<Sample>::try_create(buffer_size)); + m_secondary_sample_buffer = TRY(FixedArray<Sample>::create(buffer_size)); return {}; } diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp index eb5dbf44e6..b203c94ae4 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp @@ -180,7 +180,7 @@ ErrorOr<Kern> 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<size_t>::try_create(number_of_subtables)); + auto subtable_offsets = TRY(FixedArray<size_t>::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 6291c0dc89..4e6fd7d2ae 100644 --- a/Userland/Libraries/LibGfx/PNGWriter.cpp +++ b/Userland/Libraries/LibGfx/PNGWriter.cpp @@ -175,7 +175,7 @@ ErrorOr<void> 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<Pixel>::try_create(bitmap.width())); + auto dummy_scanline = TRY(FixedArray<Pixel>::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 567ffdd6ad..c6aebd9e58 100644 --- a/Userland/Libraries/LibSoftGPU/Buffer/Typed3DBuffer.h +++ b/Userland/Libraries/LibSoftGPU/Buffer/Typed3DBuffer.h @@ -25,7 +25,7 @@ public: static ErrorOr<NonnullRefPtr<Typed3DBuffer<T>>> try_create(int width, int height, int depth) { VERIFY(width > 0 && height > 0 && depth > 0); - auto data = TRY(FixedArray<T>::try_create(width * height * depth)); + auto data = TRY(FixedArray<T>::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 f4b5871853..a86c621fda 100644 --- a/Userland/Libraries/LibVideo/VP9/Context.h +++ b/Userland/Libraries/LibVideo/VP9/Context.h @@ -143,9 +143,9 @@ private: static ErrorOr<NonZeroTokens> create_non_zero_tokens(u32 size_in_sub_blocks, bool subsampling) { return NonZeroTokens { - TRY(FixedArray<bool>::try_create(size_in_sub_blocks)), - TRY(FixedArray<bool>::try_create(size_in_sub_blocks >>= subsampling)), - TRY(FixedArray<bool>::try_create(size_in_sub_blocks)), + TRY(FixedArray<bool>::create(size_in_sub_blocks)), + TRY(FixedArray<bool>::create(size_in_sub_blocks >>= subsampling)), + TRY(FixedArray<bool>::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 3212b752b7..4aec4df7b8 100644 --- a/Userland/Libraries/LibVideo/VP9/Decoder.cpp +++ b/Userland/Libraries/LibVideo/VP9/Decoder.cpp @@ -153,9 +153,9 @@ DecoderErrorOr<void> Decoder::create_video_frame(FrameContext const& frame_conte output_y_size.height() >> frame_context.color_config.subsampling_y, }; Array<FixedArray<u16>, 3> output_buffers = { - DECODER_TRY_ALLOC(FixedArray<u16>::try_create(output_y_size.width() * output_y_size.height())), - DECODER_TRY_ALLOC(FixedArray<u16>::try_create(output_uv_size.width() * output_uv_size.height())), - DECODER_TRY_ALLOC(FixedArray<u16>::try_create(output_uv_size.width() * output_uv_size.height())), + DECODER_TRY_ALLOC(FixedArray<u16>::create(output_y_size.width() * output_y_size.height())), + DECODER_TRY_ALLOC(FixedArray<u16>::create(output_uv_size.width() * output_uv_size.height())), + DECODER_TRY_ALLOC(FixedArray<u16>::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 b7a584a38f..77854b0e0d 100644 --- a/Userland/Libraries/LibVideo/VP9/Parser.cpp +++ b/Userland/Libraries/LibVideo/VP9/Parser.cpp @@ -858,9 +858,9 @@ DecoderErrorOr<void> 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 718bb66fc3..e8ee01d2ce 100644 --- a/Userland/Libraries/LibVideo/VideoFrame.cpp +++ b/Userland/Libraries/LibVideo/VideoFrame.cpp @@ -18,9 +18,9 @@ ErrorOr<NonnullOwnPtr<SubsampledYUVFrame>> SubsampledYUVFrame::try_create( bool subsampling_horizontal, bool subsampling_vertical, Span<u16> plane_y, Span<u16> plane_u, Span<u16> plane_v) { - auto plane_y_array = TRY(FixedArray<u16>::try_create(plane_y)); - auto plane_u_array = TRY(FixedArray<u16>::try_create(plane_u)); - auto plane_v_array = TRY(FixedArray<u16>::try_create(plane_v)); + auto plane_y_array = TRY(FixedArray<u16>::create(plane_y)); + auto plane_u_array = TRY(FixedArray<u16>::create(plane_u)); + auto plane_v_array = TRY(FixedArray<u16>::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<void> 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<u16>::try_create(width)); - auto v_sample_row = DECODER_TRY_ALLOC(FixedArray<u16>::try_create(width)); + auto u_sample_row = DECODER_TRY_ALLOC(FixedArray<u16>::create(width)); + auto v_sample_row = DECODER_TRY_ALLOC(FixedArray<u16>::create(width)); size_t uv_width = width >> m_subsampling_horizontal; auto converter = TRY(ColorConverter::create(bit_depth(), cicp())); |