Skip to content

Commit

Permalink
fix: add additional C++ fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jorainer committed Nov 21, 2024
1 parent c41bd1d commit 56a4224
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ root = true
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = false
insert_final_newline = true

[*.R]
indent_style = space
Expand All @@ -18,4 +18,4 @@ indent_style = tab

[.travis.yml]
indent_style = space
indent_size = 2
indent_size = 2
4 changes: 2 additions & 2 deletions .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
matrix:
config:
- { os: ubuntu-latest, r: 'devel', bioc: 'devel', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
- { os: macOS-latest, r: '4.4', bioc: 'devel'}
- { os: windows-latest, r: '4.4', bioc: 'devel'}
- { os: macOS-latest, r: '4.4', bioc: '3.20'}
- { os: windows-latest, r: '4.4', bioc: '3.20'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
Expand Down
10 changes: 5 additions & 5 deletions src/massifquant/nmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ double gamma_cody(double);

#include <R_ext/Error.h>
# define MATHLIB_ERROR(fmt,x) Rf_error(fmt,x);
# define MATHLIB_WARNING(fmt,x) warning(fmt,x)
# define MATHLIB_WARNING2(fmt,x,x2) warning(fmt,x,x2)
# define MATHLIB_WARNING3(fmt,x,x2,x3) warning(fmt,x,x2,x3)
# define MATHLIB_WARNING4(fmt,x,x2,x3,x4) warning(fmt,x,x2,x3,x4)
# define MATHLIB_WARNING(fmt,x) Rf_warning(fmt,x)
# define MATHLIB_WARNING2(fmt,x,x2) Rf_warning(fmt,x,x2)
# define MATHLIB_WARNING3(fmt,x,x2,x3) Rf_warning(fmt,x,x2,x3)
# define MATHLIB_WARNING4(fmt,x,x2,x3,x4) Rf_warning(fmt,x,x2,x3,x4)

#include <R_ext/Arith.h>
#define ML_POSINF R_PosInf
Expand Down Expand Up @@ -199,4 +199,4 @@ void attribute_hidden bratio(double a, double b, double x, double y,
double *w, double *w1, int *ierr, int log_p);


#endif /* MATHLIB_PRIVATE_H */
#endif /* MATHLIB_PRIVATE_H */
14 changes: 7 additions & 7 deletions src/xcms_obiwarp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ extern "C" SEXP R_set_from_xcms(SEXP valscantime, SEXP scantime, SEXP mzrange, S
double *pscantime2, *pmz2, *pintensity2;
SEXP corrected;

PROTECT(valscantime = coerceVector(valscantime, INTSXP));
mzrange = coerceVector(mzrange, INTSXP);
PROTECT(valscantime = Rf_coerceVector(valscantime, INTSXP));
mzrange = Rf_coerceVector(mzrange, INTSXP);
pvalscantime = INTEGER(valscantime)[0];
pmzrange = INTEGER(mzrange)[0];
pscantime = REAL(scantime);
pmz = REAL(mz);
pintensity = REAL(intensity);

PROTECT(valscantime2 = coerceVector(valscantime2, INTSXP));
mzrange2 = coerceVector(mzrange2, INTSXP);
PROTECT(valscantime2 = Rf_coerceVector(valscantime2, INTSXP));
mzrange2 = Rf_coerceVector(mzrange2, INTSXP);
pvalscantime2 = INTEGER(valscantime2)[0];
pmzrange2 = INTEGER(mzrange2)[0];
pscantime2 = REAL(scantime2);
Expand Down Expand Up @@ -120,13 +120,13 @@ extern "C" SEXP R_set_from_xcms(SEXP valscantime, SEXP scantime, SEXP mzrange, S
lmat2.tm_axis_vals(nOut, nOutF);
lmat2.warp_tm(nOutF, mOutF);

PROTECT(corrected = allocVector(REALSXP, length(scantime2)));
for(int i=0; i < length(scantime2);i++){
PROTECT(corrected = Rf_allocVector(REALSXP, Rf_length(scantime2)));
for(int i=0; i < Rf_length(scantime2);i++){
REAL(corrected)[i] = lmat2.tm()->back()[i];
}

UNPROTECT(3);

return corrected;

}
}

0 comments on commit 56a4224

Please sign in to comment.