Skip to content

Commit 4ebe589

Browse files
authored
Tidy up use of FFI and custom types. (#65)
* Tidy up use of types. * Remove stray meta call for yard doc.
1 parent b5664c0 commit 4ebe589

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

lib/h3/bindings/base.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ def self.extended(base)
1212
base.include Types
1313
base.ffi_lib ["#{lib_path}/libh3.dylib", "#{lib_path}/libh3.so"]
1414
base.typedef :ulong_long, :h3_index
15-
base.typedef :int, :size
1615
base.typedef :int, :k_distance
17-
base.typedef :pointer, :h3_set
18-
base.typedef :pointer, :output_buffer
19-
base.const_set("H3_INDEX", :ulong_long)
2016
end
2117

2218
def attach_predicate_function(name, *args)

lib/h3/bindings/private.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ module Bindings
77
module Private
88
extend H3::Bindings::Base
99

10-
attach_function :compact, [H3IndexesIn, H3IndexesOut, :size], :bool
10+
attach_function :compact, [H3IndexesIn, H3IndexesOut, :size_t], :bool
1111
attach_function :destroy_linked_polygon, :destroyLinkedPolygon, [LinkedGeoPolygon], :void
1212
attach_function :geo_to_h3, :geoToH3, [GeoCoord, Resolution], :h3_index
1313
attach_function :get_pentagon_indexes, :getPentagonIndexes, [:int, H3IndexesOut], :void
14-
attach_function :h3_faces, :h3GetFaces, %i[h3_index output_buffer], :void
14+
attach_function :h3_faces, :h3GetFaces, %i[h3_index buffer_out], :void
1515
attach_function :h3_indexes_from_unidirectional_edge,
1616
:getH3IndexesFromUnidirectionalEdge,
1717
[:h3_index, H3IndexesOut], :void
@@ -21,11 +21,11 @@ module Private
2121
[:h3_index, H3IndexesOut], :void
2222
attach_function :h3_set_to_linked_geo,
2323
:h3SetToLinkedGeo,
24-
[H3IndexesIn, :size, LinkedGeoPolygon],
24+
[H3IndexesIn, :size_t, LinkedGeoPolygon],
2525
:void
2626
attach_function :h3_to_children, :h3ToChildren, [:h3_index, Resolution, H3IndexesOut], :void
2727
attach_function :h3_to_geo, :h3ToGeo, [:h3_index, GeoCoord], :void
28-
attach_function :h3_to_string, :h3ToString, %i[h3_index output_buffer size], :void
28+
attach_function :h3_to_string, :h3ToString, %i[h3_index buffer_out size_t], :void
2929
attach_function :h3_to_geo_boundary,
3030
:h3ToGeoBoundary,
3131
[:h3_index, GeoBoundary],
@@ -36,25 +36,25 @@ module Private
3636
attach_function :hex_range, :hexRange, [:h3_index, :k_distance, H3IndexesOut], :bool
3737
attach_function :hex_range_distances,
3838
:hexRangeDistances,
39-
[:h3_index, :k_distance, H3IndexesOut, :output_buffer], :bool
39+
[:h3_index, :k_distance, H3IndexesOut, :buffer_out], :bool
4040
attach_function :hex_ranges,
4141
:hexRanges,
42-
[H3IndexesIn, :size, :k_distance, H3IndexesOut],
42+
[H3IndexesIn, :size_t, :k_distance, H3IndexesOut],
4343
:bool
4444
attach_function :hex_ring, :hexRing, [:h3_index, :k_distance, H3IndexesOut], :bool
4545
attach_function :k_ring, :kRing, [:h3_index, :k_distance, H3IndexesOut], :void
4646
attach_function :k_ring_distances,
4747
:kRingDistances,
48-
[:h3_index, :k_distance, H3IndexesOut, :output_buffer],
48+
[:h3_index, :k_distance, H3IndexesOut, :buffer_out],
4949
:bool
5050
attach_function :max_polyfill_size,
5151
:maxPolyfillSize,
5252
[GeoPolygon, Resolution],
5353
:int
54-
attach_function :max_uncompact_size, :maxUncompactSize, [H3IndexesIn, :size, Resolution], :int
54+
attach_function :max_uncompact_size, :maxUncompactSize, [H3IndexesIn, :size_t, Resolution], :int
5555
attach_function :polyfill, [GeoPolygon, Resolution, H3IndexesOut], :void
5656
attach_function :res_0_indexes, :getRes0Indexes, [H3IndexesOut], :void
57-
attach_function :uncompact, [H3IndexesIn, :size, H3IndexesOut, :size, Resolution], :bool
57+
attach_function :uncompact, [H3IndexesIn, :size_t, H3IndexesOut, :size_t, Resolution], :bool
5858
end
5959
end
6060
end

lib/h3/inspection.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ def h3_to_string(h3_index)
157157
# @return [Integer] Maximum possible number of faces
158158
attach_function :max_face_count, :maxFaceCount, %i[h3_index], :int
159159

160-
# @!method faces(h3_index)
161-
#
162160
# Find all icosahedron faces intersected by a given H3 index.
163161
#
164162
# @param [Integer] h3_index A H3 index.

0 commit comments

Comments
 (0)