Changeset 60657 in vbox for trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c
- Timestamp:
- Apr 22, 2016 3:57:22 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrFormatV.c
r60527 r60657 436 436 } 437 437 State.fFlags |= STR_F_WIDTH; 438 ch = *pszFormat++; 438 439 } 439 440 … … 442 443 */ 443 444 State.cchPrecision = 0; 444 if (RT_C_IS_DIGIT(ch)) 445 { 446 do 447 { 448 State.cchPrecision *= 10; 449 State.cchPrecision = ch - '0'; 445 if (ch == '.') 446 { 447 ch = *pszFormat++; 448 if (RT_C_IS_DIGIT(ch)) 449 { 450 do 451 { 452 State.cchPrecision *= 10; 453 State.cchPrecision = ch - '0'; 454 ch = *pszFormat++; 455 } while (RT_C_IS_DIGIT(ch)); 456 State.fFlags |= STR_F_PRECISION; 457 } 458 else if (ch == '*') 459 { 460 State.cchPrecision = va_arg(va, int); 461 if (State.cchPrecision < 0) 462 State.cchPrecision = 0; 463 State.fFlags |= STR_F_PRECISION; 450 464 ch = *pszFormat++; 451 } while (RT_C_IS_DIGIT(ch)); 452 State.fFlags |= STR_F_PRECISION; 453 } 454 else if (ch == '*') 455 { 456 State.cchPrecision = va_arg(va, int); 457 if (State.cchPrecision < 0) 458 State.cchPrecision = 0; 459 State.fFlags |= STR_F_PRECISION; 465 } 460 466 } 461 467 … … 651 657 State.fFlags &= ~(STR_F_PLUS | STR_F_BLANK); 652 658 State.uBase = 16; 659 break; 660 case 'h': 661 ch = *pszFormat++; 662 if (ch == 'x') 663 { 664 /* Hex dumping. */ 665 uint8_t const BS3_FAR *pbHex = va_arg(va, uint8_t const BS3_FAR *); 666 if (State.cchPrecision < 0) 667 State.cchPrecision = 16; 668 ch = *pszFormat++; 669 if (ch == 's' || ch == 'd') 670 { 671 /* %Rhxd is currently implemented as %Rhxs. */ 672 while (State.cchPrecision-- > 0) 673 { 674 uint8_t b = *pbHex++; 675 State.pfnOutput(g_achBs3HexDigits[b >> 4], State.pvUser); 676 State.pfnOutput(g_achBs3HexDigits[b & 0x0f], State.pvUser); 677 if (State.cchPrecision) 678 State.pfnOutput(' ', State.pvUser); 679 } 680 } 681 } 682 State.uBase = 0; 653 683 break; 654 684 default:
Note:
See TracChangeset
for help on using the changeset viewer.