VirtualBox

Ignore:
Timestamp:
Mar 15, 2022 11:01:14 PM (3 years ago)
Author:
vboxsync
Message:

IPRT/RTStrFormatR80[u2]: A little overhaul to better deal with special values and using the RTSTR_F_SPECIAL flag to show more data for these when applicable. [build fix for darwin kernel mode] bugref:9898

File:
1 edited

Legend:

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

    r94255 r94257  
    299299                     ? rtStrFormatR80CopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+PseudoNan"))
    300300                     : rtStrFormatR80CopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-PseudoNan"));
    301             pszTmp = (char *)memcpy(pszTmp, RT_STR_TUPLE("PseudoNan[")) + 10;
     301            pszTmp = (char *)memcpy(pszTmp, "PseudoNan[", 10) + 10;
    302302        }
    303303        else if (!(uFraction & RT_BIT_64(62)))
     
    309309            if (!(fFlags & RTSTR_F_SPECIAL))
    310310                return rtStrFormatR80CopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("Nan"));
    311             pszTmp = (char *)memcpy(pszTmp, RT_STR_TUPLE("Nan[")) + 4;
     311            pszTmp = (char *)memcpy(pszTmp, "Nan[", 4) + 4;
    312312        }
    313313        else
     
    319319            if (!(fFlags & RTSTR_F_SPECIAL))
    320320                return rtStrFormatR80CopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("QNan"));
    321             pszTmp = (char *)memcpy(pszTmp, RT_STR_TUPLE("QNan[")) + 4;
     321            pszTmp = (char *)memcpy(pszTmp, "QNan[", 5) + 5;
    322322        }
    323323        pszTmp += RTStrFormatNumber(pszTmp, uFraction, 16, 2 + 16, 0,
     
    341341    {
    342342        if (fInteger)
    343             pszTmp = (char *)memcpy(pszTmp, RT_STR_TUPLE("[PDn]")) + 5;
    344         else
    345             pszTmp = (char *)memcpy(pszTmp, RT_STR_TUPLE("[Den]")) + 5;
     343            pszTmp = (char *)memcpy(pszTmp, "[PDn]", 5) + 5;
     344        else
     345            pszTmp = (char *)memcpy(pszTmp, "[Den]", 5) + 5;
    346346    }
    347347    return rtStrFormatR80CopyOutStr(pszBuf, cbBuf, szTmp, pszTmp - &szTmp[0]);
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