Skip to content

Commit 808f4b4

Browse files
committed
no need for a limit because there's no internal buffer
1 parent 65efa7a commit 808f4b4

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/fread.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ static inline int64_t clamp_i64t(int64_t x, int64_t lower, int64_t upper) {
205205
* is constructed manually (using say snprintf) that warning(), stop()
206206
* and Rprintf() are all called as warning(_("%s"), msg) and not warning(msg).
207207
*/
208-
static const char* strlim(const char *ch, char buf[static 1002], size_t limit) {
208+
static const char* strlim(const char *ch, char buf[static 500], size_t limit) {
209209
char *ch2 = buf;
210-
limit = imin(limit, 500);
211210
size_t width = 0;
212211
while ((*ch>'\r' || (*ch!='\0' && *ch!='\r' && *ch!='\n')) && width++<limit) {
213212
*ch2++ = *ch++;
@@ -1636,7 +1635,7 @@ int freadMain(freadMainArgs _args) {
16361635
if (ch>=eof) STOP(_("Input is either empty, fully whitespace, or skip has been set after the last non-whitespace."));
16371636
if (verbose) {
16381637
if (lineStart>ch) DTPRINT(_(" Moved forward to first non-blank line (%d)\n"), row1line);
1639-
DTPRINT(_(" Positioned on line %d starting: <<%s>>\n"), row1line, strlim(lineStart, (char[1002]) {}, 30));
1638+
DTPRINT(_(" Positioned on line %d starting: <<%s>>\n"), row1line, strlim(lineStart, (char[500]) {}, 30));
16401639
}
16411640
ch = pos = lineStart;
16421641
}
@@ -1826,7 +1825,7 @@ int freadMain(freadMainArgs _args) {
18261825
if (!fill && tt!=ncol) INTERNAL_STOP("first line has field count %d but expecting %d", tt, ncol); // # nocov
18271826
if (verbose) {
18281827
DTPRINT(_(" Detected %d columns on line %d. This line is either column names or first data row. Line starts as: <<%s>>\n"),
1829-
tt, row1line, strlim(pos, (char[1002]) {}, 30));
1828+
tt, row1line, strlim(pos, (char[500]) {}, 30));
18301829
DTPRINT(_(" Quote rule picked = %d\n"), quoteRule);
18311830
DTPRINT(_(" fill=%s and the most number of columns found is %d\n"), fill?"true":"false", ncol);
18321831
}
@@ -2744,23 +2743,23 @@ int freadMain(freadMainArgs _args) {
27442743
while (ch<eof && *ch!='\n' && *ch!='\r') ch++;
27452744
while (ch<eof && isspace(*ch)) ch++;
27462745
if (ch==eof) {
2747-
DTWARN(_("Discarded single-line footer: <<%s>>"), strlim(skippedFooter, (char[1002]) {}, 500));
2746+
DTWARN(_("Discarded single-line footer: <<%s>>"), strlim(skippedFooter, (char[500]) {}, 500));
27482747
}
27492748
else {
27502749
ch = headPos;
27512750
int tt = countfields(&ch);
27522751
if (fill>0) {
27532752
DTWARN(_("Stopped early on line %"PRIu64". Expected %d fields but found %d. Consider fill=%d or even more based on your knowledge of the input file. Use fill=Inf for reading the whole file for detecting the number of fields. First discarded non-empty line: <<%s>>"),
2754-
(uint64_t)DTi+row1line, ncol, tt, tt, strlim(skippedFooter, (char[1002]) {}, 500));
2753+
(uint64_t)DTi+row1line, ncol, tt, tt, strlim(skippedFooter, (char[500]) {}, 500));
27552754
} else {
27562755
DTWARN(_("Stopped early on line %"PRIu64". Expected %d fields but found %d. Consider fill=TRUE. First discarded non-empty line: <<%s>>"),
2757-
(uint64_t)DTi+row1line, ncol, tt, strlim(skippedFooter, (char[1002]) {}, 500));
2756+
(uint64_t)DTi+row1line, ncol, tt, strlim(skippedFooter, (char[500]) {}, 500));
27582757
}
27592758
}
27602759
}
27612760
}
27622761
if (quoteRuleBumpedCh!=NULL && quoteRuleBumpedCh<headPos) {
2763-
DTWARN(_("Found and resolved improper quoting out-of-sample. First healed line %"PRIu64": <<%s>>. If the fields are not quoted (e.g. field separator does not appear within any field), try quote=\"\" to avoid this warning."), (uint64_t)quoteRuleBumpedLine, strlim(quoteRuleBumpedCh, (char[1002]) {}, 500));
2762+
DTWARN(_("Found and resolved improper quoting out-of-sample. First healed line %"PRIu64": <<%s>>. If the fields are not quoted (e.g. field separator does not appear within any field), try quote=\"\" to avoid this warning."), (uint64_t)quoteRuleBumpedLine, strlim(quoteRuleBumpedCh, (char[500]) {}, 500));
27642763
}
27652764

27662765
if (verbose) {

0 commit comments

Comments
 (0)