-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
53 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,8 +170,7 @@ SEXP fwriteR( | |
SEXP bom_Arg, | ||
SEXP yaml_Arg, | ||
SEXP verbose_Arg, | ||
SEXP encoding_Arg, | ||
SEXP rn_Arg // the actual row.names to be used #4957 | ||
SEXP encoding_Arg | ||
) | ||
{ | ||
if (!isNewList(DF)) error(_("fwrite must be passed an object of type list; e.g. data.frame, data.table")); | ||
|
@@ -257,8 +256,22 @@ SEXP fwriteR( | |
// so we need a separate boolean flag as well as the row names should they exist (rare) | ||
args.doRowNames = LOGICAL(rowNames_Arg)[0]; | ||
args.rowNames = NULL; | ||
args.rowNameFun = 0; | ||
if (args.doRowNames) { | ||
args.rowNames = DATAPTR_RO(rn_Arg); | ||
SEXP rn = PROTECT(getAttrib(DF, R_RowNamesSymbol)); | ||
protecti++; | ||
if (isInteger(rn)) { | ||
if (xlength(rn)!=2 || INTEGER(rn)[0]==NA_INTEGER) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mattdowle
Author
Member
|
||
// not R's default rownames c(NA,-nrow) | ||
if (xlength(rn) != args.nrow) | ||
error(_("input has specific integer rownames but their length (%"PRId64") != nrow (%"PRId64")"), xlength(rn), args.nrow); // # nocov | ||
args.rowNames = INTEGER(rn); | ||
args.rowNameFun = WF_Int32; | ||
} | ||
} else if (isString(rn)) { | ||
args.rowNames = DATAPTR_RO(rn); | ||
args.rowNameFun = WF_String; | ||
} | ||
} | ||
|
||
args.sep = *CHAR(STRING_ELT(sep_Arg, 0)); // DO NOT DO: allow multichar separator (bad idea) | ||
|
does a 0-row table have 0-length row names? if so [0] here is out of bounds. could it also happen of the next line is an error?