VirtualBox

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


Ignore:
Timestamp:
Nov 14, 2009 10:46:02 PM (15 years ago)
Author:
vboxsync
Message:

Utf8Str: Some comments (not a full review).

File:
1 edited

Legend:

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

    r23908 r24657  
    375375
    376376    /**
    377      *  Intended to assign instances to |char *| out parameters from within the
    378      *  interface method. Transfers the ownership of the duplicated string to the
    379      *  caller.
     377     * Intended to assign instances to |char *| out parameters from within the
     378     * interface method. Transfers the ownership of the duplicated string to the
     379     * caller.
     380     *
     381     * @remarks The returned string must be freed by RTStrFree, not RTMemFree.
    380382     */
    381383    const Utf8Str& cloneTo(char **pstr) const
    382384    {
    383         if (pstr)
     385        if (pstr) /** @todo r=bird: This needs to if m_psz is NULL. Shouldn't it also throw std::bad_alloc? */
    384386            *pstr = RTStrDup(m_psz);
    385387        return *this;
     
    471473
    472474    /**
    473      *  Intended to pass instances as out (|char **|) parameters to methods.
    474      *  Takes the ownership of the returned data.
     475     * Intended to pass instances as out (|char **|) parameters to methods. Takes
     476     * the ownership of the returned data.
     477     *
     478     * @remarks    See ministring::jolt().
    475479     */
    476480    char **asOutParam()
     
    503507        if (s)
    504508        {
    505             RTUtf16ToUtf8((PRTUTF16)s, &m_psz);
    506             m_cbLength = strlen(m_psz);             // TODO optimize by using a different RTUtf* function
     509            RTUtf16ToUtf8((PRTUTF16)s, &m_psz); /** @todo r=bird: This isn't throwing std::bad_alloc / handling return codes.
     510                                                 * Also, this technically requires using RTStrFree, ministring::cleanup() uses RTMemFree. */
     511            m_cbLength = strlen(m_psz);         /** @todo optimize by using a different RTUtf* function */
    507512            m_cbAllocated = m_cbLength + 1;
    508513        }
     
    676681} /* namespace com */
    677682
    678 #endif /* ___VBox_com_string_h */
     683#endif /* !___VBox_com_string_h */
     684
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