Skip to content

Commit

Permalink
follow up to #3288 to pass GLCI (R310 & R-vanilla)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdowle committed Apr 23, 2019
1 parent aa8da4b commit 150751e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -9472,10 +9472,10 @@ test(1658.37, fwrite(data.table(a=c(1:3), b=c(1:3)), compress="gzip"), output='a
DT = data.table(a=rep(1:2,each=100), b=rep(1:4,each=25))
fwrite(DT, file=f1<-tempfile(fileext=".gz"))
fwrite(DT, file=f2<-tempfile())
test(1658.38, file.size(f1)<file.size(f2)) # 74 < 804
test(1658.39, fread(f1), DT) # use fread to decompress gz (works cross-platform)
test(1658.38, file.info(f1)$size < file.info(f2)$size) # 74 < 804 (file.size() isn't available in R 3.1.0)
if (test_R.utils) test(1658.39, fread(f1), DT) # use fread to decompress gz (works cross-platform)
fwrite(DT, file=f3<-tempfile(), compress="gzip") # compress to filename not ending .gz
test(1658.40, file.size(f3), file.size(f1))
test(1658.40, file.info(f3)$size, file.info(f1)$size)
unlink(c(f1,f2,f3))
DT = data.table(a=1:3, b=list(1:4, c(3.14, 100e10), c("foo", "bar", "baz")))
test(1658.41, fwrite(DT), output=c("a,b","1,1|2|3|4","2,3.14|1e+12","3,foo|bar|baz"))
Expand Down
3 changes: 1 addition & 2 deletions src/fwriteR.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ const int getMaxListItemLen(const SEXP *col, const int64_t n) {
int width = writerMaxLen[wf];
if (width==0) {
if (wf!=WF_String) STOP("Internal error: row %d of list column has no max length method implemented", i+1); // # nocov
SEXP *elem = STRING_PTR(this);
const int l = LENGTH(this);
for (int j=0; j<l; ++j) width+=LENGTH(*elem++);
for (int j=0; j<l; ++j) width+=LENGTH(STRING_ELT(this, j));
} else {
width = (length(this)+1) * width; // +1 for sep2
}
Expand Down

0 comments on commit 150751e

Please sign in to comment.