librtree 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a28182f3e87b5fb00cbf5efea523d8c43bd02ed774261998b8d5b31ee6c90c0
4
- data.tar.gz: 4fa0cd3c75e9bd942aca77085aed0f033bb3de7ef57cca79a742a43458207070
3
+ metadata.gz: 8f4355feb78dc5d06882ae60a9dccaa1a3aa3946e3bafd36c83bd156e0c75999
4
+ data.tar.gz: 2ba67193b74dffcc28c692651395378a07396815b8183622cf53e99ae85b0161
5
5
  SHA512:
6
- metadata.gz: 947f0fcb19e4a7882b2e9d3bafdb4f4d20a85bbdd2d3e8e7245e584d2381400ac77d19f0a81b12e5b85c5cbcf36a52e7c7a948c320e6482af7ec4b01c32508d3
7
- data.tar.gz: c0025ab24f0c93095e46d36a74bab89254a498c5da02928aa5341b80c94d362f30cca6677172cd5fc26f988291ce25b053552f3fbc123cc727a0db31c6efb660
6
+ metadata.gz: '070128ec3f09d7e7d9afdd72a1a1c883aa4acabde300b3a6093a5437a8c95b0a0d527339b48930f048f8925d10ef2d9aff34604bfe8e8c9545327b9082fdb584'
7
+ data.tar.gz: 9958de3a7289de82051876d54968e48cb1350d15e20257e87ce162875dbdabf9ea12501cc9502b345ff10a470248275682ed78f906c211aa2e14acda3446d027
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  ---------
3
3
 
4
+ ### 1.0.8, 12-10-2026
5
+
6
+ - Update to librtree 1.3.3
7
+
4
8
  ### 1.0.7, 20-01-2026
5
9
 
6
10
  - Spelling
data/README.md CHANGED
@@ -54,12 +54,12 @@ this.
54
54
  If using [rbenv][4], then first set a local version of Ruby to use,
55
55
  then install the gems into your local cache
56
56
 
57
- rbenv local 3.2.0
57
+ rbenv local 4.0.2
58
58
  bundle install
59
59
 
60
60
  The repository's `.gitignore` ignores **rbenv**'s `.ruby-version` file,
61
61
  since we don't want to mandate a particular Ruby version for the package
62
- (although 3.0 is the minimal version for development at present).
62
+ (although 3.1 is the minimal version for development at present).
63
63
 
64
64
  If not using **rbenv** then just
65
65
 
@@ -70,7 +70,7 @@ static size_t first_unset(const unsigned long *words, size_t n_bits)
70
70
 
71
71
  for (size_t j = 0 ; j < n_words ; j++)
72
72
  {
73
- unsigned long word = ~words[j];
73
+ unsigned long word = ~(words[j]);
74
74
 
75
75
  if (word)
76
76
  {
data/ext/rtree/lib/bsrt.c CHANGED
@@ -45,17 +45,16 @@ static int write_version(FILE *stream)
45
45
 
46
46
  /* state, 12 bytes */
47
47
 
48
- static int write_state(state_t *state, FILE *stream)
48
+ static int write_state(const state_t *state, FILE *stream)
49
49
  {
50
- uint16_t v[6] =
51
- {
52
- htole16(state_dims(state)),
53
- htole16(state_page_size(state)),
54
- htole16(SIZEOF_RTREE_COORD_T),
55
- htole16(state_rect_size(state)),
56
- htole16(state_branch_size(state)),
57
- htole16(state_node_size(state))
58
- };
50
+ const uint16_t v[6] = {
51
+ htole16(state_dims(state)),
52
+ htole16(state_page_size(state)),
53
+ htole16(SIZEOF_RTREE_COORD_T),
54
+ htole16(state_rect_size(state)),
55
+ htole16(state_branch_size(state)),
56
+ htole16(state_node_size(state))
57
+ };
59
58
 
60
59
  if (fwrite(&v, 2, 6, stream) != 6)
61
60
  return RTREE_ERR_FWRITE;
@@ -94,7 +93,7 @@ static int write_id(rtree_id_t id, FILE *stream)
94
93
  #elif SIZEOF_RTREE_ID_T == 8
95
94
  uint64_t v = htole64(id);
96
95
  #else
97
- #error rtree_id_t size not handled
96
+ #error MSG_RTREE_COORD_SIZE
98
97
  #endif
99
98
 
100
99
  if (fwrite(&v, SIZEOF_RTREE_ID_T, 1, stream) != 1)
@@ -140,7 +139,7 @@ static int write_rect(const state_t *state,
140
139
  #elif SIZEOF_RTREE_COORD_T == 8
141
140
  *(uint64_t*)p = htole64(*(uint64_t*)p);
142
141
  #else
143
- #error rtree_coord_t size not handled
142
+ #error MSG_RTREE_COORD_SIZE
144
143
  #endif
145
144
 
146
145
  buffer[i] = *(rtree_coord_t*)p;
@@ -349,7 +348,7 @@ static int read_v1_rect(FILE *stream,
349
348
  #elif SIZEOF_RTREE_COORD_T == 8
350
349
  *(uint64_t*)p = le64toh(*(uint64_t*)p);
351
350
  #else
352
- #error rtree_coord_t size not handled
351
+ #error MSG_RTREE_COORD_SIZE
353
352
  #endif
354
353
 
355
354
  rect[i] = *(rtree_coord_t*)p;
@@ -377,7 +376,7 @@ static int read_v1_id(FILE *stream, rtree_id_t *id)
377
376
  #elif SIZEOF_RTREE_ID_T == 2
378
377
  *id = le16toh(*id);
379
378
  #else
380
- #error rtree_id_t size not handled
379
+ #error MSG_RTREE_COORD_SIZE
381
380
  #endif
382
381
 
383
382
  return 0;
data/ext/rtree/lib/csv.c CHANGED
@@ -5,6 +5,7 @@
5
5
  #include "private/csv.h"
6
6
  #include "private/rtree.h"
7
7
  #include "private/state.h"
8
+ #include "private/message.h"
8
9
 
9
10
  #include "rtree/error.h"
10
11
  #include "rtree/types.h"
@@ -37,7 +38,7 @@ static int parse(FILE *stream, rtree_t *rtree)
37
38
 
38
39
  while (fgets(line, LINE_LEN, stream) != NULL)
39
40
  {
40
- char *tok;
41
+ const char *tok;
41
42
 
42
43
  if ((tok = strtok(line, ",")) == NULL)
43
44
  continue;
@@ -91,12 +92,14 @@ static int write_internal_branch(const state_t *state,
91
92
  return write_node(state, branch_get_child(branch), arg);
92
93
  }
93
94
 
94
- #if SIZEOF_RTREE_COORD_T == 4
95
- #define PRECISION 6
95
+ #if SIZEOF_RTREE_COORD_T == 2
96
+ #define PRECISION 5
97
+ #elif SIZEOF_RTREE_COORD_T == 4
98
+ #define PRECISION 9
96
99
  #elif SIZEOF_RTREE_COORD_T == 8
97
- #define PRECISION 14
100
+ #define PRECISION 17
98
101
  #else
99
- #error "strange size for rtree_coord_t"
102
+ #error MSG_RTREE_COORD_SIZE
100
103
  #endif
101
104
 
102
105
  static int write_leaf_branch(const state_t *state,
data/ext/rtree/lib/json.c CHANGED
@@ -197,7 +197,7 @@ static bool jr_value_equal(json_t *object, const char *key, size_t value)
197
197
  return (int_value >= 0) && ((size_t)int_value == value);
198
198
  }
199
199
 
200
- static bool jr_state_is_consistent(json_t *json_state, state_t *state)
200
+ static bool jr_state_is_consistent(json_t *json_state, const state_t *state)
201
201
  {
202
202
  return
203
203
  jr_value_equal(json_state, "dims", state_dims(state)) &&
data/ext/rtree/lib/node.c CHANGED
@@ -206,7 +206,7 @@ int node_branch_each_level(const state_t *state, const node_t *node,
206
206
  {
207
207
  for (size_t i = 0 ; i < node_count(node) ; i++)
208
208
  {
209
- branch_t *branch = node_get_branch(state, node, i);
209
+ const branch_t *branch = node_get_branch(state, node, i);
210
210
  const node_t *child = branch_get_child(branch);
211
211
  int err = node_branch_each_level(state, child, level, f, arg);
212
212
  if (err != 0) return err;
@@ -236,7 +236,7 @@ size_t node_bytes(const state_t *state, const node_t *node)
236
236
 
237
237
  for (size_t i = 0 ; i < node_count(node) ; i++)
238
238
  {
239
- branch_t *branch = node_get_branch(state, node, i);
239
+ const branch_t *branch = node_get_branch(state, node, i);
240
240
  const node_t *child = branch_get_child(branch);
241
241
  bytes += node_bytes(state, child);
242
242
  }
@@ -261,7 +261,8 @@ int node_detach_branch(const state_t *state, node_t *node, size_t i)
261
261
 
262
262
  if (i + 1 != node_count(node))
263
263
  {
264
- branch_t *branch_end = node_get_branch(state, node, node_count(node) - 1);
264
+ const branch_t
265
+ *branch_end = node_get_branch(state, node, node_count(node) - 1);
265
266
 
266
267
  if (branch_end == NULL)
267
268
  return RTREE_ERR_GETBRANCH;
@@ -315,7 +316,7 @@ node_t* node_add_branch(const state_t *state, node_t *node, branch_t *branch)
315
316
  */
316
317
 
317
318
  static int node_pick_branch(const state_t *state,
318
- node_t *node,
319
+ const node_t *node,
319
320
  const rtree_coord_t *rect,
320
321
  size_t *index)
321
322
  {
@@ -330,7 +331,7 @@ static int node_pick_branch(const state_t *state,
330
331
 
331
332
  for (size_t i = 0 ; i < n ; i++)
332
333
  {
333
- branch_t *branch;
334
+ const branch_t *branch;
334
335
 
335
336
  if ((branch = node_get_branch(state, node, i)) == NULL)
336
337
  return RTREE_ERR_GETBRANCH;
@@ -472,7 +473,9 @@ static node_t* node_add_rect2(const state_t *state,
472
473
  */
473
474
 
474
475
  node_t* node_add_rect(const state_t *state,
475
- rtree_id_t id, rtree_coord_t *rect, node_t *root,
476
+ rtree_id_t id,
477
+ const rtree_coord_t *rect,
478
+ node_t *root,
476
479
  node_level_t level)
477
480
  {
478
481
  const size_t dims = state_dims(state);
@@ -538,9 +541,12 @@ node_t* node_add_rect(const state_t *state,
538
541
  {
539
542
  branch_set_child(branch, sibling);
540
543
  branch_set_rect(state, branch, envelope);
541
- node_add_branch(state, new_root, branch);
544
+ n = node_add_branch(state, new_root, branch);
542
545
 
543
- return new_root;
546
+ if (n != new_root)
547
+ node_destroy(state, n);
548
+ else
549
+ return new_root;
544
550
  }
545
551
  }
546
552
  }
@@ -5,7 +5,7 @@
5
5
 
6
6
  #include "rtree/package.h"
7
7
 
8
- const char rtree_package_version[] = "1.3.2";
8
+ const char rtree_package_version[] = "1.3.3";
9
9
  const char rtree_package_name[] = "librtree";
10
10
  const char rtree_package_url[] = "https://gitlab.com/jjg/librtree";
11
11
  const char rtree_package_bugreport[] = "j.j.green@gmx.co.uk";
@@ -252,10 +252,10 @@ void postscript_style_destroy(postscript_style_t *style)
252
252
  free(style);
253
253
  }
254
254
 
255
- static int pw_header(FILE *stream, uint32_t *bbox, const char *title)
255
+ static int pw_header(FILE *stream, const uint32_t *bbox, const char *title)
256
256
  {
257
257
  time_t t; time(&t);
258
- struct tm *tm = gmtime(&t);
258
+ const struct tm *tm = gmtime(&t);
259
259
  size_t n = 1024;
260
260
  char time_string[n];
261
261
  if (strftime(time_string, n, "%a, %d %b %Y %T %z", tm) == 0)
@@ -341,7 +341,7 @@ typedef struct
341
341
  static int rect_proc(const branch_t *branch, const char *proc, rect_data_t *data)
342
342
  {
343
343
  const rtree_coord_t *rect = branch_get_rect(branch);
344
- page_t *page = data->page;
344
+ const page_t *page = data->page;
345
345
  float scale = page->scale;
346
346
  fprintf(data->stream,
347
347
  "%.2f %.2f %.2f %.2f %s\n",
@@ -434,6 +434,7 @@ static int pw_state(const rtree_postscript_t *opts, ps_t *ps)
434
434
  page->body.height = body_height;
435
435
  page->body.width = body_width;
436
436
  page->scale = scale;
437
+ page->margin = margin;
437
438
  page->offset.x = rect[0] - margin / scale;
438
439
  page->offset.y = rect[1] - margin / scale;
439
440
 
@@ -0,0 +1,33 @@
1
+ /*
2
+ private/generic.h
3
+ Copyright (c) J.J. Green 2026
4
+ */
5
+
6
+ #ifndef PRIVATE_GENERIC_H
7
+ #define PRIVATE_GENERIC_H
8
+
9
+ #include "config.h"
10
+ #include "private/message.h"
11
+
12
+ /*
13
+ the functions fabs() and so on, while having formal double
14
+ arguments are generic, will call fabsf() for float arguments
15
+ and so on. But does not handle float16, so in that case we use
16
+ an explicit fabsf() which will case the float16 to float32 ...
17
+ */
18
+
19
+ #if (SIZEOF_RTREE_COORD_T == 2) || (SIZEOF_RTREE_COORD_T == 4)
20
+ # define FABS(x) fabsf(x)
21
+ # define POW(x, y) powf(x, y)
22
+ # define FMIN(x, y) fminf(x, y)
23
+ # define FMAX(x, y) fmaxf(x, y)
24
+ #elif SIZEOF_RTREE_COORD_T == 8
25
+ # define FABS(x) fabs(x)
26
+ # define POW(x, y) pow(x, y)
27
+ # define FMIN(x, y) fmin(x, y)
28
+ # define FMAX(x, y) fmax(x, y)
29
+ #else
30
+ # error MSG_RTREE_COORD_SIZE
31
+ #endif
32
+
33
+ #endif
@@ -0,0 +1,11 @@
1
+ /*
2
+ private/message.h
3
+ Copyright (c) J.J. Green 2026
4
+ */
5
+
6
+ #ifndef PRIVATE_MESSAGE_H
7
+ #define PRIVATE_MESSAGE_H
8
+
9
+ #define MSG_RTREE_COORD_SIZE "unhandled rtree_coord_t size"
10
+
11
+ #endif
@@ -45,7 +45,7 @@ size_t node_num_branch(size_t, size_t);
45
45
  int node_detach_branch(const state_t*, node_t*, size_t);
46
46
  node_t* node_add_branch(const state_t*, node_t*, branch_t*);
47
47
  int node_envelope(const state_t*, const node_t*, rtree_coord_t*);
48
- node_t* node_add_rect(const state_t*, rtree_id_t, rtree_coord_t*,
48
+ node_t* node_add_rect(const state_t*, rtree_id_t, const rtree_coord_t*,
49
49
  node_t*, node_level_t);
50
50
  int node_update(const state_t*, const node_t*, rtree_update_t*, void*);
51
51
  bool node_identical(const state_t*, const node_t*, const node_t*);
@@ -3,6 +3,8 @@
3
3
  #endif
4
4
 
5
5
  #include "private/rectf.h"
6
+ #include "private/generic.h"
7
+ #include "private/message.h"
6
8
 
7
9
  #ifdef HAVE_TGMATH_H
8
10
  #include <tgmath.h>
@@ -29,7 +31,7 @@
29
31
 
30
32
  rtree_coord_t rectf_rsv1(size_t dims, const rtree_coord_t *rect)
31
33
  {
32
- return 0.5 * fabs(rect[1] - rect[0]);
34
+ return 0.5 * FABS(rect[1] - rect[0]);
33
35
  }
34
36
 
35
37
  rtree_coord_t rectf_rsv2(size_t dims, const rtree_coord_t *rect)
@@ -56,7 +58,7 @@ rtree_coord_t rectf_rsvd(size_t dims, const rtree_coord_t *rect)
56
58
  r2 += hx * hx;
57
59
  }
58
60
 
59
- return pow(0.25 * r2, 0.5 * dims);
61
+ return POW(0.25 * r2, 0.5 * dims);
60
62
  }
61
63
 
62
64
  rectf_rsv_t* rectf_spherical_volume(size_t dims)
@@ -100,15 +102,19 @@ void rectf_rcd(size_t dims,
100
102
  x0 = rect0[i], x1 = rect1[i],
101
103
  y0 = rect0[j], y1 = rect1[j];
102
104
 
103
- rect2[i] = fmin(x0, x1);
104
- rect2[j] = fmax(y0, y1);
105
+ rect2[i] = FMIN(x0, x1);
106
+ rect2[j] = FMAX(y0, y1);
105
107
  }
106
108
  }
107
109
 
108
110
  #pragma GCC diagnostic push
109
111
  #pragma GCC diagnostic ignored "-Wunused-parameter"
110
112
 
111
- #if SIZEOF_RTREE_COORD_T == 4
113
+ #if SIZEOF_RTREE_COORD_T == 2
114
+
115
+ /* https://gitlab.com/jjg/librtree/-/work_items/83 */
116
+
117
+ #elif SIZEOF_RTREE_COORD_T == 4
112
118
 
113
119
  #ifdef HAVE_SSE2
114
120
 
@@ -127,7 +133,6 @@ void rectf_rc2(size_t dims,
127
133
  _mm_storeu_ps(rect2, res);
128
134
  }
129
135
 
130
-
131
136
  #endif
132
137
 
133
138
  #ifdef HAVE_AVX
@@ -188,7 +193,7 @@ void rectf_rc2(size_t dims,
188
193
  #endif
189
194
 
190
195
  #else
191
- #error "strange size for rtree_coord_t"
196
+ #error MSG_RTREE_COORD_SIZE
192
197
  #endif
193
198
 
194
199
  #pragma GCC diagnostic pop
@@ -198,7 +203,9 @@ rectf_rc_t* rectf_combine(size_t dims)
198
203
  switch (dims)
199
204
  {
200
205
 
201
- #if SIZEOF_RTREE_COORD_T == 4
206
+ #if SIZEOF_RTREE_COORD_T == 2
207
+ /* https://gitlab.com/jjg/librtree/-/work_items/83 */
208
+ #elif SIZEOF_RTREE_COORD_T == 4
202
209
  # ifdef HAVE_SSE2
203
210
  case 2: return rectf_rc2;
204
211
  # endif
@@ -211,7 +218,7 @@ rectf_rc_t* rectf_combine(size_t dims)
211
218
  case 2: return rectf_rc2;
212
219
  # endif
213
220
  #else
214
- # error "strange size for rtree_coord_t"
221
+ # error MSG_RTREE_COORD_SIZE
215
222
  #endif
216
223
 
217
224
  default: return rectf_rcd;
@@ -134,7 +134,7 @@ rtree_t* rtree_bsrt_read(FILE *stream)
134
134
  return bsrt_rtree_read(stream);
135
135
  }
136
136
 
137
- int rtree_add_rect(rtree_t *rtree, rtree_id_t id, rtree_coord_t *rect)
137
+ int rtree_add_rect(rtree_t *rtree, rtree_id_t id, const rtree_coord_t *rect)
138
138
  {
139
139
  node_t *node = node_add_rect(rtree->state, id, rect, rtree->root, 0);
140
140
 
@@ -31,7 +31,7 @@ rtree_t* rtree_clone(const rtree_t*);
31
31
  void rtree_destroy(rtree_t*);
32
32
  rtree_height_t rtree_height(const rtree_t*);
33
33
  int rtree_search(const rtree_t*, const rtree_coord_t*, rtree_search_t*, void*);
34
- int rtree_add_rect(rtree_t*, rtree_id_t, rtree_coord_t*);
34
+ int rtree_add_rect(rtree_t*, rtree_id_t, const rtree_coord_t*);
35
35
  int rtree_update(rtree_t*, rtree_update_t*, void*);
36
36
  bool rtree_identical(const rtree_t*, const rtree_t*);
37
37
  int rtree_csv_write(const rtree_t*, FILE*);
@@ -6,6 +6,7 @@
6
6
  #include "private/branch.h"
7
7
  #include "private/branches.h"
8
8
  #include "private/node.h"
9
+ #include "private/generic.h"
9
10
  #include "private/split.h"
10
11
 
11
12
  #include "rtree/error.h"
@@ -44,7 +45,7 @@ static int split_classify(size_t i, size_t group,
44
45
  const state_t *state, split_t *split)
45
46
  {
46
47
  partition_t *part = &(split->partition);
47
- branch_t *branch = branches_get(state, split->branches, i);
48
+ const branch_t *branch = branches_get(state, split->branches, i);
48
49
  const rtree_coord_t *rect = branch_get_rect(branch);
49
50
 
50
51
  int err;
@@ -87,7 +88,7 @@ static int split_seed_linear(const state_t *state, split_t *split)
87
88
 
88
89
  for (size_t i = 1 ; i < nbuf ; i++)
89
90
  {
90
- branch_t
91
+ const branch_t
91
92
  *b0 = branches_get(state, split->branches, greatest_lower[dim]),
92
93
  *b1 = branches_get(state, split->branches, i),
93
94
  *b2 = branches_get(state, split->branches, least_upper[dim]);
@@ -111,7 +112,7 @@ static int split_seed_linear(const state_t *state, split_t *split)
111
112
 
112
113
  for (size_t dim = 0 ; dim < dims ; dim++)
113
114
  {
114
- branch_t
115
+ const branch_t
115
116
  *bl = branches_get(state, split->branches, least_upper[dim]),
116
117
  *bh = branches_get(state, split->branches, greatest_lower[dim]);
117
118
  const rtree_coord_t
@@ -161,7 +162,7 @@ static int split_seed_quadratic(const state_t *state, split_t *split)
161
162
 
162
163
  for (size_t i = 0 ; i < total ; i++)
163
164
  {
164
- branch_t *branch = branches_get(state, split->branches, i);
165
+ const branch_t *branch = branches_get(state, split->branches, i);
165
166
  const rtree_coord_t *rect = branch_get_rect(branch);
166
167
  area[i] = rect_spherical_volume(state, rect);
167
168
  }
@@ -172,12 +173,12 @@ static int split_seed_quadratic(const state_t *state, split_t *split)
172
173
 
173
174
  for (size_t i = 0 ; i < total - 1 ; i++)
174
175
  {
175
- branch_t *bi = branches_get(state, split->branches, i);
176
+ const branch_t *bi = branches_get(state, split->branches, i);
176
177
  const rtree_coord_t *ri = branch_get_rect(bi);
177
178
 
178
179
  for (size_t j = i + 1 ; j < total ; j++)
179
180
  {
180
- branch_t *bj = branches_get(state, split->branches, j);
181
+ const branch_t *bj = branches_get(state, split->branches, j);
181
182
  const rtree_coord_t *rj = branch_get_rect(bj);
182
183
  rtree_coord_t rect[2 * dims];
183
184
 
@@ -238,7 +239,7 @@ static int split_linear(const state_t *state, split_t *split)
238
239
  continue;
239
240
  }
240
241
 
241
- branch_t *branch = branches_get(state, split->branches, i);
242
+ const branch_t *branch = branches_get(state, split->branches, i);
242
243
  const rtree_coord_t *rect = branch_get_rect(branch);
243
244
 
244
245
  for (size_t group = 0 ; group < 2 ; group++)
@@ -312,9 +313,8 @@ static int split_quadratic(const state_t *state, split_t *split)
312
313
  total = part->total,
313
314
  minfill = part->minfill,
314
315
  *count = part->count;
315
- rtree_coord_t
316
- **cover = part->cover,
317
- *area = part->area;
316
+ rtree_coord_t **cover = part->cover;
317
+ const rtree_coord_t *area = part->area;
318
318
 
319
319
  while ( (count[0] + count[1] < total) &&
320
320
  (count[0] + minfill < total) &&
@@ -327,7 +327,7 @@ static int split_quadratic(const state_t *state, split_t *split)
327
327
  i < total ;
328
328
  i = bindex_next_unset(part->taken, i + 1))
329
329
  {
330
- branch_t *branch = branches_get(state, split->branches, i);
330
+ const branch_t *branch = branches_get(state, split->branches, i);
331
331
  const rtree_coord_t *rect = branch_get_rect(branch);
332
332
  rtree_coord_t r0[2 * dims], r1[2 * dims];
333
333
 
@@ -395,7 +395,7 @@ typedef struct
395
395
  #elif SIZEOF_RTREE_COORD_T == 8
396
396
  uint64_t id;
397
397
  #else
398
- #error rtree_id_t size not handled
398
+ #error MSG_RTREE_COORD_SIZE
399
399
  #endif
400
400
  rtree_coord_t min;
401
401
  } pair_t;
@@ -428,7 +428,7 @@ static int split_greene(const state_t *state, split_t *split)
428
428
  if ((err = split_seed_quadratic(state, split)) != RTREE_OK)
429
429
  return err;
430
430
 
431
- branch_t
431
+ const branch_t
432
432
  *b0 = branches_get(state, split->branches, 0),
433
433
  *b1 = branches_get(state, split->branches, 1);
434
434
  const rtree_coord_t
@@ -442,9 +442,9 @@ static int split_greene(const state_t *state, split_t *split)
442
442
  rtree_coord_t
443
443
  s0 = r0[dim] - r1[dim + dims],
444
444
  s1 = r1[dim] - r0[dim + dims],
445
- s2 = fmax(s0, s1),
446
- n0 = fmin(r0[dim], r1[dim]),
447
- n1 = fmax(r0[dim + dims], r1[dim + dims]),
445
+ s2 = FMAX(s0, s1),
446
+ n0 = FMIN(r0[dim], r1[dim]),
447
+ n1 = FMAX(r0[dim + dims], r1[dim + dims]),
448
448
  n2 = n1 - n0,
449
449
  sep = s2 / n2;
450
450
 
@@ -461,13 +461,13 @@ static int split_greene(const state_t *state, split_t *split)
461
461
 
462
462
  /* order by lower boumd in this dimension */
463
463
 
464
- partition_t *part = &(split->partition);
464
+ const partition_t *part = &(split->partition);
465
465
  const size_t total = part->total;
466
466
  pair_t pairs[total];
467
467
 
468
468
  for (size_t i = 0 ; i < total ; i++)
469
469
  {
470
- branch_t *b = branches_get(state, split->branches, i);
470
+ const branch_t *b = branches_get(state, split->branches, i);
471
471
  const rtree_coord_t *r = branch_get_rect(b);
472
472
  pairs[i].id = i;
473
473
  pairs[i].min = r[axis];
@@ -587,7 +587,7 @@ static node_t* split_load(const state_t *state, node_t *node, split_t *split)
587
587
  {
588
588
  branch_t *branch = branches_get(state, split->branches, i);
589
589
  size_t group = bindex_get(part->choice, i);
590
- node_t *result;
590
+ const node_t *result;
591
591
 
592
592
  switch (group)
593
593
  {
@@ -654,7 +654,7 @@ static node_t* split_cover(const state_t *state, node_t *node, split_t *split)
654
654
 
655
655
  split->rect = split_rect;
656
656
 
657
- branch_t *b = branches_get(state, split->branches, 0);
657
+ const branch_t *b = branches_get(state, split->branches, 0);
658
658
  const rtree_coord_t *r;
659
659
 
660
660
  if ((r = branch_get_rect(b)) != NULL)
@@ -697,7 +697,7 @@ node_t* split_node(const state_t *state, node_t *node, branch_t *branch)
697
697
 
698
698
  for (size_t i = 0 ; i < n ; i++)
699
699
  {
700
- branch_t *b = branches_get(state, branches, i);
700
+ const branch_t *b = branches_get(state, branches, i);
701
701
  branches_set(state, split.branches, i, b);
702
702
  }
703
703
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - J.J. Green
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-28 00:00:00.000000000 Z
11
+ date: 2026-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: '1.4'
131
+ version: '1.8'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: '1.4'
138
+ version: '1.8'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rbs
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +186,9 @@ files:
186
186
  - ext/rtree/lib/private/constants.h
187
187
  - ext/rtree/lib/private/csv.h
188
188
  - ext/rtree/lib/private/endianness.h
189
+ - ext/rtree/lib/private/generic.h
189
190
  - ext/rtree/lib/private/json.h
191
+ - ext/rtree/lib/private/message.h
190
192
  - ext/rtree/lib/private/node.h
191
193
  - ext/rtree/lib/private/page.h
192
194
  - ext/rtree/lib/private/postscript.h