[Rprotobuf-commits] r676 - pkg/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Dec 31 21:09:56 CET 2013
Author: murray
Date: 2013-12-31 21:09:55 +0100 (Tue, 31 Dec 2013)
New Revision: 676
Modified:
pkg/src/mutators.cpp
Log:
Use a specific enum type rather than casting to int. Also explicitly
cast to void a return value we ignore.
Suggested by: Flexelint
Modified: pkg/src/mutators.cpp
===================================================================
--- pkg/src/mutators.cpp 2013-12-31 20:09:12 UTC (rev 675)
+++ pkg/src/mutators.cpp 2013-12-31 20:09:55 UTC (rev 676)
@@ -200,14 +200,14 @@
default:
Rcpp::stop("cannot cast SEXP to bool");
}
- return (bool)0; // -Wall, should not happen since we only call this when we know it works
+ return (bool)0; // Unreachable. -Wall
}
std::string GET_stdstring(SEXP x, int index) {
if (TYPEOF(x) == STRSXP) {
return (CHAR(STRING_ELT(x, index)));
}
- return ""; // -Wall, should not happen since we only call this when we know it works
+ return ""; // Unreachable. -Wall
}
std::string GET_bytes(SEXP x, int index) {
@@ -228,7 +228,7 @@
default:
Rcpp::stop("cannot cast SEXP to bytes");
}
- return ""; // -Wall, should not happen since we only call this when we know it works
+ return ""; // Unreachable. -Wall
}
/**
@@ -1158,7 +1158,7 @@
// if the R type is RAWSXP and the cpp type is string or bytes,
// then value_size is actually one because the raw vector
// is converted to a string
- int field_type = field_desc->type();
+ GPB::FieldDescriptor::Type field_type = field_desc->type();
if (field_type == TYPE_STRING || field_type == TYPE_BYTES) {
if (TYPEOF(value) == RAWSXP) {
value_size = 1;
@@ -1191,7 +1191,7 @@
Rcpp::CharacterVector names = list.attr("names");
int n = list.size();
for (int i = 0; i < n; i++) {
- setMessageField(message, names[i], list[i]);
+ (void)setMessageField(message, names[i], list[i]);
}
}
More information about the Rprotobuf-commits
mailing list