VirtualBox

Ignore:
Timestamp:
Jul 28, 2022 10:51:39 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152681
Message:

IPRT/strformat.cpp: Added some placeholder floating point format type handling as some of the guest 3D code may want to use %f and friends. These are now using the CRT to format floating point numbers, but would switch to IPRT in VBOX_WITH_NOCRT_STATIC mode. Fortunately, it looks like it is only needed for logging. bugref:10261

File:
1 edited

Legend:

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

    r93115 r95926  
    763763
    764764                    /*
     765                     * Floating point.
     766                     *
     767                     * We currently don't really implement these yet, there is just a very basic
     768                     * formatting regardless of the requested type.
     769                     */
     770                    case 'e': /* [-]d.dddddde+-dd[d] */
     771                    case 'E': /* [-]d.ddddddE+-dd[d] */
     772                    case 'f': /* [-]dddd.dddddd / inf / nan */
     773                    case 'F': /* [-]dddd.dddddd / INF / NAN */
     774                    case 'g': /* Either f or e, depending on the magnitue and precision. */
     775                    case 'G': /* Either f or E, depending on the magnitue and precision. */
     776                    case 'a': /* [-]0xh.hhhhhhp+-dd */
     777                    case 'A': /* [-]0Xh.hhhhhhP+-dd */
     778                    {
     779#ifdef IN_RING3
     780                        size_t cchNum;
     781# ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
     782                        if (chArgSize == 'L')
     783                        {
     784                            RTFLOAT80U2 r80;
     785                            r80.lrd = va_arg(args, long double);
     786#  ifndef IN_BLD_PROG
     787                            cchNum = RTStrFormatR80U2(&szTmp[0], sizeof(szTmp), &r80, cchWidth, cchPrecision, 0);
     788#  else
     789                            cch += pfnOutput(pvArgOutput, RT_STR_TUPLE("<long double>"));
     790                            RT_NOREF_PV(r80);
     791                            break;
     792#  endif
     793                        }
     794                        else
     795# endif
     796                        {
     797                            RTFLOAT64U r64;
     798                            r64.rd = va_arg(args, double);
     799# ifndef IN_BLD_PROG
     800                            cchNum = RTStrFormatR64(&szTmp[0], sizeof(szTmp), &r64, cchWidth, cchPrecision, 0);
     801# else
     802                            cchNum = RTStrFormatNumber(&szTmp[0], r64.au64[0], 16, 0, 0, RTSTR_F_SPECIAL | RTSTR_F_64BIT);
     803# endif
     804                        }
     805                        cch += pfnOutput(pvArgOutput, &szTmp[0], cchNum);
     806#else  /* !IN_RING3 */
     807                        AssertFailed();
     808#endif /* !IN_RING3 */
     809                        break;
     810                    }
     811
     812                    /*
    765813                     * Nested extensions.
    766814                     */
Note: See TracChangeset for help on using the changeset viewer.

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