Skip to content

Commit a909105

Browse files
committed
CRAN fix
1 parent df0f234 commit a909105

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed

compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
cd pkg/src
44
rm --verbose *.o *.so
5-
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -fopenmp -O2 -Wall -pipe -g -c -Wstrict-prototypes *.c
5+
gcc-10 -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -fopenmp -O4 -Wall -pipe -g -c -Wstrict-prototypes -Wformat *.c
66
#gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O2 -Wall -pipe -g -c *.c
77
gcc -std=gnu99 -shared -o stringdist.so *.o -L/usr/lib/R/lib -lR
88
cd ../../

pkg/DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Description: Implements an approximate string matching version of R's native
2323
vectors representing generic sequences. This package is built for speed and
2424
runs in parallel by using 'openMP'. An API for C or C++ is exposed as well.
2525
Reference: MPJ van der Loo (2014) <doi:10.32614/RJ-2014-011>.
26-
Version: 0.9.10
26+
Version: 0.9.12
2727
Depends:
2828
R (>= 2.15.3)
2929
URL: https://github.com/markvanderloo/stringdist
@@ -32,4 +32,4 @@ Suggests:
3232
tinytest
3333
Imports: parallel
3434
Encoding: UTF-8
35-
RoxygenNote: 7.2.1
35+
RoxygenNote: 7.2.3

pkg/NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
version 0.9.12
2+
- apparently R_xlen_t is long long int on CLANG/Windows and long int on gcc-13/debian
3+
4+
version 0.9.11
5+
- Fixed a warning in gcc-13: changed specifier from %d to %ld.
6+
(Thanks to Kurt Hornik for the head's up)
7+
18
version 0.9.10
29
- Fixed another warning generated by new C compiler that I overlooked.
310
(Thanks to the CRAN team for the head's up)

pkg/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ Examples of packages that link to `stringdist` can be found
5454
#### Resources
5555

5656
* A [paper](https://journal.r-project.org/archive/2014-1/loo.pdf) on stringdist has been published in the R-journal
57-
* [Slides](https://www.markvanderloo.eu/files/statistics/stringdist_useR2014.pdf) of a talk given at te _useR!2014_ conference.
57+
* [Slides](https://www.markvanderloo.eu/files/share/loo2014approximate.pdf) of a talk given at te _useR!2014_ conference.
5858

pkg/src/Rstringdist.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ SEXP R_stringdist(SEXP a, SEXP b, SEXP method
6464

6565
// output vector
6666
SEXP yy;
67-
PROTECT(yy = allocVector(REALSXP, nt));
67+
yy = PROTECT(allocVector(REALSXP, nt));
6868
double *y = REAL(yy);
6969

7070
#ifdef _OPENMP
@@ -149,7 +149,7 @@ SEXP R_amatch(SEXP x, SEXP table, SEXP method
149149

150150
// output vector
151151
SEXP yy;
152-
PROTECT(yy = allocVector(INTSXP, nx));
152+
yy = PROTECT(allocVector(INTSXP, nx));
153153
int *y = INTEGER(yy);
154154

155155
#ifdef _OPENMP
@@ -244,13 +244,13 @@ SEXP R_lower_tri(SEXP a, SEXP method
244244
, N = n*(n-1)/2;
245245

246246
if ( n > MAXN ){
247-
error("Length of input vector (%d) exceeds maximum allowed for this platform (%d)",n,MAXN);
247+
error("Length of input vector (%1.0f) exceeds maximum allowed for this platform (%1.0f)",(double) n,(double) MAXN);
248248
}
249249

250250

251251
// output vector
252252
SEXP yy;
253-
PROTECT(yy = allocVector(REALSXP, N));
253+
yy = PROTECT(allocVector(REALSXP, N));
254254
// nothing to do if n=1
255255
if (n == 1L) goto end ;
256256
double *y = REAL(yy);
@@ -346,7 +346,7 @@ SEXP R_afind(SEXP a, SEXP pattern, SEXP width
346346

347347
// output list
348348
SEXP out_list;
349-
PROTECT(out_list = allocVector(VECSXP, 2));
349+
out_list = PROTECT(allocVector(VECSXP, 2));
350350

351351
// output location
352352
SEXP out_loc = PROTECT(allocMatrix(INTSXP, na, npat));
@@ -441,7 +441,7 @@ SEXP R_afind(SEXP a, SEXP pattern, SEXP width
441441
// helper function to determine whether all is INTSXP
442442

443443
SEXP R_all_int(SEXP X){
444-
PROTECT(X);
444+
445445
SEXP all_int;
446446
all_int = PROTECT(allocVector(LGLSXP,1L));
447447

@@ -454,7 +454,7 @@ SEXP R_all_int(SEXP X){
454454
}
455455
}
456456

457-
UNPROTECT(2);
457+
UNPROTECT(1);
458458
return all_int;
459459

460460
}

pkg/src/qgram.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ SEXP R_get_qgrams(SEXP a, SEXP qq){
568568
count_qtree(Q,nqgram);
569569

570570
SEXP qgrams, qcount;
571-
PROTECT(qgrams = allocVector(INTSXP, q*nqgram[0]));
572-
PROTECT(qcount = allocVector(REALSXP, nLoc*nqgram[0]));
571+
qgrams = PROTECT(allocVector(INTSXP, q*nqgram[0]));
572+
qcount = PROTECT(allocVector(REALSXP, nLoc*nqgram[0]));
573573

574574
get_counts(Q, q, INTEGER(qgrams), nLoc, index, REAL(qcount));
575575

0 commit comments

Comments
 (0)