Changeset 80496 in vbox for trunk/src/VBox/Runtime/common/string
- Timestamp:
- Aug 29, 2019 11:58:21 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/strformatrt.cpp
r76553 r80496 989 989 #endif /* IN_RING3 */ 990 990 991 /* 992 * Human readable sizes. 993 */ 991 994 case 'c': 992 995 case 'u': … … 997 1000 uint64_t uFraction = 0; 998 1001 const char *pszPrefix = NULL; 999 unsigned cchFixedPart;1000 1002 char ch2 = *(*ppszFormat)++; 1001 AssertMsgReturn(ch2 == 'b' || ch2 == ' i', ("invalid type '%.10s'!\n", pszFormatOrg), 0);1003 AssertMsgReturn(ch2 == 'b' || ch2 == 'B' || ch2 == 'i', ("invalid type '%.10s'!\n", pszFormatOrg), 0); 1002 1004 uValue = va_arg(*pArgs, uint64_t); 1003 1005 1004 1006 if (!(fFlags & RTSTR_F_PRECISION)) 1005 cchPrecision = 1; 1007 cchPrecision = 1; /** @todo default to flexible decimal point. */ 1006 1008 else if (cchPrecision > 3) 1007 1009 cchPrecision = 3; … … 1009 1011 cchPrecision = 0; 1010 1012 1011 cchFixedPart = cchPrecision + (cchPrecision != 0) + (ch == 'c'); 1012 1013 if (ch2 == 'b') 1013 if (ch2 == 'b' || ch2 == 'B') 1014 1014 { 1015 1015 static const struct … … 1040 1040 uValue >>= s_aUnits[i].cShift; 1041 1041 pszPrefix = s_aUnits[i].pszPrefix; 1042 cchFixedPart += 2;1043 1042 break; 1044 1043 } … … 1075 1074 } 1076 1075 pszPrefix = s_aUnits[i].pszPrefix; 1077 cchFixedPart += 1;1078 1076 break; 1079 1077 } … … 1089 1087 RTSTR_F_ZEROPAD | RTSTR_F_WIDTH); 1090 1088 } 1089 if (fFlags & RTSTR_F_BLANK) 1090 szBuf[cchBuf++] = ' '; 1091 1091 szBuf[cchBuf++] = *pszPrefix++; 1092 if (*pszPrefix )1092 if (*pszPrefix && ch2 != 'B') 1093 1093 szBuf[cchBuf++] = *pszPrefix; 1094 1094 } 1095 else if (fFlags & RTSTR_F_BLANK) 1096 szBuf[cchBuf++] = ' '; 1095 1097 if (ch == 'c') 1096 1098 szBuf[cchBuf++] = 'B';
Note:
See TracChangeset
for help on using the changeset viewer.