Skip to content

Use consistent types with fwriteMainArgs.nrow.#4213

Merged
mattdowle merged 1 commit intoRdatatable:masterfrom
QuLogic:nrow-typecast
Feb 16, 2020
Merged

Use consistent types with fwriteMainArgs.nrow.#4213
mattdowle merged 1 commit intoRdatatable:masterfrom
QuLogic:nrow-typecast

Conversation

@QuLogic
Copy link
Copy Markdown
Contributor

@QuLogic QuLogic commented Jan 30, 2020

On armv7hl, test 1737.5 fails due to garbage in the column length mismatch error message. This is because the message tries to format args.nrow (an int64_t) using %d (i.e., int). Strangely, this does not fail on any other architectures, but this is likely a fluke.

In all the other formatting calls, remove the unnecessary (int64_t) type cast, since fwriteMainArgs.nargs already is one.

See #3492.

On armv7hl, test 1737.5 fails due to garbage in the column length
mismatch error message. This is because the message tries to format
`args.nrow` (an `int64_t`) using `%d` (i.e., `int`). Strangely, this
does not fail on any other architectures, but this is likely a fluke.

In all the other formatting calls, remove the unnecessary `(int64_t)`
type cast, since `fwriteMainArgs.nargs` already is one.
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 30, 2020

Codecov Report

Merging #4213 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4213   +/-   ##
=======================================
  Coverage   99.61%   99.61%           
=======================================
  Files          72       72           
  Lines       13871    13871           
=======================================
  Hits        13817    13817           
  Misses         54       54
Impacted Files Coverage Δ
src/fwrite.c 97.92% <100%> (ø) ⬆️
src/fwriteR.c 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c005296...8c4138f. Read the comment docs.

Comment thread src/fwriteR.c
int max=0;
SEXP last=NULL;
for (int i=0; i<n; ++i) {
for (int64_t i=0; i<n; ++i) {
Copy link
Copy Markdown
Member

@mattdowle mattdowle Feb 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great spot! Thanks.

Comment thread src/fwriteR.c
for (int j=0; j<args.ncol; j++) {
SEXP column = VECTOR_ELT(DFcoerced, j);
if (args.nrow != length(column))
error(_("Column %d's length (%d) is not the same as column 1's length (%d)"), j+1, length(column), args.nrow);
Copy link
Copy Markdown
Member

@mattdowle mattdowle Feb 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great spot too. Yes this would cause that strange number in the error message.

@mattdowle mattdowle added this to the 1.12.9 milestone Feb 16, 2020
@mattdowle
Copy link
Copy Markdown
Member

Thanks for debugging these issues! I've invited you to be project member. Please accept the invitation button in your GitHub profile or projects page. I'll add you to DESCRIPTION too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants