Skip to content

Commit 761fd85

Browse files
committed
missed some stuff
1 parent 05e7493 commit 761fd85

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/freadR.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Secondary separator for list() columns, such as columns 11 and 12 in BED (no nee
2525
#define NUT (NUMTYPE + 2) // +1 for "numeric" alias for "double"; +1 for CLASS fallback using as.class() at R level afterwards
2626

2727
// these correspond to typeName, typeSize in fread.c, with few exceptions notes above on the NUT macro.
28-
static int typeSxp[NUT] = { NILSXP, LGLSXP, LGLSXP, LGLSXP, LGLSXP, LGLSXP, LGLSXP, INTSXP, REALSXP, REALSXP, REALSXP, REALSXP, INTSXP, REALSXP, STRSXP, REALSXP, STRSXP };
28+
static int typeSxp[NUT] = { NILSXP, LGLSXP, LGLSXP, LGLSXP, LGLSXP, LGLSXP, LGLSXP, INTSXP, REALSXP, REALSXP, REALSXP, REALSXP, INTSXP, REALSXP, STRSXP, REALSXP, STRSXP };
2929
static char typeRName[NUT][10] = { "NULL", "logical", "logical", "logical", "logical", "logical", "logical", "integer", "integer64", "double", "double", "double", "IDate", "POSIXct", "character", "numeric", "CLASS" };
30-
static int typeEnum[NUT] = { CT_DROP, CT_EMPTY, CT_BOOL8_N, CT_BOOL8_U, CT_BOOL8_T, CT_BOOL8_L, CT_BOOL8_Y, CT_INT32, CT_INT64, CT_FLOAT64, CT_FLOAT64_HEX, CT_FLOAT64_EXT, CT_ISO8601_DATE, CT_ISO8601_TIME, CT_STRING, CT_FLOAT64, CT_STRING };
30+
static int typeEnum[NUT] = { CT_DROP, CT_EMPTY, CT_BOOL8_N, CT_BOOL8_U, CT_BOOL8_T, CT_BOOL8_L, CT_BOOL8_Y, CT_INT32, CT_INT64, CT_FLOAT64, CT_FLOAT64_HEX, CT_FLOAT64_EXT, CT_ISO8601_DATE, CT_ISO8601_TIME, CT_STRING, CT_FLOAT64, CT_STRING };
3131
static colType readInt64As = CT_INT64;
3232
static SEXP selectSxp;
3333
static SEXP dropSxp;
@@ -174,7 +174,7 @@ SEXP freadR(
174174
readInt64As = CT_INT64;
175175
} else if (strcmp(tt, "character") == 0) {
176176
readInt64As = CT_STRING;
177-
} else if (strcmp(tt,"double") == 0 || strcmp(tt, "numeric") == 0) {
177+
} else if (strcmp(tt, "double") == 0 || strcmp(tt, "numeric") == 0) {
178178
readInt64As = CT_FLOAT64;
179179
} else STOP(_("Invalid value integer64='%s'. Must be 'integer64', 'character', 'double' or 'numeric'"), tt);
180180

@@ -439,7 +439,6 @@ bool userOverride(int8_t *type, lenOff *colNames, const char *anchor, const int
439439
return true;
440440
}
441441

442-
443442
size_t allocateDT(int8_t *typeArg, int8_t *sizeArg, int ncolArg, int ndrop, size_t allocNrow) {
444443
// save inputs for use by pushBuffer
445444
size = sizeArg;
@@ -466,8 +465,8 @@ size_t allocateDT(int8_t *typeArg, int8_t *sizeArg, int ncolArg, int ndrop, size
466465
UNPROTECT(nprotect);
467466
}
468467
if (selectRank) {
469-
SEXP tt = PROTECT(allocVector(INTSXP, ncol-ndrop));
470-
int *ttD = INTEGER(tt), *rankD = INTEGER(selectRank), rank=1;
468+
SEXP tt = PROTECT(allocVector(INTSXP, ncol - ndrop));
469+
int *ttD = INTEGER(tt), *rankD = INTEGER(selectRank), rank = 1;
471470
for (int i = 0; i < ncol; i++) if (type[i] != CT_DROP) ttD[rankD[i] - 1] = rank++;
472471
SET_VECTOR_ELT(RCHK, 3, selectRank = tt);
473472
// selectRank now holds the order not the rank (so its name is now misleading). setFinalNRow passes it to setcolorder
@@ -523,7 +522,7 @@ size_t allocateDT(int8_t *typeArg, int8_t *sizeArg, int ncolArg, int ndrop, size
523522
setAttrib(thiscol, sym_tzone, ScalarString(char_UTC)); // see news for v1.13.0
524523
}
525524
SET_TRUELENGTH(thiscol, allocNrow);
526-
DTbytes += RTYPE_SIZEOF(thiscol)*allocNrow;
525+
DTbytes += RTYPE_SIZEOF(thiscol) * allocNrow;
527526
}
528527
resi++;
529528
}
@@ -633,8 +632,7 @@ void pushBuffer(ThreadLocalFreadParsingContext *ctx)
633632
src8 += rowSize8;
634633
dest++;
635634
}
636-
} else
637-
if (thisSize == 4) {
635+
} else if (thisSize == 4) {
638636
int *dest = INTEGER(VECTOR_ELT(DT, resj)) + DTi;
639637
const char *src4 = (char*)buff4 + off4;
640638
// debug line for #3369 ... if (DTi>2638000) printf("freadR.c:460: thisSize==4, resj=%d, %"PRIu64", %d, %d, j=%d, done=%d\n", resj, (uint64_t)DTi, off4, rowSize4, j, done);
@@ -643,8 +641,7 @@ void pushBuffer(ThreadLocalFreadParsingContext *ctx)
643641
src4 += rowSize4;
644642
dest++;
645643
}
646-
} else
647-
if (thisSize == 1) {
644+
} else if (thisSize == 1) {
648645
if (type[j] > CT_BOOL8_Y) STOP(_("Field size is 1 but the field is of type %d\n"), type[j]);
649646
int *dest = LOGICAL(VECTOR_ELT(DT, resj)) + DTi;
650647
const char *src1 = (char*)buff1 + off1;

0 commit comments

Comments
 (0)