Skip to content

Commit

Permalink
Refactoring to solve r-hub warnings
Browse files Browse the repository at this point in the history
r-hub includes platforms that check for protection-stack imbalances
  • Loading branch information
MarcusKlik committed Nov 14, 2017
1 parent 8083367 commit 8c19079
Show file tree
Hide file tree
Showing 18 changed files with 912 additions and 857 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Expand Up @@ -5,6 +5,5 @@
\.a$
\.Rmd$
\.md$
\.fst$
\.png$
\.yml$
26 changes: 26 additions & 0 deletions CONDUCT.md
@@ -0,0 +1,26 @@

# Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for
everyone, regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or
imagery, derogatory comments or personal attacks, trolling, public or private harassment,
insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments,
commits, code, wiki edits, issues, and other contributions that are not aligned to this
Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant
(http://contributor-covenant.org), version 1.0.0, available at
http://contributor-covenant.org/version/1/0/0/
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,20 @@

Contributions to `fst` are welcome from anyone and are best sent as pull requests on [the GitHub repository](https://github.com/fstpackage/fst/). This page provides some instructions to potential contributors about how to add to the package.

1. Contributions can be submitted as [a pull request](https://help.github.com/articles/creating-a-pull-request/) on GitHub by forking or cloning the [fst repository](https://github.com/fstpackage/fst/), making changes and submitting the pull request.

2. Pull requests should involve only one commit per substantive change. This means if you change multiple files (e.g., code and documentation), these changes should be committed together. If you don't know how to do this (e.g., you are making changes in the GitHub web interface) just submit anyway and the maintainer will clean things up.

3. Pull requests that involve code in the 3rd party libraries `LZ4`, `ZSTD` or `fstlib` (located under `src/fstcore`) will not be accepted. These libraries are used _as-is_ and any issues can be reported at their respective GitHub repositories.

4. All contributions must be submitted consistent with the package license ([AGPL-3](https://www.gnu.org/licenses/agpl-3.0.en.html)).

5. All contributions need to be noted in the `Authors@R` field in the [`DESCRIPTION`](https://github.com/fstpackage/fst/blob/master/DESCRIPTION) file. Just follow the format of the existing entries to add your name (and, optionally, email address). Substantial contributions should also be noted in [`inst/CITATION`](https://github.com/fstpackage/fst/blob/master/inst/CITATION).

6. This package uses `royxgen` code and documentation markup, so changes should be made to `roxygen` comments in the source code `.R` files. If changes are made, `roxygen` needs to be run. The easiest way to do this is a command line call to: `Rscript -e devtools::document()`. Please resolve any `roxygen` errors before submitting a pull request.

7. Please run `R CMD BUILD fst` and `R CMD CHECK fst_VERSION.tar.gz` before submitting the pull request to check for any errors.

8. Changes requiring a new package dependency should be discussed on the GitHub issues page before submitting a pull request.

Any questions you have can be opened as GitHub issues or directed to markklik (at) gmail.com.
4 changes: 2 additions & 2 deletions R/compress.R
Expand Up @@ -23,15 +23,15 @@
#' Compress a raw vector using the LZ4 or ZSTD compressor.
#'
#' @param x raw vector.
#' @param compressor compressor to use for compressing \code{x}. Valid options are "LZ4" (default) and "ZSTD".
#' @param compressor compressor to use for compressing \code{x}. Valid options are "LZ4" and "ZSTD" (default).
#' @param compression compression factor used. Must be in the range 0 (lowest compression) to 100 (maximum compression).
#' @param hash Compute hash of compressed data. This hash is stored in the resulting raw vector and
#' can be used during decompression to check the validity of the compressed vector. Hash
#' computation is done with the very fast xxHash algorithm and implemented as a parallel operation,
#' so the performance hit will be very small.
#'
#' @export
compress_fst <- function(x, compressor = "LZ4", compression = 0, hash = FALSE) {
compress_fst <- function(x, compressor = "ZSTD", compression = 0, hash = FALSE) {
if (!is.numeric(compression)) {
stop("Parameter compression should be a numeric value in the range 0 to 100")
}
Expand Down
24 changes: 15 additions & 9 deletions cran-comments.md
@@ -1,20 +1,26 @@

## Test environments
* OS X on travis-ci (old, release and devel), R 3.1.2
* Ubuntu 12.04 on travis-ci (old, release and devel) R 3.1.2
* Windows 10 local and on AppVeyor (old, release and devel) R 3.1.2

* OS X on travis-ci (old, release and devel)
* Ubuntu 14.04 on travis-ci (old, release and devel)
* Ubuntu 16.04 locally
* docker with the rocker/r-devel-ubsan-clang instrumented image
* docker with the rocker/r-devel-san instrumented image
* Windows 10 local R 3.4.2
* Windows Server 2012 R2 x64 (build 9600) on AppVeyor R 3.4.2
* R-hub all available platforms

## R CMD check results

There were no ERRORs or WARNINGs.
There were no NOTEs

## Downstream dependencies

I have also run R CMD check on downstream dependencies of httr
(https://github.com/wch/checkresults/blob/master/httr/r-release).
I have run R CMD check on downstream dependencies:

*
*

All packages that I could install passed except:

* Ecoengine: this appears to be a failure related to config on
that machine. I couldn't reproduce it locally, and it doesn't
seem to be related to changes in httr (the same problem exists
with httr 0.4).
4 changes: 2 additions & 2 deletions man/compress_fst.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/fst_column.h
Expand Up @@ -371,8 +371,8 @@ class IntegerColumn : public IIntegerColumn
{
if (annotation.length() > 0)
{
SEXP timeZone = Rf_ScalarString(Rf_mkCharLen(annotation.c_str(), annotation.length()));
Rf_setAttrib(colVec, Rf_install("tzone"), timeZone);
Rf_setAttrib(colVec, Rf_install("tzone"),
Rf_ScalarString(Rf_mkCharLen(annotation.c_str(), annotation.length())));
return;
}

Expand Down
12 changes: 3 additions & 9 deletions src/fst_compress.cpp
Expand Up @@ -115,28 +115,22 @@ SEXP fstdecomp(SEXP rawVec)
unsigned long long vecLength = Rf_xlength(rawVec);
unsigned char* data = (unsigned char*) (RAW(rawVec));

BlobContainer* resultContainer = nullptr;
std::unique_ptr<BlobContainer> resultContainerP;

try
{
resultContainer = static_cast<BlobContainer*>(fstcompressor.DecompressBlob(data, vecLength));
resultContainerP = std::unique_ptr<BlobContainer>(static_cast<BlobContainer*>(fstcompressor.DecompressBlob(data, vecLength)));
}
catch(const std::runtime_error& e)
{
delete resultContainer;

return fst_error(e.what());
}
catch ( ... )
{
delete resultContainer;

return fst_error("Error detected while decompressing data.");
}

SEXP resVec = resultContainer->RVector();

delete resultContainer;
SEXP resVec = resultContainerP->RVector();

return resVec;
}
Expand Down
7 changes: 6 additions & 1 deletion src/fst_error.cpp
Expand Up @@ -27,8 +27,13 @@

SEXP fst_error(const char* error_message)
{
SEXP fst_error = Rf_mkString(error_message);
SEXP fst_error;

PROTECT(fst_error = Rf_mkString(error_message));

Rf_classgets(fst_error, Rf_mkString("fst_error"));

UNPROTECT(1);

return fst_error;
}
2 changes: 1 addition & 1 deletion src/fst_table.cpp
Expand Up @@ -448,8 +448,8 @@ void FstTable::SetFactorColumn(IFactorColumn* factorColumn, int colNr)
PROTECT(classes = Rf_allocVector(STRSXP, 2));
SET_STRING_ELT(classes, 0, Rf_mkChar("ordered"));
SET_STRING_ELT(classes, 1, Rf_mkChar("factor"));
UNPROTECT(1);
Rf_setAttrib(factColumn->intVec, Rf_mkString("class"), classes);
UNPROTECT(1);
}
else // unordered factor
{
Expand Down

0 comments on commit 8c19079

Please sign in to comment.