From ab62dd241e162223c375a8d3f00b1d9100e0673d Mon Sep 17 00:00:00 2001 From: pjljvandelaar Date: Wed, 30 Nov 2022 09:44:18 +0100 Subject: [PATCH] Improve readability of code by using if expression --- src/audio-wavefiles-write.adb | 11 +++++------ src/audio-wavefiles.adb | 21 ++++++--------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/audio-wavefiles-write.adb b/src/audio-wavefiles-write.adb index 1783f5a..bf19de7 100644 --- a/src/audio-wavefiles-write.adb +++ b/src/audio-wavefiles-write.adb @@ -85,12 +85,11 @@ package body Audio.Wavefiles.Write is function Chunk_Size (Format_Size : Unsigned_16) return Unsigned_32 is begin - if Format_Size = 0 then - return Wave_Format_Chunk_Size'Enum_Rep (Wave_Format_18_Size); - else - return Wave_Format_Chunk_Size'Enum_Rep - (Wave_Format_Extensible_Size); - end if; + return + (if Format_Size = 0 then + Wave_Format_Chunk_Size'Enum_Rep (Wave_Format_18_Size) + else Wave_Format_Chunk_Size'Enum_Rep + (Wave_Format_Extensible_Size)); end Chunk_Size; ----------------- diff --git a/src/audio-wavefiles.adb b/src/audio-wavefiles.adb index a5e4fc0..8f4201d 100644 --- a/src/audio-wavefiles.adb +++ b/src/audio-wavefiles.adb @@ -206,13 +206,9 @@ package body Audio.Wavefiles is (WF : in out Wavefile) return Boolean is begin - if End_Of_File (WF.Sample_Pos) or - Ada.Streams.Stream_IO.End_Of_File (WF.File) - then - return True; - else - return False; - end if; + return + End_Of_File (WF.Sample_Pos) or + Ada.Streams.Stream_IO.End_Of_File (WF.File); end End_Of_File; ----------- @@ -304,14 +300,9 @@ package body Audio.Wavefiles is function Is_Supported_Format (W : Wave_Format_Extensible) return Boolean is begin - if not (W.Sub_Format = GUID_Undefined - or W.Sub_Format = GUID_PCM - or W.Sub_Format = GUID_IEEE_Float) - then - return False; - end if; - - return True; + return + W.Sub_Format = GUID_Undefined or W.Sub_Format = GUID_PCM or + W.Sub_Format = GUID_IEEE_Float; end Is_Supported_Format; -------------------