You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1570,7 +1570,7 @@ int freadMain(freadMainArgs _args) {
1570
1570
DTPRINT(_("Avoidable file copy in RAM took %.3f seconds. %s.\n"), time_taken, msg); // # nocov. not warning as that could feasibly cause CRAN tests to fail, say, if test machine is heavily loaded
1571
1571
}
1572
1572
}
1573
-
*_const_cast(eof) ='\0'; // cow page
1573
+
*const_cast(eof) ='\0'; // cow page
1574
1574
}
1575
1575
// else char* input already guaranteed to end with \0. We do not modify direct char* input at all, ever.
1576
1576
// We have now ensured the input ends on eof and that *eof=='\0' too. Normally, lastEOLreplaced will be true.
@@ -1862,8 +1862,8 @@ int freadMain(freadMainArgs _args) {
1862
1862
if (verbose) DTPRINT(_(" 1-column file ends with 2 or more end-of-line. Restoring last eol using extra byte in cow page.\n"));
1863
1863
eof++;
1864
1864
}
1865
-
*_const_cast(eof-1) =eol_one_r ? '\r' : '\n';
1866
-
*_const_cast(eof) ='\0';
1865
+
*const_cast(eof-1) =eol_one_r ? '\r' : '\n';
1866
+
*const_cast(eof) ='\0';
1867
1867
}
1868
1868
}
1869
1869
@@ -1876,7 +1876,7 @@ int freadMain(freadMainArgs _args) {
1876
1876
int64_testnrow=1;
1877
1877
int64_tallocnrow=0; // Number of rows in the allocated DataTable
1878
1878
doublemeanLineLen=0.0; // Average length (in bytes) of a single line in the input file
1879
-
ptrdiff_tbytesRead=0; // Bytes in the data section (i.e. excluding column names, header and footer, if any)
1879
+
size_tbytesRead=0; // Bytes in the data section (i.e. excluding column names, header and footer, if any)
1880
1880
{
1881
1881
if (verbose) DTPRINT(_("[07] Detect column types, dec, good nrow estimate and whether first row is column names\n"));
1882
1882
if (verbose&&args.header!=NA_BOOL8) DTPRINT(_(" 'header' changed by user from 'auto' to %s\n"), args.header?"true":"false");
@@ -1940,8 +1940,8 @@ int freadMain(freadMainArgs _args) {
1940
1940
}
1941
1941
firstRowStart=ch;
1942
1942
} else {
1943
-
ch= (jump==nJumps-1) ? eof- (ptrdiff_t)(0.5*jump0size) : // to almost-surely sample the last line
1944
-
pos+jump*((eof-pos)/(nJumps-1));
1943
+
ch= (jump==nJumps-1) ? eof- (size_t)(0.5*jump0size) : // to almost-surely sample the last line
if (ch<lastRowEnd) ch=lastRowEnd; // Overlap when apx 1,200 lines (just over 11*100) with short lines at the beginning and longer lines near the end, #2157
@@ -1978,7 +1978,7 @@ int freadMain(freadMainArgs _args) {
1978
1978
if (jump==0&&bumped) {
1979
1979
// apply bumps after each line in the first jump from the start in case invalid line stopped early on is in the first 100 lines.
1980
1980
// otherwise later jumps must complete fully before their bumps are applied. Invalid lines in those are more likely to be due to bad jump start.
1981
-
memcpy(type, tmpType, ncol);
1981
+
memcpy(type, tmpType, (size_t)ncol);
1982
1982
bumped= false; // detect_types() only updates &bumped when it's true. So reset to false here.
1983
1983
}
1984
1984
}
@@ -1992,7 +1992,7 @@ int freadMain(freadMainArgs _args) {
1992
1992
if (bumped) {
1993
1993
// when jump>0, apply the bumps (if any) at the end of the successfully completed jump sample
1994
1994
ASSERT(jump>0, "jump(%d)>0", jump);
1995
-
memcpy(type, tmpType, ncol);
1995
+
memcpy(type, tmpType, (size_t)ncol);
1996
1996
}
1997
1997
if (verbose&& (bumped||jump==0||jump==nJumps-1)) {
0 commit comments