From f716fe79f8dafe327aad3737d660e741676bf91e Mon Sep 17 00:00:00 2001 From: Rudolf Hornig Date: Tue, 11 Dec 2012 12:28:01 +0100 Subject: [PATCH] further warning fixes for cran submission. --- NOTES | 4 ++-- R-package/src/common/commonutil.cc | 2 ++ R-package/src/common/commonutil.h | 3 +++ R-package/src/loadDataset.cc | 2 +- R-package/src/scave/export.cc | 4 ++-- R-package/src/scave/mergernodes.cc | 3 +++ 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/NOTES b/NOTES index 07ab64b..f8d577c 100644 --- a/NOTES +++ b/NOTES @@ -3,8 +3,8 @@ Technical notes: BUILDING: The R source package can be built from the working copy with the - "R CMD build --no-resave-data ." command. To build a binary package, - use "R CMD build --binary --no-resave-data ." command. + "R CMD build --no-resave-data R-package" command. To build a binary package, + use "R CMD build --binary --no-resave-data R-package" command. NOTE: When working on Windows, the same command will work, but the Rtools package needs to be installed and all its bin/ dirs (bin/, perl/bin, MinGW/bin) as diff --git a/R-package/src/common/commonutil.cc b/R-package/src/common/commonutil.cc index 2e54614..6762039 100644 --- a/R-package/src/common/commonutil.cc +++ b/R-package/src/common/commonutil.cc @@ -47,6 +47,7 @@ void setPosixLocale() //---- +/* Commented out, because it uses printf (prohibited under R) int DebugCall::depth; DebugCall::DebugCall(const char *fmt,...) @@ -61,6 +62,7 @@ DebugCall::~DebugCall() { printf("%*s -- %s\n", --depth*2, "", funcname.c_str()); } +*/ //---- diff --git a/R-package/src/common/commonutil.h b/R-package/src/common/commonutil.h index 12df664..90f05ad 100644 --- a/R-package/src/common/commonutil.h +++ b/R-package/src/common/commonutil.h @@ -82,6 +82,8 @@ COMMON_API void setPosixLocale(); * Debugging aid: prints a message on entering/leaving methods; message * gets indented according to call depth. See TRACE macro. */ + +/* Commented out, because it uses printf (prohibited under R) class COMMON_API DebugCall { private: @@ -93,6 +95,7 @@ class COMMON_API DebugCall }; #define TRACE DebugCall __x +*/ /** * Performs the RDTSC (read time stamp counter) x86 instruction, and returns diff --git a/R-package/src/loadDataset.cc b/R-package/src/loadDataset.cc index 48a4eae..82e6fd9 100644 --- a/R-package/src/loadDataset.cc +++ b/R-package/src/loadDataset.cc @@ -238,7 +238,7 @@ SEXP exportDataset(ResultFileManager &manager, const IDList &idlist) { int paramsCount = 0, attrCount = 0, runAttrCount = 0; - SEXP dataset, names; + SEXP dataset; PROTECT(dataset = NEW_LIST(9)); setNames(dataset, datasetColumnNames, datasetColumnsLength); diff --git a/R-package/src/scave/export.cc b/R-package/src/scave/export.cc index 2989a61..b3f193a 100644 --- a/R-package/src/scave/export.cc +++ b/R-package/src/scave/export.cc @@ -427,7 +427,7 @@ double JoinedDataTable::getDoubleValue(int row, int col) const void JoinedDataTable::mapTableCell(int row, int col, DataTable* &table, int &tableRow, int &tableCol) const { - Assert(0 <= row && row < rowCount && 0 <= col && col < columnMap.size()); + Assert(0 <= row && row < rowCount && 0 <= col && col < (int)columnMap.size()); if (col == 0) { @@ -494,7 +494,7 @@ void ScaveExport::saveVector(const string &name, const string &description, void ScaveExport::saveVectors(const string &name, const string &description, const IDList &vectors, const vector xyArrays, const ResultFileManager &manager) { - Assert(vectors.size() == xyArrays.size()); + Assert(vectors.size() == (int)xyArrays.size()); vector tables; for (unsigned int i = 0; i < xyArrays.size(); ++i) diff --git a/R-package/src/scave/mergernodes.cc b/R-package/src/scave/mergernodes.cc index 64e4595..34e43de 100644 --- a/R-package/src/scave/mergernodes.cc +++ b/R-package/src/scave/mergernodes.cc @@ -139,6 +139,7 @@ void AggregatorNode::init() case Count: count = 0; break; case Minimum: acc = POSITIVE_INFINITY; break; case Maximum: acc = NEGATIVE_INFINITY; break; + default: throw std::exception(); // cannot happen } } @@ -151,6 +152,7 @@ void AggregatorNode::collect(double value) case Count: count++; break; case Minimum: acc = std::min(value, acc); break; case Maximum: acc = std::max(value, acc); break; + default: throw std::exception(); // cannot happen } } @@ -163,6 +165,7 @@ double AggregatorNode::result() case Count: return count; case Minimum: case Maximum: return acc; + default: throw std::exception(); // cannot happen } }