@@ -755,16 +755,14 @@ void fwriteMain(fwriteMainArgs args)
755755 // Decide buffer size and rowsPerBatch for each thread
756756 // Once rowsPerBatch is decided it can't be changed
757757
758- // # nocov start
759758 // if maxLineLen is greater than buffSize, increase buffSize
760759 if (buffSize < maxLineLen ) {
761- buffSize = maxLineLen ;
760+ buffSize = maxLineLen ; // # nocov
762761 }
763762 // ensure buffer can take header line
764763 if (nth * buffSize < headerLen ) {
765- buffSize = headerLen / nth + 1 ;
764+ buffSize = headerLen / nth + 1 ; // # nocov
766765 }
767- // # nocov end
768766
769767 int rowsPerBatch = buffSize / maxLineLen ;
770768 // + 1 because of the last incomplete loop
@@ -793,10 +791,8 @@ void fwriteMain(fwriteMainArgs args)
793791 }
794792 char * buffPool = malloc (alloc_size );
795793 if (!buffPool ) {
796- // # nocov start
797- STOP (_ ("Unable to allocate %zu MB * %d thread buffers; '%d: %s'. Please read ?fwrite for nThread, buffMB and verbose options." ),
798- buffSize / MEGA , nth , errno , strerror (errno ));
799- // # nocov end
794+ STOP (_ ("Unable to allocate %zu MB * %d thread buffers; '%d: %s'. Please read ?fwrite for nThread, buffMB and verbose options." ), // # nocov
795+ buffSize / MEGA , nth , errno , strerror (errno )); // # nocov
800796 }
801797
802798 // init compress variables
@@ -923,15 +919,13 @@ void fwriteMain(fwriteMainArgs args)
923919 DTPRINT (_ ("Initialization done in %.3fs\n" ), 1.0 * (wallclock ()- t0 ));
924920
925921 // empty file is test in fwrite.R
926- // # nocov start
927922 if (args .nrow == 0 ) {
928923 if (verbose )
929- DTPRINT (_ ("No data rows present (nrow==0)\n" ));
924+ DTPRINT (_ ("No data rows present (nrow==0)\n" )); // # nocov
930925 if (f != -1 && CLOSE (f ))
931- STOP (_ ("%s: '%s'" ), strerror (errno ), args .filename );
932- return ;
926+ STOP (_ ("%s: '%s'" ), strerror (errno ), args .filename ); // # nocov
927+ return ; // # nocov
933928 }
934- // # nocov end
935929
936930 // Write rows ----
937931
@@ -1015,12 +1009,10 @@ void fwriteMain(fwriteMainArgs args)
10151009 // ordered region ----
10161010#pragma omp ordered
10171011 if (failed ) {
1018- // # nocov start
10191012 if (failed_compress == 0 && my_failed_compress != 0 ) {
1020- failed_compress = my_failed_compress ;
1013+ failed_compress = my_failed_compress ; // # nocov
10211014 }
10221015 // else another thread could have failed below while I was working or waiting above; their reason got here first
1023- // # nocov end
10241016 } else {
10251017 errno = 0 ;
10261018 int ret = 0 ;
@@ -1056,20 +1048,18 @@ void fwriteMain(fwriteMainArgs args)
10561048 // Not only is this ordered section one-at-a-time but we'll also Rprintf() here only from the
10571049 // master thread (me==0) and hopefully this will work on Windows. If not, user should set
10581050 // showProgress=FALSE until this can be fixed or removed.
1059- // # nocov start
10601051 int ETA = (int )((args .nrow - end ) * (now - startTime ) /end );
10611052 if (hasPrinted || ETA >= 2 ) {
10621053 if (verbose && !hasPrinted )
1063- DTPRINT ("\n" );
1054+ DTPRINT ("\n" ); // # nocov
10641055 DTPRINT (Pl_ (nth ,
1065- "\rWritten %.1f%% of %" PRId64 " rows in %d secs using %d thread. maxBuffUsed=%d%%. ETA %d secs. " ,
1066- "\rWritten %.1f%% of %" PRId64 " rows in %d secs using %d threads. maxBuffUsed=%d%%. ETA %d secs. " ),
1067- (100.0 * end )/args .nrow , args .nrow , (int )(now - startTime ), nth , maxBuffUsedPC , ETA );
1068- // TODO: use progress() as in fread
1056+ "\rWritten %.1f%% of %" PRId64 " rows in %d secs using %d thread. maxBuffUsed=%d%%. ETA %d secs. " ,
1057+ "\rWritten %.1f%% of %" PRId64 " rows in %d secs using %d threads. maxBuffUsed=%d%%. ETA %d secs. " ),
1058+ (100.0 * end )/args .nrow , args .nrow , (int )(now - startTime ), nth , maxBuffUsedPC , ETA ); // # nocov
1059+ // TODO: use progress() as in fread
10691060 nextTime = now + 1 ;
10701061 hasPrinted = true;
10711062 }
1072- // # nocov end
10731063 }
10741064 }
10751065 if (args .is_gzip ) {
@@ -1106,14 +1096,12 @@ void fwriteMain(fwriteMainArgs args)
11061096
11071097 // Finished parallel region and can call R API safely now.
11081098 if (hasPrinted ) {
1109- // # nocov start
11101099 if (!failed ) { // clear the progress meter
11111100 DTPRINT ("\r "
11121101 " \r\n" );
11131102 } else { // don't clear any potentially helpful output before error
1114- DTPRINT ("\n" );
1103+ DTPRINT ("\n" ); // # nocov
11151104 }
1116- // # nocov end
11171105 }
11181106
11191107 if (verbose ) {
@@ -1135,16 +1123,14 @@ void fwriteMain(fwriteMainArgs args)
11351123 // '&& !failed' is to not report the error as just 'closing file' but the next line for more detail
11361124 // from the original error.
11371125 if (failed ) {
1138- // # nocov start
11391126#ifndef NOZLIB
11401127 if (failed_compress )
1141- STOP (_ ("zlib %s (zlib.h %s) deflate() returned error %d Z_FINISH=%d Z_BLOCK=%d. %s" ),
1142- zlibVersion (), ZLIB_VERSION , failed_compress , Z_FINISH , Z_BLOCK ,
1143- verbose ? _ ("Please include the full output above and below this message in your data.table bug report." )
1144- : _ ("Please retry fwrite() with verbose=TRUE and include the full output with your data.table bug report." ));
1128+ STOP (_ ("zlib %s (zlib.h %s) deflate() returned error %d Z_FINISH=%d Z_BLOCK=%d. %s" ), // # nocov
1129+ zlibVersion (), ZLIB_VERSION , failed_compress , Z_FINISH , Z_BLOCK , // # nocov
1130+ verbose ? _ ("Please include the full output above and below this message in your data.table bug report." ) // # nocov
1131+ : _ ("Please retry fwrite() with verbose=TRUE and include the full output with your data.table bug report." )); // # nocov
11451132#endif
11461133 if (failed_write )
1147- STOP ("%s: '%s'" , strerror (failed_write ), args .filename );
1148- // # nocov end
1134+ STOP ("%s: '%s'" , strerror (failed_write ), args .filename ); // # nocov
11491135 }
11501136}
0 commit comments