New Upstream Release - r-cran-s2
Ready changes
Summary
Merged new upstream version: 1.1.4 (was: 1.1.2).
Diff
diff --git a/DESCRIPTION b/DESCRIPTION
index 6ae7384..8fcdf91 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: s2
Title: Spherical Geometry Operators Using the S2 Geometry Library
-Version: 1.1.2
+Version: 1.1.4
Authors@R: c(
person(given = "Dewey",
family = "Dunnington",
@@ -28,14 +28,14 @@ RoxygenNote: 7.2.3
SystemRequirements: OpenSSL >= 1.0.1
LinkingTo: Rcpp, wk
Imports: Rcpp, wk (>= 0.6.0)
-Suggests: testthat (>= 3.0.0), vctrs
+Suggests: bit64, testthat (>= 3.0.0), vctrs
URL: https://r-spatial.github.io/s2/, https://github.com/r-spatial/s2,
https://s2geometry.io/
BugReports: https://github.com/r-spatial/s2/issues
Depends: R (>= 3.0.0)
Config/testthat/edition: 3
NeedsCompilation: yes
-Packaged: 2023-01-11 14:23:27 UTC; edzer
+Packaged: 2023-05-16 15:01:01 UTC; edzer
Author: Dewey Dunnington [aut] (<https://orcid.org/0000-0002-9415-4582>),
Edzer Pebesma [aut, cre] (<https://orcid.org/0000-0001-8049-7069>),
Ege Rubak [aut],
@@ -43,4 +43,4 @@ Author: Dewey Dunnington [aut] (<https://orcid.org/0000-0002-9415-4582>),
Google, Inc. [cph] (Original s2geometry.io source code)
Maintainer: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
Repository: CRAN
-Date/Publication: 2023-01-12 13:00:02 UTC
+Date/Publication: 2023-05-17 10:40:02 UTC
diff --git a/MD5 b/MD5
index 4e57871..3b3561d 100644
--- a/MD5
+++ b/MD5
@@ -1,13 +1,13 @@
-559d2ae520e00ba566d56fe6ed456fbb *DESCRIPTION
-8f49b889e6270ac988fc307b40230b44 *NAMESPACE
-9c83f76b446cd82935fefcc104f1a7b6 *NEWS.md
+de87e4b860be3bfdddeff916c7c2b4e4 *DESCRIPTION
+976861cda1588338545dc222e269f6a0 *NAMESPACE
+5a92314e9624f924dbccc136c03e2c4b *NEWS.md
6e30cf9b0b3a9e4629b7b684856b4b07 *R/RcppExports.R
26fbc9df4408ccb165ddbd0cd8577b7e *R/data.R
4ca766e1349ea7baf27d4c8638fcb62b *R/plot.R
b783a368a460bcae5d174c575d863e59 *R/s2-accessors.R
-4ba8ec7d16efeadbc21c3ab5ac3dc6a6 *R/s2-bounds.R
+b218944d59f977684342e52d49ab881f *R/s2-bounds.R
9b93004c163961946245e2ce97d2f27f *R/s2-cell-union.R
-aaa52035ceb2b49346994d2b1cde1493 *R/s2-cell.R
+36a32862a21527afdf59effa34ba30bb *R/s2-cell.R
ed0cadf256cc791b85b392eef085c6f6 *R/s2-constructors-formatters.R
0968515e318a2c7a7372bddad1be6c23 *R/s2-earth.R
9cda6c070b015341cf92f57b9307a770 *R/s2-geography.R
@@ -21,9 +21,9 @@ e7dff1519bc26e311ae3e3f1bb894a69 *R/s2-transformers.R
a2bcb714226ffff00165255cd261dcc5 *R/utils.R
1b0b65e06a8b04d12df322094d6a16c2 *R/vctrs.R
542c90500e67cf705cba921a201f5a57 *R/wk-utils.R
-fa791081760c033818970bdda18960bc *R/zzz.R
+cab4cb3dc48318d6b30fea904fea6bd8 *R/zzz.R
0d29d0b0030a40d9fb9632cf82c261c5 *README.md
-ea124a494ad7922985532ad3b308e4d5 *build/partial.rdb
+439bf689fa27cf9affd0335332142165 *build/partial.rdb
cc6eebf14a3f516ec74168f3ea416fb2 *cleanup
cbac38784589bac27de4468ecf03fb13 *configure
d41d8cd98f00b204e9800998ecf8427e *configure.win
@@ -36,9 +36,9 @@ d41d8cd98f00b204e9800998ecf8427e *inst/extdata/emptyfile
ed01c59b91c1a9c3382d1f2ab67e60cc *man/figures/rc300.png
4a651a96987fab04091987a9343eda03 *man/s2-package.Rd
52eef06fb0b570954600e8e619fe9756 *man/s2_boundary.Rd
-a906d7f9956940ceebe0bd879c14e5f2 *man/s2_bounds_cap.Rd
+1ec1e77f9bf12466ef8c50a23beed9ca *man/s2_bounds_cap.Rd
ebcba3b3e746c4e15de4b309d0674c37 *man/s2_cell.Rd
-74e8baaf2610d2ca7d578c95daf23937 *man/s2_cell_is_valid.Rd
+bb77b7b6b94be80cd6cdf8d8f074d03b *man/s2_cell_is_valid.Rd
79be4874bfb6397f7e4ae40b18df426f *man/s2_cell_union.Rd
71b26a6c7cc913b2dd369afcd744a8f1 *man/s2_cell_union_normalize.Rd
d2590d0319581da0f2b40f438374e5ea *man/s2_closest_feature.Rd
@@ -54,8 +54,8 @@ c56c83fe4daade0fd891802084cc54fc *man/s2_geog_point.Rd
f9c29bc19098f5fc595e260341adeacb *man/s2_plot.Rd
6c76792603f4ce1efc64879d62b59517 *man/s2_point.Rd
de7b3d7e917213319c2adcbda8c5bf98 *man/wk_handle.s2_geography.Rd
-6c732afe5e32be7f5de7c7f7e344c8e5 *src/Makevars.in
-2cec33791efd347cbcb051402d7cf9c4 *src/Makevars.ucrt
+563f58c84903d824a904660615e12c2a *src/Makevars.in
+08be2245599b0ea2815f132127574b84 *src/Makevars.ucrt
7f0e39e59982689e148a8c55669548e5 *src/Makevars.win
08d872fb5bb0af47a972af7330e486ef *src/RcppExports.cpp
642c7be2ce45690aea290338fec0675b *src/absl/algorithm/algorithm.h
@@ -63,7 +63,7 @@ fd93de75d5eb59a37dc897d538c9e428 *src/absl/algorithm/container.h
8dda102d5b63125edd164fe345e55f9b *src/absl/base/attributes.h
daad8899b1d374f22c26521512c3a8bb *src/absl/base/call_once.h
26a0a864fbee53bce7754262cf239314 *src/absl/base/casts.h
-ed4fa7b00556a1a2bfca66015a39b85a *src/absl/base/config.h
+43ea4eaaef94e0338dc008826e43fd7a *src/absl/base/config.h
f787189f34e273f4314344b53f5ccae9 *src/absl/base/const_init.h
033cd6a3c2de9bf80923f5054e2701e2 *src/absl/base/dynamic_annotations.h
376abfbcc035fb5ddd76fb513589a1e9 *src/absl/base/internal/atomic_hook.h
@@ -85,7 +85,7 @@ cd26ae8fafb346728a1759160d46495e *src/absl/base/internal/per_thread_tls.h
c3e7ad34eacc65b541d0aa760ba1599d *src/absl/base/internal/prefetch.h
cff9e9f5e90b5e4455317dddbda47753 *src/absl/base/internal/pretty_function.h
cd8235040ec57fdc0cf6f85f6d8c752d *src/absl/base/internal/raw_logging.cc
-2a32a3734e59aa4953be732a6cec3949 *src/absl/base/internal/raw_logging.h
+3b3edfd7c70fae6821a0b911f42259a4 *src/absl/base/internal/raw_logging.h
bb74d44f7e47edcd1d865adb924db224 *src/absl/base/internal/scheduling_mode.h
fb9f075189d06957e1ae00ceefa34ee5 *src/absl/base/internal/scoped_set_env.cc
80dbd6581eea81b45ba532470673e777 *src/absl/base/internal/scoped_set_env.h
@@ -207,7 +207,7 @@ b1212449ec5b585102abd5fef8394f88 *src/absl/strings/ascii.h
d52529dfcbd429d31cf34475d9345029 *src/absl/strings/charconv.cc
e022adbe4ace51d7a2d3a065e30fc511 *src/absl/strings/charconv.h
8eebdbf778e886f261a8990232281e37 *src/absl/strings/cord.cc
-1f72516104e63dcb7557757bfd39a4d8 *src/absl/strings/cord.h
+6f1377e5033f06d48b32e92c09f97957 *src/absl/strings/cord.h
38bf276145e6768ce7d55bc72c51f4a6 *src/absl/strings/cord_analysis.cc
9eb388a8f95c0a8b6c629e139f5b19a7 *src/absl/strings/cord_analysis.h
fc2b8427acd714ecfa2c87c4d653df20 *src/absl/strings/cord_buffer.cc
@@ -553,7 +553,7 @@ eef1eb7446a79b5b6430af8eede7a698 *src/s2/s2r2rect.h
57778c7c84ae75e67ed68e76f9026ec0 *src/s2/s2region.cc
2234c6d0d865cc61ca6959c01e0015e4 *src/s2/s2region.h
e12692516fc6b52c237e16cf16f11e19 *src/s2/s2region_coverer.cc
-fc15e353fdbb3c76de73bf5fa5a713d8 *src/s2/s2region_coverer.h
+dc72c2322d4aa4d89edaeac8a99d3110 *src/s2/s2region_coverer.h
f622c31665d97c607e1cb5106c295959 *src/s2/s2region_intersection.cc
d146a90111cd2d2b33b1526d5d1eab9e *src/s2/s2region_intersection.h
4bedf29698cbce5a1d755b5d9f0e5312 *src/s2/s2region_term_indexer.cc
@@ -639,9 +639,9 @@ d8287075eb3b5a0d59d684a3bbc5b5ba *src/s2geography/accessors-geog.cc
8e45d5fd12d368bb2989b24b6e158da4 *src/s2geography/accessors.cc
3348390f6d77133281e54b1e8a29c45b *src/s2geography/accessors.h
a3e670ac87785c083206586c8f3f4ca6 *src/s2geography/aggregator.h
-78fcf83ac1350f041d585478dd0cc1e0 *src/s2geography/build.cc
+3b1bf6b72b4dd96ca7c4b760554fc63c *src/s2geography/build.cc
fed04d2f5ddae951483be94e78dd8d46 *src/s2geography/build.h
-7e63d2ff16c15445e287995ce9376d3a *src/s2geography/constructor.h
+241843e894b3d958be1f475991febe29 *src/s2geography/constructor.h
26d396867ab4214aaa9c811a3f5076e0 *src/s2geography/coverings.cc
9245d1de9f44acb9dc6f2ea03324761b *src/s2geography/coverings.h
93135f5c6f3755e0b4d2c2c0e40776ed *src/s2geography/distance.cc
@@ -662,14 +662,14 @@ a9ffa55303a6dcba9c5c9c9d322e2009 *tests/area.R
9a6a22f7e00fd5147781e07d2edd589e *tests/testthat.R
755c4ca0ad5e6f558b9eb7c7e04ded6e *tests/testthat/test-data.R
d8d89b5827614edf67567d7e15e2f213 *tests/testthat/test-plot.R
-ba1747c0aca10f3293809487570aa4f4 *tests/testthat/test-s2-accessors.R
+c94a63e70152c14d6ea3d8e0c947d739 *tests/testthat/test-s2-accessors.R
6d272b0f1b19c173c19ff225c361cd31 *tests/testthat/test-s2-bounds.R
5c3476c24589151b804b66580c20e9b8 *tests/testthat/test-s2-cell-union.R
-adfef75ba2c27c1512e1509dc9949904 *tests/testthat/test-s2-cell.R
+c64aab49b83a1fdc400a28233aefbda7 *tests/testthat/test-s2-cell.R
2fb5fbb6a8d7d4d13c80c650380a2763 *tests/testthat/test-s2-constructors-formatters.R
532d31b6373a11733f72fda2b4254ef6 *tests/testthat/test-s2-earth.R
-6b32984296b69c08ad6f647a13ec683a *tests/testthat/test-s2-geography.R
-3f9c9f8b1ee1767381c2f6bde18c35f3 *tests/testthat/test-s2-lnglat.R
+022f63897a9ae3916d1990c77c23c4ae *tests/testthat/test-s2-geography.R
+68d9f8c6639d165549ed1e487365bb0e *tests/testthat/test-s2-lnglat.R
b874f311928c98a3056d5628c55422c8 *tests/testthat/test-s2-matrix.R
97bdafc52d85952cf4d72ef1818ba36c *tests/testthat/test-s2-options.R
b8d52c633fa3d389a46c8198804f9757 *tests/testthat/test-s2-point.R
diff --git a/NAMESPACE b/NAMESPACE
index f1213d1..7ed3d7c 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -12,6 +12,7 @@ S3method(as.character,s2_cell_union)
S3method(as.character,s2_geography)
S3method(as.list,s2_cell)
S3method(as_s2_cell,character)
+S3method(as_s2_cell,integer64)
S3method(as_s2_cell,s2_cell)
S3method(as_s2_cell,s2_geography)
S3method(as_s2_cell,wk_xy)
diff --git a/NEWS.md b/NEWS.md
index 28dbbb0..9dcce52 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,14 @@
+# s2 (development version)
+
+* Updated more tests to pass on a forthcoming waldo package update (#237).
+
+# s2 1.1.3
+
+* Made a test less strict to pass tests on Alpine Linux (#218, #220).
+* Updated tests to pass on forthcoming waldo package update (@hadley, #226).
+* Updated vendored file modifications to suppress a multi-line comment
+ warning on gcc (#214, #227).
+
# s2 1.1.2
- Fixed test for `as.data.frame()` for `s2_cell()` to comply with new wk
@@ -9,14 +20,14 @@
# s2 1.1.1
-- Fix new CRAN check warnings (#202, #203).
+- Fix new CRAN check warnings (#202, #203).
# s2 1.1.0
- Fix for s2 build on Windows with R <= 3.6.x (#142)
- Fix for s2 build on MacOS with multiple openssl versions (#142, #145, #146)
- Fix for s2 build on 32-bit openssl (#143, #147)
-- Added `s2_convex_hull()` and `s2_convex_hull_agg()` (@spiry34, #150,
+- Added `s2_convex_hull()` and `s2_convex_hull_agg()` (@spiry34, #150,
#151, #163).
- Added `max_distance` argument to `s2_closest_edges()`, making
distance-constrained k-nearest neighbours possible (#125, #156, #162).
@@ -41,12 +52,12 @@
vctr) to represent point coordinates. This is much faster than the previous
representation which relied on `list()` of external pointers (#181, #159).
- Added arguments `planar` and `tessellate_tol_m` to `s2_as_text()`,
- `s2_as_binary()`. Use `planar = TRUE` and set `tessellate_tol_m` to the
- maximum error for your use-case to automatically subdivide edges to
+ `s2_as_binary()`. Use `planar = TRUE` and set `tessellate_tol_m` to the
+ maximum error for your use-case to automatically subdivide edges to
preserve or "straight" lines in Plate carree projection on import (#182).
- Added arguments `planar` and `tessellate_tol_m` to `s2_geog_from_text()`, and
- `s2_geog_from_wkb()`. Use `planar = TRUE` and set `tessellate_tol_m` to the
- maximum error for your use-case to automatically subdivide edges to
+ `s2_geog_from_wkb()`. Use `planar = TRUE` and set `tessellate_tol_m` to the
+ maximum error for your use-case to automatically subdivide edges to
ensure or "straight" lines in Plate carree projection on export (#182).
# s2 1.0.7
@@ -72,7 +83,7 @@
indexing system to R users (#85, #114).
* Added `s2_closest_edges()` to make k-nearest neighbours calculation
possible on the sphere (#111, #112).
-* Added `s2_interpolate()`, `s2_interpolate_normalized()`,
+* Added `s2_interpolate()`, `s2_interpolate_normalized()`,
`s2_project()`, and `s2_project_normalized()` to provide linear
referencing support on the sphere (#96, #110).
* Fixed import of empty points from WKB (#109).
@@ -122,10 +133,10 @@
throughout the package (#69).
* Added `s2_bounds_cap()` and `s2_bounds_rect()` to compute bounding areas
using geographic coordinates (@edzer, #63).
-* `s2_*_matrix()` predicates now efficiently use indexing to compute the
+* `s2_*_matrix()` predicates now efficiently use indexing to compute the
results of many predicate comparisons (#61).
# s2 1.0.0
-This version is a complete rewrite of the former s2 CRAN package, entirely
+This version is a complete rewrite of the former s2 CRAN package, entirely
backwards incompatible with previous versions.
diff --git a/R/s2-bounds.R b/R/s2-bounds.R
index 6c4f792..56e1736 100644
--- a/R/s2-bounds.R
+++ b/R/s2-bounds.R
@@ -8,7 +8,7 @@
#' the order of points or polylines. `lng_lo` values larger than `lng_hi` indicate
#' regions that span the antimeridian, see the Fiji example.
#'
-#' @inheritParams s2_is_collection
+#' @param x An [s2_geography()] vector.
#' @export
#' @return Both functions return a `data.frame`:
#'
diff --git a/R/s2-cell.R b/R/s2-cell.R
index 02a316b..3b6e269 100644
--- a/R/s2-cell.R
+++ b/R/s2-cell.R
@@ -88,6 +88,14 @@ as_s2_cell.wk_xy <- function(x, ...) {
cpp_s2_cell_from_lnglat(as_s2_lnglat(x))
}
+#' @rdname s2_cell
+#' @export
+as_s2_cell.integer64 <- function(x, ...) {
+ storage <- unclass(x)
+ storage[is.na(x)] <- NA_real_
+ new_s2_cell(storage)
+}
+
#' @rdname s2_cell
#' @export
new_s2_cell <- function(x) {
@@ -95,6 +103,16 @@ new_s2_cell <- function(x) {
structure(x, class = c("s2_cell", "wk_vctr"))
}
+# registered in zzz.R
+as.integer64.s2_cell <- function(x, ...) {
+ # We store 64-bit integegers the same way bit64 does so we can just set the
+ # class attribute and propagate NA values in the way that bit64 expects them.
+ x_is_na <- is.na(x)
+ class(x) <- "integer64"
+ x[x_is_na] <- bit64::NA_integer64_
+ x
+}
+
#' @export
as.character.s2_cell <- function(x, ...) {
cpp_s2_cell_to_string(x)
@@ -183,7 +201,7 @@ Summary.s2_cell <- function(x, ..., na.rm = FALSE) {
#'
#' @param x,y An [s2_cell()] vector
#' @param level An integer between 0 and 30, inclusive.
-#' @param k An integer between 1 and 4
+#' @param k An integer between 0 and 3
#' @param radius The radius to use (e.g., [s2_earth_radius_meters()])
#' @param na.rm Remove NAs prior to computing aggregate?
#' @export
diff --git a/R/zzz.R b/R/zzz.R
index acd3ba8..a06930a 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -10,6 +10,8 @@
s3_register("vctrs::vec_restore", cls)
s3_register("vctrs::vec_ptype_abbr", cls)
}
+
+ s3_register("bit64::as.integer64", "s2_cell")
}
s3_register <- function(generic, class, method = NULL) {
diff --git a/build/partial.rdb b/build/partial.rdb
index d53b128..c7c2cee 100644
Binary files a/build/partial.rdb and b/build/partial.rdb differ
diff --git a/debian/changelog b/debian/changelog
index 964419f..6a66a2f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+r-cran-s2 (1.1.4-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Fri, 23 Jun 2023 12:12:11 -0000
+
r-cran-s2 (1.1.2-1) unstable; urgency=medium
* New upstream version
diff --git a/debian/patches/fix-armel-ftbfs.patch b/debian/patches/fix-armel-ftbfs.patch
index 86cfc7d..4bc53f1 100644
--- a/debian/patches/fix-armel-ftbfs.patch
+++ b/debian/patches/fix-armel-ftbfs.patch
@@ -1,10 +1,12 @@
Description: Manually pass in -latomic on armel to fix FTBFS
Author: Nilesh Patra <nilesh@debian.org>
Last-Update: 2021-10-05
---- a/src/Makevars.in
-+++ b/src/Makevars.in
-@@ -3,6 +3,10 @@ PKG_LIBS = @libs@
- PKG_CXXFLAGS = @cflags@ -pthread
+Index: r-cran-s2.git/src/Makevars.in
+===================================================================
+--- r-cran-s2.git.orig/src/Makevars.in
++++ r-cran-s2.git/src/Makevars.in
+@@ -4,6 +4,10 @@ PKG_CXXFLAGS = @cflags@ -pthread
+
CXX_STD = CXX11
+ifneq (,$(filter $(DEB_HOST_ARCH),armel mipsel riscv64 m68k powerpc))
diff --git a/debian/patches/fix-ftbfs-on-32bit.patch b/debian/patches/fix-ftbfs-on-32bit.patch
index 646a450..43693d4 100644
--- a/debian/patches/fix-ftbfs-on-32bit.patch
+++ b/debian/patches/fix-ftbfs-on-32bit.patch
@@ -10,8 +10,10 @@ Reviewed-by: Étienne Mollier <emollier@debian.org>
Last-Update: 2021-10-04
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/src/s2/util/math/exactfloat/exactfloat.cc
-+++ b/src/s2/util/math/exactfloat/exactfloat.cc
+Index: r-cran-s2.git/src/s2/util/math/exactfloat/exactfloat.cc
+===================================================================
+--- r-cran-s2.git.orig/src/s2/util/math/exactfloat/exactfloat.cc
++++ r-cran-s2.git/src/s2/util/math/exactfloat/exactfloat.cc
@@ -75,6 +75,22 @@ inline static uint64 BN_ext_get_uint64(c
return u64;
}
diff --git a/man/s2_bounds_cap.Rd b/man/s2_bounds_cap.Rd
index e4bd419..659534f 100644
--- a/man/s2_bounds_cap.Rd
+++ b/man/s2_bounds_cap.Rd
@@ -10,9 +10,7 @@ s2_bounds_cap(x)
s2_bounds_rect(x)
}
\arguments{
-\item{x}{\link[=as_s2_geography]{geography vectors}. These inputs
-are passed to \code{\link[=as_s2_geography]{as_s2_geography()}}, so you can pass other objects
-(e.g., character vectors of well-known text) directly.}
+\item{x}{An \code{\link[=s2_geography]{s2_geography()}} vector.}
}
\value{
Both functions return a \code{data.frame}:
diff --git a/man/s2_cell_is_valid.Rd b/man/s2_cell_is_valid.Rd
index 63b6668..d6cfd24 100644
--- a/man/s2_cell_is_valid.Rd
+++ b/man/s2_cell_is_valid.Rd
@@ -69,7 +69,7 @@ s2_cell_common_ancestor_level_agg(x, na.rm = FALSE)
\arguments{
\item{x, y}{An \code{\link[=s2_cell]{s2_cell()}} vector}
-\item{k}{An integer between 1 and 4}
+\item{k}{An integer between 0 and 3}
\item{radius}{The radius to use (e.g., \code{\link[=s2_earth_radius_meters]{s2_earth_radius_meters()}})}
diff --git a/src/Makevars.in b/src/Makevars.in
index db45424..2bc496e 100644
--- a/src/Makevars.in
+++ b/src/Makevars.in
@@ -1,6 +1,7 @@
PKG_CPPFLAGS = -I../src -DSTRICT_R_HEADERS
PKG_LIBS = @libs@
PKG_CXXFLAGS = @cflags@ -pthread
+
CXX_STD = CXX11
ABSL_LIBS = absl/base/internal/cycleclock.o \
diff --git a/src/Makevars.ucrt b/src/Makevars.ucrt
index 1a2e101..51eed48 100644
--- a/src/Makevars.ucrt
+++ b/src/Makevars.ucrt
@@ -1,2 +1,3 @@
CRT=-ucrt
include Makevars.win
+CXX_STD = CXX11
diff --git a/src/absl/base/config.h b/src/absl/base/config.h
index eaf029c..e7bf165 100644
--- a/src/absl/base/config.h
+++ b/src/absl/base/config.h
@@ -338,8 +338,8 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// #ifdef ABSL_HAVE_INTRINSIC_INT128
// #error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
// #elif defined(__SIZEOF_INT128__)
-// #if (defined(__clang__) && !defined(_WIN32)) || \
-// (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
+// #if (defined(__clang__) && !defined(_WIN32)) ||
+// (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) ||
// (defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
// #define ABSL_HAVE_INTRINSIC_INT128 1
// #elif defined(__CUDACC__)
diff --git a/src/absl/base/internal/raw_logging.h b/src/absl/base/internal/raw_logging.h
index fa36f94..6d67087 100644
--- a/src/absl/base/internal/raw_logging.h
+++ b/src/absl/base/internal/raw_logging.h
@@ -41,16 +41,16 @@
// This will print an almost standard log line like this to stderr only:
// E0821 211317 file.cc:123] RAW: Failed foo with 22: bad_file
-#define ABSL_RAW_LOG(severity, ...) \
+#define ABSL_RAW_LOG(severity, ...)
// R/Windows gives compilation warnings here that fail the CMD
// check.
- // do { \
- // constexpr const char* absl_raw_logging_internal_basename = \
- // ::absl::raw_logging_internal::Basename(__FILE__, \
- // sizeof(__FILE__) - 1); \
- // ::absl::raw_logging_internal::RawLog(ABSL_RAW_LOGGING_INTERNAL_##severity, \
- // absl_raw_logging_internal_basename, \
- // __LINE__, __VA_ARGS__); \
+ // do {
+ // constexpr const char* absl_raw_logging_internal_basename =
+ // ::absl::raw_logging_internal::Basename(__FILE__,
+ // sizeof(__FILE__) - 1);
+ // ::absl::raw_logging_internal::RawLog(ABSL_RAW_LOGGING_INTERNAL_##severity,
+ // absl_raw_logging_internal_basename,
+ // __LINE__, __VA_ARGS__);
// } while (0)
// Similar to CHECK(condition) << message, but for low-level modules:
diff --git a/src/absl/strings/cord.h b/src/absl/strings/cord.h
index 18d6ab8..eaf068e 100644
--- a/src/absl/strings/cord.h
+++ b/src/absl/strings/cord.h
@@ -1179,8 +1179,15 @@ inline cord_internal::CordRepFlat* Cord::InlineRep::MakeFlatWithExtraCapacity(
size_t len = data_.inline_size();
auto* result = CordRepFlat::New(len + extra);
result->length = len;
- memcpy(result->Data(), data_.as_chars(), sizeof(data_));
- return result;
+ // The following line results in a warning in gcc13 because result->Data()
+ // is a structure that is declared to be 3 bytes in length but is allocated
+ // using C++ trickery such that the following line is safe in a way that
+ // the compiler cannot detect. S2 doesn't use cords anyway, so we just
+ // comment out this line and throw an exception to make sure we don't silently
+ // do the wrong thing.
+ // memcpy(result->Data(), data_.as_chars(), sizeof(data_));
+ throw std::runtime_error(
+ "Cord::InlineRep::MakeFlatWithExtraCapacity() not supported in Abseil as vendored by R/s2");
}
inline void Cord::InlineRep::EmplaceTree(CordRep* rep,
diff --git a/src/s2/s2region_coverer.h b/src/s2/s2region_coverer.h
index e88ca9c..fdae8b9 100644
--- a/src/s2/s2region_coverer.h
+++ b/src/s2/s2region_coverer.h
@@ -248,7 +248,10 @@ class S2RegionCoverer {
private:
struct Candidate {
void* operator new(std::size_t size, std::size_t max_children) {
- return ::operator new (size + max_children * sizeof(Candidate *));
+ // dd: CRAN reports a sanitizer error when using this magic, so
+ // we just hard code for the maximum size the comments suggest it will be
+ // return ::operator new (size + max_children * sizeof(Candidate *));
+ return ::operator new (size);
}
void operator delete(void* p) {
@@ -268,7 +271,9 @@ class S2RegionCoverer {
S2Cell cell;
bool is_terminal; // Cell should not be expanded further.
int num_children = 0; // Number of children that intersect the region.
- __extension__ Candidate* children[0]; // Actual size may be 0, 4, 16, or 64 elements.
+ // dd: To avoid a sanitizer, we hard-code 64 here rather than rely on
+ // flexible array member magic.
+ Candidate* children[64]; // Actual size may be 0, 4, 16, or 64 elements.
};
// If the cell intersects the given region, return a new candidate with no
diff --git a/src/s2geography/build.cc b/src/s2geography/build.cc
index b230f0e..8d16a66 100644
--- a/src/s2geography/build.cc
+++ b/src/s2geography/build.cc
@@ -22,8 +22,8 @@ std::unique_ptr<Geography> s2_geography_from_layers(
GlobalOptions::OutputAction polygon_layer_action) {
// count non-empty dimensions
bool has_polygon = !polygon->is_empty();
- bool has_polylines = polylines.size() > 0;
- bool has_points = points.size() > 0;
+ bool has_polylines = !polylines.empty();
+ bool has_points = !points.empty();
// use the requstested dimensions to produce the right kind of EMTPY
bool include_polygon =
@@ -350,7 +350,7 @@ void S2UnionAggregator::Add(const Geography& geog) {
return;
}
- if (other_.size() == 0) {
+ if (other_.empty()) {
other_.push_back(absl::make_unique<Node>());
other_.back()->index1.Add(geog);
return;
@@ -399,7 +399,7 @@ std::unique_ptr<Geography> S2UnionAggregator::Finalize() {
}
}
- if (other_.size() == 0) {
+ if (other_.empty()) {
return root_.Merge(options_);
} else {
std::unique_ptr<Geography> merged = other_[0]->Merge(options_);
diff --git a/src/s2geography/constructor.h b/src/s2geography/constructor.h
index 781353a..8cd154d 100644
--- a/src/s2geography/constructor.h
+++ b/src/s2geography/constructor.h
@@ -174,7 +174,7 @@ class PolylineConstructor : public Constructor {
Result geom_end() {
finish_points();
- if (points_.size() > 0) {
+ if (!points_.empty()) {
auto polyline = absl::make_unique<S2Polyline>();
polyline->Init(std::move(points_));
@@ -195,11 +195,11 @@ class PolylineConstructor : public Constructor {
std::unique_ptr<Geography> finish() {
std::unique_ptr<PolylineGeography> result;
- if (polylines_.size() > 0) {
+ if (polylines_.empty()) {
+ result = absl::make_unique<PolylineGeography>();
+ } else {
result = absl::make_unique<PolylineGeography>(std::move(polylines_));
polylines_.clear();
- } else {
- result = absl::make_unique<PolylineGeography>();
}
return std::unique_ptr<Geography>(result.release());
@@ -226,7 +226,7 @@ class PolygonConstructor : public Constructor {
Result ring_end() {
finish_points();
- if (points_.size() == 0) {
+ if (points_.empty()) {
return Result::CONTINUE;
}
@@ -395,7 +395,7 @@ class FeatureConstructor : public CollectionConstructor {
return absl::make_unique<GeographyCollection>();
} else {
std::unique_ptr<Geography> feature = std::move(features_.back());
- if (feature.get() == nullptr) {
+ if (feature == nullptr) {
throw Exception("finish_feature() generated nullptr");
}
diff --git a/tests/testthat/test-s2-accessors.R b/tests/testthat/test-s2-accessors.R
index cac91f0..c097921 100644
--- a/tests/testthat/test-s2-accessors.R
+++ b/tests/testthat/test-s2-accessors.R
@@ -166,7 +166,7 @@ test_that("s2_project() and s2_project_normalized() work", {
"LINESTRING (0 0, 0 90)",
c("POINT (0 0)", "POINT (0 22.5)", "POINT (0 67.5)", "POINT (0 90)", "POINT EMPTY", NA)
),
- c(0, 0.25, 0.75, 1, NA_real_, NA_real_)
+ c(0, 0.25, 0.75, 1, NaN, NA_real_)
)
expect_identical(
diff --git a/tests/testthat/test-s2-cell.R b/tests/testthat/test-s2-cell.R
index 4662691..27a938d 100644
--- a/tests/testthat/test-s2-cell.R
+++ b/tests/testthat/test-s2-cell.R
@@ -10,6 +10,13 @@ test_that("s2_cell class works", {
)
})
+test_that("s2_cell bit64::integer64 support works", {
+ cells <- c(as_s2_cell(NA_character_), s2_cell_sentinel())
+ int64s <- bit64::as.integer64(cells)
+ expect_identical(int64s, bit64::as.integer64(c(NA, -1)))
+ expect_identical(as_s2_cell(int64s), cells)
+})
+
test_that("invalid and sentinel values work as expected", {
expect_false(s2_cell_is_valid(s2_cell_sentinel()))
expect_false(s2_cell_is_valid(s2_cell_invalid()))
diff --git a/tests/testthat/test-s2-geography.R b/tests/testthat/test-s2-geography.R
index c553c85..cb82b61 100644
--- a/tests/testthat/test-s2-geography.R
+++ b/tests/testthat/test-s2-geography.R
@@ -169,7 +169,8 @@ test_that("nested ring depths are correctly exported", {
(20 35, 10 30, 10 10, 30 5, 45 20, 20 35),
(30 20, 20 15, 20 25, 30 20)
)
- )")
+ )"),
+ precision = 15
),
"\\(20 35, 10 30, 10 10, 30 5, 45 20, 20 35\\), \\(30 20, 20 15, 20 25"
)
@@ -184,7 +185,8 @@ test_that("nested ring depths are correctly exported", {
(30 20, 20 15, 20 25, 30 20)
),
((27 21, 21 21, 21 16, 27 21))
- )")
+ )"),
+ precision = 15
),
"\\(\\(27 21, 21 21, 21 16, 27 21\\)\\)\\)"
)
diff --git a/tests/testthat/test-s2-lnglat.R b/tests/testthat/test-s2-lnglat.R
index 9b1ccfd..d22aa13 100644
--- a/tests/testthat/test-s2-lnglat.R
+++ b/tests/testthat/test-s2-lnglat.R
@@ -10,8 +10,9 @@ test_that("s2_lnglat objects can be created from and converted back to R objects
as_s2_lnglat(s2_point(1, 0, 0)),
s2_lnglat(0, 0)
)
+
expect_identical(
- as_s2_lnglat(s2_point(NA, NA, NA)),
+ as_s2_lnglat(s2_point(NaN, NaN, NaN)),
s2_lnglat(NaN, NaN)
)
})