- 時間撮記:
- 2016-4-11 下午07:08:38 (9 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestFailed.c
r60311 r60439 40 40 BS3_DECL_CALLBACK(size_t) bs3TestFailedStrOutput(char ch, void BS3_FAR *pvUser) 41 41 { 42 bool *pfNewLine = (bool *)pvUser;42 PBS3TESTFAILEDBUF pBuf = (PBS3TESTFAILEDBUF)pvUser; 43 43 44 44 /* … … 48 48 if (g_fbBs3VMMDevTesting) 49 49 { 50 if ( *pfNewLine && ch != '\0')50 if (pBuf->fNewLine && ch != '\0') 51 51 ASMOutU8(VMMDEV_TESTING_IOPORT_DATA, '\n'); 52 pBuf->fNewLine = ch == '\n'; 52 53 if (ch != '\n') 53 54 ASMOutU8(VMMDEV_TESTING_IOPORT_DATA, ch); … … 57 58 * Console next. 58 59 */ 59 if (ch != 0)60 if (ch != '\0') 60 61 { 61 Bs3PrintChr(ch); 62 *pfNewLine = ch == '\n'; 62 BS3_ASSERT(pBuf->cchBuf < RT_ELEMENTS(pBuf->achBuf)); 63 pBuf->achBuf[pBuf->cchBuf++] = ch; 64 65 /* Whether to flush the buffer. We do line flushing here to avoid 66 dropping too much info when the formatter crashes on bad input. */ 67 if ( pBuf->cchBuf < RT_ELEMENTS(pBuf->achBuf) 68 && ch != '\n') 69 { 70 pBuf->fNewLine = false; 71 return 1; 72 } 73 pBuf->fNewLine = '\n'; 63 74 } 64 /* We're called with '\0' to indicate end-of-string. Supply trailing 65 newline if necessary. */ 66 else if (!*pfNewLine) 75 /* Try fit missing newline into the buffer. */ 76 else if (!pBuf->fNewLine && pBuf->cchBuf < RT_ELEMENTS(pBuf->achBuf)) 77 { 78 pBuf->fNewLine = true; 79 pBuf->achBuf[pBuf->cchBuf++] = '\n'; 80 } 81 82 BS3_ASSERT(pBuf->cchBuf <= RT_ELEMENTS(pBuf->achBuf)); 83 Bs3PrintStrN(&pBuf->achBuf[0], pBuf->cchBuf); 84 pBuf->cchBuf = 0; 85 86 /* In case we failed to add trailing new line, print one separately. */ 87 if (!pBuf->fNewLine) 67 88 Bs3PrintChr('\n'); 68 89 69 return 1;90 return ch != '\0'; 70 91 } 71 92 … … 76 97 BS3_DECL(void) Bs3TestFailedV(const char *pszFormat, va_list va) 77 98 { 78 bool fNewLine;99 BS3TESTFAILEDBUF Buf; 79 100 80 101 if (!++g_cusBs3TestErrors) … … 82 103 83 104 if (g_fbBs3VMMDevTesting) 105 #if ARCH_BITS == 16 106 ASMOutU16(VMMDEV_TESTING_IOPORT_CMD, (uint16_t)VMMDEV_TESTING_CMD_FAILED); 107 #else 84 108 ASMOutU32(VMMDEV_TESTING_IOPORT_CMD, VMMDEV_TESTING_CMD_FAILED); 109 #endif 85 110 86 fNewLine = false; 87 Bs3StrFormatV(pszFormat, va, bs3TestFailedStrOutput, &fNewLine); 111 Buf.fNewLine = false; 112 Buf.cchBuf = 0; 113 Bs3StrFormatV(pszFormat, va, bs3TestFailedStrOutput, &Buf); 88 114 } 89 115
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器