Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ void writeNA(SEXP v, const int from, const int n, const bool listNA)
memset(RAW(v)+from, 0, n*sizeof(Rbyte));
break;
case LGLSXP: {
int *vd = (int *)LOGICAL(v);
int *vd = LOGICAL(v);
for (int i=from; i<=to; ++i) vd[i] = NA_LOGICAL;
} break;
case INTSXP: {
Expand Down
2 changes: 1 addition & 1 deletion src/coalesce.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ SEXP coalesce(SEXP x, SEXP inplaceArg) {
if (val!=NA_INTEGER64) xP[i]=val; else if (final) xP[i]=finalVal;
}
} else {
double *xP = (double *)REAL(first), finalVal=NA_REAL;
double *xP = REAL(first), finalVal=NA_REAL;
int k=0;
for (int j=0; j<nval; ++j) {
SEXP item = VECTOR_ELT(x, j+off);
Expand Down
2 changes: 1 addition & 1 deletion src/fread.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ static const char* filesize_to_str(size_t fsize)
double copyFile(size_t fileSize) // only called in very very rare cases
{
double tt = wallclock();
mmp_copy = (char *)malloc((size_t)fileSize + 1 /* extra \0 */);
mmp_copy = (char *)malloc(fileSize + 1 /* extra \0 */);
if (!mmp_copy)
return -1.0; // # nocov
memcpy(mmp_copy, mmp, fileSize);
Expand Down
4 changes: 2 additions & 2 deletions src/freadR.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ void pushBuffer(ThreadLocalFreadParsingContext *ctx)
resj++;
if (type[j]!=CT_STRING && type[j]>0) {
if (thisSize == 8) {
double *dest = (double *)REAL(VECTOR_ELT(DT, resj)) + DTi;
double *dest = REAL(VECTOR_ELT(DT, resj)) + DTi;
const char *src8 = (char*)buff8 + off8;
for (int i=0; i<nRows; ++i) {
*dest = *(double *)src8;
Expand All @@ -633,7 +633,7 @@ void pushBuffer(ThreadLocalFreadParsingContext *ctx)
}
} else
if (thisSize == 4) {
int *dest = (int *)INTEGER(VECTOR_ELT(DT, resj)) + DTi;
int *dest = INTEGER(VECTOR_ELT(DT, resj)) + DTi;
const char *src4 = (char*)buff4 + off4;
// 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);
for (int i=0; i<nRows; ++i) {
Expand Down
16 changes: 8 additions & 8 deletions src/ijoin.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ SEXP lookup(SEXP ux, SEXP xlen, SEXP indices, SEXP gaps, SEXP overlaps, SEXP mul

SEXP vv, tt, lookup, type_lookup;
R_len_t *idx,*count,*type_count,xrows=INTEGER(xlen)[0],uxrows=LENGTH(VECTOR_ELT(ux, 0)),uxcols=LENGTH(ux);
int *from = (int *)INTEGER(VECTOR_ELT(indices, 0));
int *to = (int *)INTEGER(VECTOR_ELT(indices, 1));
int *from = INTEGER(VECTOR_ELT(indices, 0));
int *to = INTEGER(VECTOR_ELT(indices, 1));
clock_t pass1, pass2, pass3, start;
enum {ALL, FIRST, LAST} mult = ALL;
enum {ANY, WITHIN, START, END, EQUAL} type = ANY;
Expand All @@ -31,8 +31,8 @@ SEXP lookup(SEXP ux, SEXP xlen, SEXP indices, SEXP gaps, SEXP overlaps, SEXP mul
// For reference: uxcols-1 = type_count, uxcols-2 = count, uxcols-3 = type_lookup, uxcols-4 = lookup
// first pass: calculate lengths first
start = clock();
count = (int *)INTEGER(VECTOR_ELT(ux, uxcols-2));
type_count = (int *)INTEGER(VECTOR_ELT(ux, uxcols-1));
count = INTEGER(VECTOR_ELT(ux, uxcols-2));
type_count = INTEGER(VECTOR_ELT(ux, uxcols-1));
switch (mult) {
case FIRST:
switch(type) {
Expand Down Expand Up @@ -225,10 +225,10 @@ SEXP overlaps(SEXP ux, SEXP imatches, SEXP multArg, SEXP typeArg, SEXP nomatchAr

R_len_t uxcols=LENGTH(ux),rows=length(VECTOR_ELT(imatches,0));
int nomatch = INTEGER(nomatchArg)[0], totlen=0, thislen;
int *from = (int *)INTEGER(VECTOR_ELT(imatches, 0));
int *to = (int *)INTEGER(VECTOR_ELT(imatches, 1));
int *count = (int *)INTEGER(VECTOR_ELT(ux, uxcols-2));
int *type_count = (int *)INTEGER(VECTOR_ELT(ux, uxcols-1));
int *from = INTEGER(VECTOR_ELT(imatches, 0));
int *to = INTEGER(VECTOR_ELT(imatches, 1));
int *count = INTEGER(VECTOR_ELT(ux, uxcols-2));
int *type_count = INTEGER(VECTOR_ELT(ux, uxcols-1));
SEXP lookup = VECTOR_ELT(ux, uxcols-4);
SEXP type_lookup = VECTOR_ELT(ux, uxcols-3);
SEXP ans, f1__, f2__, tmp1, tmp2;
Expand Down
2 changes: 1 addition & 1 deletion src/negate.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ void negateByRef(SEXP x) {
error("not logical or integer vector"); // # nocov
}
const int n = length(x);
int *ansd = (int *)LOGICAL(x);
int *ansd = LOGICAL(x);
for(int i=0; i<n; ++i) {
ansd[i] ^= (ansd[i] != NA_LOGICAL); // invert true/false but leave NA alone
}
Expand Down
2 changes: 1 addition & 1 deletion src/reorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SEXP reorder(SEXP x, SEXP order)
// This check is once up front, and then idx is applied to all the columns which is where the most time is spent.
}

char *TMP = (char *)R_alloc(nmid, maxSize);
char *TMP = R_alloc(nmid, maxSize);

for (int i=0; i<ncol; ++i) {
const SEXP v = isNewList(x) ? VECTOR_ELT(x,i) : x;
Expand Down
Loading