Skip to content

Commit

Permalink
Fix massifquant compile error, closes #778
Browse files Browse the repository at this point in the history
  • Loading branch information
sneumann committed Nov 20, 2024
1 parent d3e8acf commit f9796eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: xcms
Version: 4.5.0
Version: 4.5.1
Title: LC-MS and GC-MS Data Analysis
Description: Framework for processing and visualization of chromatographically
separated and single-spectra mass spectral data. Imports from AIA/ANDI NetCDF,
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# xcms 4.5.1

## Changes in version 4.5.1

- Fix compile errors with R-4.5

# xcms 4.3

## Changes in version 4.3.4
Expand Down
12 changes: 6 additions & 6 deletions src/massifquant/xcms_massifquant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extern "C" SEXP massifquant(SEXP mz, SEXP intensity, SEXP scanindex,
}

if ((scanrangeFrom < firstScan) || (scanrangeFrom > totalScanNums) || (scanrangeTo < firstScan) || (scanrangeTo > totalScanNums))
error("Error in scanrange \n");
Rf_error("Error in scanrange \n");

//show the progress please
Rprintf("\n Detecting Kalman ROI's ... \n percent finished: ");
Expand Down Expand Up @@ -112,17 +112,17 @@ extern "C" SEXP massifquant(SEXP mz, SEXP intensity, SEXP scanindex,
Rprintf(" %d\n", 100);

const char *names[N_NAMES] = {"mz", "mzmin", "mzmax", "scmin", "scmax", "length", "intensity"};
PROTECT(list_names = allocVector(STRSXP, N_NAMES));
PROTECT(list_names = Rf_allocVector(STRSXP, N_NAMES));
for(int j = 0; j < N_NAMES; j++)
SET_STRING_ELT(list_names, j, mkChar(names[j]));
SET_STRING_ELT(list_names, j, Rf_mkChar(names[j]));

PROTECT(peaklist = allocVector(VECSXP, busybody.getPicCounts()));
PROTECT(peaklist = Rf_allocVector(VECSXP, busybody.getPicCounts()));
for (int i=0;i<busybody.getPicCounts();i++) {

std::vector<double> featInfo = busybody.iterOverFeatures(i, pscantime);
//jo int scanLength = int(featInfo.at(5) - featInfo.at(4) + 1);

PROTECT(entrylist = allocVector(VECSXP, N_NAMES));
PROTECT(entrylist = Rf_allocVector(VECSXP, N_NAMES));

//allow for new vars declared to be passed out
PROTECT(vmz = NEW_NUMERIC(1));
Expand Down Expand Up @@ -153,7 +153,7 @@ extern "C" SEXP massifquant(SEXP mz, SEXP intensity, SEXP scanindex,
SET_VECTOR_ELT(entrylist, 5, vlength);
SET_VECTOR_ELT(entrylist, 6, vintensity);

setAttrib(entrylist, R_NamesSymbol, list_names); //attaching the vector names
Rf_setAttrib(entrylist, R_NamesSymbol, list_names); //attaching the vector names
SET_VECTOR_ELT(peaklist, i, entrylist);
UNPROTECT(N_NAMES + 1); //entrylist + values
}
Expand Down

0 comments on commit f9796eb

Please sign in to comment.