diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-09 23:53:32 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-09 23:53:32 +1300 |
commit | 53aa8144851913994b963ed611cca8885b8f9a9e (patch) | |
tree | 1b2a262cedb353b4aff00e14b200918ac17b11ab /src/fltk-file_choosers.adb | |
parent | 17473af7e8ed13e0a9399a69442f9839e5d83aef (diff) |
Internal_FLTK_Error raises are now pragma Asserts
Diffstat (limited to 'src/fltk-file_choosers.adb')
-rw-r--r-- | src/fltk-file_choosers.adb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/fltk-file_choosers.adb b/src/fltk-file_choosers.adb index 07c10b1..d413f15 100644 --- a/src/fltk-file_choosers.adb +++ b/src/fltk-file_choosers.adb @@ -6,6 +6,7 @@ with + Ada.Assertions, Interfaces.C.Strings, System.Address_To_Access_Conversions; @@ -18,6 +19,8 @@ use type package body FLTK.File_Choosers is + package Chk renames Ada.Assertions; + package File_Chooser_Convert is new System.Address_To_Access_Conversions (File_Chooser'Class); package Widget_Convert is new System.Address_To_Access_Conversions (Widgets.Widget'Class); @@ -1038,11 +1041,10 @@ package body FLTK.File_Choosers is is Ret : Interfaces.C.int := fl_file_chooser_get_preview (This.Void_Ptr); begin - if Ret not in 0 .. 1 then - raise Internal_FLTK_Error; - else - return Boolean'Val (Ret); - end if; + pragma Assert (Ret in 0 .. 1); + return Boolean'Val (Ret); + exception + when Chk.Assertion_Error => raise Internal_FLTK_Error; end Has_Preview; @@ -1108,11 +1110,10 @@ package body FLTK.File_Choosers is is Ret : Interfaces.C.int := fl_file_chooser_get_type (This.Void_Ptr); begin - if Ret not in 0 .. Chooser_Kind'Pos (Chooser_Kind'Last) then - raise Internal_FLTK_Error; - else - return Chooser_Kind'Val (Ret); - end if; + pragma Assert (Ret in 0 .. Chooser_Kind'Pos (Chooser_Kind'Last)); + return Chooser_Kind'Val (Ret); + exception + when Chk.Assertion_Error => raise Internal_FLTK_Error; end Get_Chooser_Kind; |