VirtualBox

Changeset 30750 in vbox for trunk/include/VBox/com


Ignore:
Timestamp:
Jul 8, 2010 6:40:30 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63527
Message:

Main: string optimizations (speed up Bstr -> Utf8Str conversions; speed up Utf8StrFmt; fix excessive conversions in Console::configConstructor() and elsewhere)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/string.h

    r28800 r30750  
    552552protected:
    553553
    554     /**
    555      * As with the ministring::copyFrom() variants, this unconditionally
    556      * sets the members to a copy of the given other strings and makes
    557      * no assumptions about previous contents. This can therefore be used
    558      * both in copy constructors, when member variables have no defined
    559      * value, and in assignments after having called cleanup().
    560      *
    561      * This variant converts from a UTF-16 string, most probably from
    562      * a Bstr assignment.
    563      *
    564      * @param rs
    565      */
    566     void copyFrom(CBSTR s)
    567     {
    568         if (s && *s)
    569         {
    570             RTUtf16ToUtf8((PRTUTF16)s, &m_psz); /** @todo r=bird: This isn't throwing std::bad_alloc / handling return codes.
    571                                                  * Also, this technically requires using RTStrFree, ministring::cleanup() uses RTMemFree. */
    572             m_cbLength = strlen(m_psz);         /** @todo optimize by using a different RTUtf* function */
    573             m_cbAllocated = m_cbLength + 1;
    574         }
    575         else
    576         {
    577             m_cbLength = 0;
    578             m_cbAllocated = 0;
    579             m_psz = NULL;
    580         }
    581     }
     554    void copyFrom(CBSTR s);
    582555
    583556    friend class Bstr; /* to access our raw_copy() */
     
    614587
    615588protected:
    616 
    617     Utf8StrFmt() {}
     589    Utf8StrFmt()
     590    { }
    618591
    619592    void init(const char *format, va_list args);
    620593
    621594private:
    622 
    623     static DECLCALLBACK(size_t) strOutput(void *pvArg, const char *pachChars,
    624                                           size_t cbChars);
    625595};
    626596
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