< prev index next >

src/share/vm/compiler/compileLog.cpp

Print this page
rev 13166 : read/write APIs in class os shall return ssize_t

*** 214,234 **** file->print_raw("<compilation_log thread='"); jio_snprintf(buf, buflen, UINTX_FORMAT, log->thread_id()); file->print_raw(buf); file->print_raw_cr("'>"); ! size_t nr; // number read into buf from partial log // Copy data up to the end of the last <event> element: julong to_read = log->_file_end; while (to_read > 0) { if (to_read < (julong)buflen) ! nr = (size_t)to_read; else nr = buflen; nr = read(partial_fd, buf, (int)nr); if (nr <= 0) break; to_read -= (julong)nr; ! file->write(buf, nr); } // Copy any remaining data inside a quote: bool saw_slop = false; int end_cdata = 0; // state machine [0..2] watching for too many "]]" --- 214,234 ---- file->print_raw("<compilation_log thread='"); jio_snprintf(buf, buflen, UINTX_FORMAT, log->thread_id()); file->print_raw(buf); file->print_raw_cr("'>"); ! ssize_t nr; // number read into buf from partial log // Copy data up to the end of the last <event> element: julong to_read = log->_file_end; while (to_read > 0) { if (to_read < (julong)buflen) ! nr = (ssize_t)to_read; else nr = buflen; nr = read(partial_fd, buf, (int)nr); if (nr <= 0) break; to_read -= (julong)nr; ! file->write(buf, (size_t)nr); } // Copy any remaining data inside a quote: bool saw_slop = false; int end_cdata = 0; // state machine [0..2] watching for too many "]]"
*** 245,255 **** // in case there is a CDATA quote embedded in the fragment. const char* bufp; // pointer into buf size_t nw; // number written in each pass of the following loop: for (bufp = buf; nr > 0; nr -= nw, bufp += nw) { // Write up to any problematic CDATA delimiter (usually all of nr). ! for (nw = 0; nw < nr; nw++) { // First, scan ahead into the buf, checking the state machine. switch (bufp[nw]) { case ']': if (end_cdata < 2) end_cdata += 1; // saturating counter continue; // keep scanning --- 245,255 ---- // in case there is a CDATA quote embedded in the fragment. const char* bufp; // pointer into buf size_t nw; // number written in each pass of the following loop: for (bufp = buf; nr > 0; nr -= nw, bufp += nw) { // Write up to any problematic CDATA delimiter (usually all of nr). ! for (nw = 0; nw < (size_t)nr; nw++) { // First, scan ahead into the buf, checking the state machine. switch (bufp[nw]) { case ']': if (end_cdata < 2) end_cdata += 1; // saturating counter continue; // keep scanning
*** 266,276 **** // CDATA sequences into the compilation log. break; } // Now nw is the number of characters to write, usually == nr. file->write(bufp, nw); ! if (nw < nr) { // We are about to go around the loop again. // But first, disrupt the ]]> by closing and reopening the quote. file->print_raw("]]><![CDATA["); end_cdata = 0; // reset state machine } --- 266,276 ---- // CDATA sequences into the compilation log. break; } // Now nw is the number of characters to write, usually == nr. file->write(bufp, nw); ! if (nw < (size_t)nr) { // We are about to go around the loop again. // But first, disrupt the ]]> by closing and reopening the quote. file->print_raw("]]><![CDATA["); end_cdata = 0; // reset state machine }
< prev index next >