Skip to content

Commit

Permalink
Make sure to create proper types
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed Dec 23, 2023
1 parent 0e16f76 commit f435198
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/gphoto2/camera_widgets/date.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module GPhoto2
protected def set_value(value)
case value
when Time
ptr = Pointer(LibC::Int).malloc 1, value.to_unix.to_i32
ptr = Pointer(LibC::Int).malloc 1, LibC::Int.new(value.to_unix.to_i32)
set_value_ptr ptr
when Int
set_value Time.unix(value)
Expand Down
2 changes: 1 addition & 1 deletion src/gphoto2/camera_widgets/range.cr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module GPhoto2
protected def set_value(value)
case value
when Float
ptr = Pointer(LibC::Float).malloc 1, value.to_f32
ptr = Pointer(LibC::Float).malloc 1, LibC::Float.new(value.to_f32)
set_value_ptr ptr
when Int, String
set_value value.to_f32
Expand Down
2 changes: 1 addition & 1 deletion src/gphoto2/camera_widgets/toggle.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module GPhoto2
protected def set_value(value)
case value
when Int
ptr = Pointer(LibC::Int).malloc 1, value.to_i32
ptr = Pointer(LibC::Int).malloc 1, LibC::Int.new(value.to_i32)
set_value_ptr ptr
when Bool
set_value value ? 1 : 0
Expand Down

0 comments on commit f435198

Please sign in to comment.