Changeset 39327 in vbox for trunk/src/VBox/Runtime/r3/stream.cpp
- Timestamp:
- Nov 16, 2011 10:52:07 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/stream.cpp
r38904 r39327 96 96 0, 97 97 stdin, 98 true, 98 true, 99 99 /*.fBinary = */ false, 100 100 /*.fRecheckMode = */ true … … 109 109 RTSTREAM_MAGIC, 110 110 0, 111 stderr, 111 stderr, 112 112 true, 113 113 /*.fBinary = */ false, … … 469 469 470 470 /** 471 * Recheck the stream mode. 472 * 471 * Recheck the stream mode. 472 * 473 473 * @param pStream The stream (locked). 474 474 */ … … 564 564 565 565 /** 566 * Check if the input text is valid UTF-8. 567 * 566 * Check if the input text is valid UTF-8. 567 * 568 568 * @returns true/false. 569 569 * @param pvBuf Pointer to the buffer. … … 581 581 #ifdef RT_OS_WINDOWS 582 582 /** 583 * Check if the stream is for a Window console. 584 * 583 * Check if the stream is for a Window console. 584 * 585 585 * @returns true / false. 586 586 * @param pStream The stream. … … 606 606 607 607 /** 608 * Internal write API, stream lock already held. 609 * 608 * Internal write API, stream lock already held. 609 * 610 610 * @returns IPRT status code. 611 611 * @param pStream The stream. 612 612 * @param pvBuf What to write. 613 613 * @param cbWrite How much to write. 614 * @param pcbWritten Where to optionally return the number of bytes 614 * @param pcbWritten Where to optionally return the number of bytes 615 615 * written. 616 616 * @param fSureIsText Set if we're sure this is UTF-8 text already. 617 617 */ 618 static int rtStrmWriteLocked(PRTSTREAM pStream, const void *pvBuf, size_t cbWrite, size_t *pcbWritten, 618 static int rtStrmWriteLocked(PRTSTREAM pStream, const void *pvBuf, size_t cbWrite, size_t *pcbWritten, 619 619 bool fSureIsText) 620 620 { … … 627 627 #ifdef RT_OS_WINDOWS 628 628 /* 629 * Use the unicode console API when possible in order to avoid stuff 629 * Use the unicode console API when possible in order to avoid stuff 630 630 * getting lost in unnecessary code page translations. 631 631 */ … … 656 656 if (!WriteConsoleW(hCon, &pwszSrc[cwcWritten], 1, &cwcThis, NULL)) 657 657 { 658 if (!pcbWritten || cwcWritten == 0) 658 if (!pcbWritten || cwcWritten == 0) 659 659 rc = RTErrConvertFromErrno(GetLastError()); 660 660 break; … … 696 696 return rc; 697 697 } 698 #endif /* RT_OS_WINDOWS */ 698 #endif /* RT_OS_WINDOWS */ 699 699 700 700 /* 701 * If we're sure it's text output, convert it from UTF-8 to the current 702 * code page before printing it. 703 * 704 * Note! Partial writes are not supported in this scenario because we 701 * If we're sure it's text output, convert it from UTF-8 to the current 702 * code page before printing it. 703 * 704 * Note! Partial writes are not supported in this scenario because we 705 705 * cannot easily report back a written length matching the input. 706 706 */ … … 708 708 if ( pStream->fCurrentCodeSet 709 709 && !pStream->fBinary 710 && ( fSureIsText 710 && ( fSureIsText 711 711 || rtStrmIsUtf8Text(pvBuf, cbWrite)) 712 712 ) … … 761 761 762 762 /* 763 * Otherwise, just write it as-is. 763 * Otherwise, just write it as-is. 764 764 */ 765 765 if (pcbWritten) … … 809 809 810 810 /** 811 * Internal write API. 812 * 811 * Internal write API. 812 * 813 813 * @returns IPRT status code. 814 814 * @param pStream The stream. 815 815 * @param pvBuf What to write. 816 816 * @param cbWrite How much to write. 817 * @param pcbWritten Where to optionally return the number of bytes 817 * @param pcbWritten Where to optionally return the number of bytes 818 818 * written. 819 819 * @param fSureIsText Set if we're sure this is UTF-8 text already.
Note:
See TracChangeset
for help on using the changeset viewer.