Skip to content

Commit

Permalink
zstd compression is in -19...19, not 9
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87601 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Jan 20, 2025
1 parent da26644 commit 307f31b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/library/base/man/connections.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ socketTimeout(socket, timeout = -1)
requests. It is ignored for non-HTTP URLs. The \code{User-Agent}
header, coming from the \code{HTTPUserAgent} option (see
\code{\link{options}}) is used as the first header, automatically.}
\item{compression}{integer in 0--9. The amount of compression to be
applied when writing, from none to maximal available. For
\code{xzfile} and \code{zstdfile} can also be negative: see the
\sQuote{Compression} section.}
\item{compression}{integer in 0--9 (1--19 for \code{zsdfile}). The
amount of compression to be applied when writing, from minimal to
maximal available. For \code{xzfile} and \code{zstdfile} can also
be negative: see the \sQuote{Compression} section.}
\item{timeout}{numeric: the timeout (in seconds) to be used for this
connection. Beware that some OSes may treat very large values as
zero: however the POSIX standard requires values up to 31 days to be
Expand Down
7 changes: 6 additions & 1 deletion src/main/connections.c
Original file line number Diff line number Diff line change
Expand Up @@ -2754,11 +2754,16 @@ attribute_hidden SEXP do_gzfile(SEXP call, SEXP op, SEXP args, SEXP env)
if(compress == NA_LOGICAL || compress < 0 || compress > 9)
error(_("invalid '%s' argument"), "compress");
}
if(type == 2 || type == 3) {
if(type == 2) {
compress = asInteger(CADDDR(args));
if(compress == NA_LOGICAL || abs(compress) > 9)
error(_("invalid '%s' argument"), "compress");
}
if(type == 3) {
compress = asInteger(CADDDR(args));
if(compress == NA_LOGICAL || abs(compress) > 19)
error(_("invalid '%s' argument"), "compress");
}
open = CHAR(STRING_ELT(sopen, 0)); /* ASCII */
if (type == 0 && (!open[0] || open[0] == 'r')) {
/* check magic no */
Expand Down

0 comments on commit 307f31b

Please sign in to comment.