VirtualBox

Changeset 29783 in vbox


Ignore:
Timestamp:
May 25, 2010 1:13:35 PM (15 years ago)
Author:
vboxsync
Message:

iprt: %.5RX32 ++ bug fix - precision should padd with '0' as it used to do.

Location:
trunk/src/VBox/Runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/strformat.cpp

    r29683 r29783  
    273273     */
    274274    while (--cchPrecision >= cchValue)
    275         *psz++ = ' ';
     275        *psz++ = '0';
    276276
    277277    /*
     
    352352 * @param   InArgs      Argument list.
    353353 */
    354 RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat, 
     354RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat,
    355355                            const char *pszFormat, va_list InArgs)
    356356{
  • trunk/src/VBox/Runtime/testcase/tstRTStrFormat.cpp

    r29683 r29783  
    434434    CHECK42("%4RU32",  (uint32_t)42, "  42");
    435435    CHECK42("%04RU32", (uint32_t)42, "0042");
     436    CHECK42("%.4RU32", (uint32_t)42, "0042");
    436437
    437438    CHECK42("%RU64", (uint64_t)112345987345ULL, "112345987345");
     
    439440    CHECK42("%14RU64",  (uint64_t)4, "             4");
    440441    CHECK42("%014RU64", (uint64_t)4, "00000000000004");
     442    CHECK42("%.14RU64", (uint64_t)4, "00000000000004");
    441443
    442444    CHECK42("%RU8", (uint8_t)1, "1");
     
    454456    CHECK42("%5RX64",   UINT64_C(0x42), "   42");
    455457    CHECK42("%05RX64",  UINT64_C(0x42), "00042");
    456     CHECK42("%.5RX64",  UINT64_C(0x42), "   42");
    457     CHECK42("%.05RX64", UINT64_C(0x42), "   42");
     458    CHECK42("%.5RX64",  UINT64_C(0x42), "00042");
     459    CHECK42("%.05RX64", UINT64_C(0x42), "00042"); /* '0' is ignored */
    458460
    459461    CHECK42("%RX8", (uint8_t)1, "1");
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette