Skip to content

Commit 090f4f0

Browse files
authored
Merge pull request #203 from r-spatial/cran-fixes-latest
Maybe fix latest cran warnings
2 parents 865f8f0 + d9f2d2b commit 090f4f0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/absl/container/internal/raw_hash_set.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,11 @@ inline bool IsEmptyOrDeleted(ctrl_t c) { return c < kSentinel; }
324324
// Work around this by using the portable implementation of Group
325325
// when using -funsigned-char under GCC.
326326
inline __m128i _mm_cmpgt_epi8_fixed(__m128i a, __m128i b) {
327-
#if defined(__GNUC__) && !defined(__clang__)
327+
// dd: in the latest gcc we get warnings about overflow here.
328+
// the linked bug was fixed in gcc 9 and fixes were backported
329+
// to gcc 7 and 8 patch releases. To fix the warning, I just
330+
// added a check for the GCC version.
331+
#if defined(__GNUC__) && (__GNUC__ < 9) && !defined(__clang__)
328332
if (std::is_unsigned<char>::value) {
329333
const __m128i mask = _mm_set1_epi8(0x80);
330334
const __m128i diff = _mm_subs_epi8(b, a);

src/s2/util/math/exactfloat/exactfloat.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ std::string ExactFloat::ToStringWithMaxDigits(int max_digits) const {
409409
str.append(digits.begin() + 1, digits.end());
410410
}
411411
char exp_buf[20];
412-
sprintf(exp_buf, "e%+02d", exp10 - 1);
412+
snprintf(exp_buf, sizeof(exp_buf), "e%+02d", exp10 - 1);
413413
str += exp_buf;
414414
} else {
415415
// Use fixed format. We split this into two cases depending on whether
@@ -512,7 +512,7 @@ int ExactFloat::GetDecimalDigits(int max_digits, std::string* digits) const {
512512

513513
std::string ExactFloat::ToUniqueString() const {
514514
char prec_buf[20];
515-
sprintf(prec_buf, "<%d>", prec());
515+
snprintf(prec_buf, sizeof(prec_buf), "<%d>", prec());
516516
return ToString() + prec_buf;
517517
}
518518

0 commit comments

Comments
 (0)