VirtualBox

Changeset 97890 in vbox


Ignore:
Timestamp:
Dec 29, 2022 2:58:32 PM (2 years ago)
Author:
vboxsync
Message:

Main/USBDeviceFilter: Skip some unnecessary Utf8Str copying.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp

    r97889 r97890  
    6262        Assert(value >= 0 && value <= 0xffff);
    6363
    64         rstrOut = Utf8StrFmt("%04RX16", (uint16_t)value);
     64        rstrOut.printf("%04RX16", (uint16_t)value);
    6565    }
    6666    else if (USBFilterIsMethodString(matchingMethod))
     
    130130                    else
    131131                    {
    132                         aErrStr = Utf8StrFmt(tr("The %s value '%s' is too big (max 0xFFFF)"),
    133                                              i_describeUSBFilterIdx(aIdx), pcszValue);
     132                        aErrStr.printf(tr("The %s value '%s' is too big (max 0xFFFF)"), i_describeUSBFilterIdx(aIdx), pcszValue);
    134133                        return E_INVALIDARG;
    135134                    }
     
    145144            /* Any wildcard in the string? */
    146145            Assert(USBFilterIsStringField(aIdx));
    147             if (    strchr(pcszValue, '*')
    148                 ||  strchr(pcszValue, '?')
     146            if (   strchr(pcszValue, '*')
     147                || strchr(pcszValue, '?')
    149148                /* || strchr (psz, '[') - later */
    150149                )
     
    159158        if (vrc == VERR_INVALID_PARAMETER)
    160159        {
    161             aErrStr = Utf8StrFmt(tr("The %s filter expression '%s' is not valid"), i_describeUSBFilterIdx(aIdx), aValue.c_str());
     160            aErrStr.printf(tr("The %s filter expression '%s' is not valid"), i_describeUSBFilterIdx(aIdx), aValue.c_str());
    162161            return E_INVALIDARG;
    163162        }
    164163        if (vrc == VERR_BUFFER_OVERFLOW)
    165164        {
    166             aErrStr = Utf8StrFmt(tr("Insufficient expression space for the '%s' filter expression '%s'"),
    167                                  i_describeUSBFilterIdx(aIdx), aValue.c_str());
     165            aErrStr.printf(tr("Insufficient expression space for the '%s' filter expression '%s'"),
     166                           i_describeUSBFilterIdx(aIdx), aValue.c_str());
    168167            return E_FAIL;
    169168        }
    170169        AssertRC(vrc);
    171         aErrStr = Utf8StrFmt(tr("Encountered unexpected status %Rrc when setting '%s' to '%s'"),
    172                              vrc, i_describeUSBFilterIdx(aIdx), aValue.c_str());
     170        aErrStr.printf(tr("Encountered unexpected status %Rrc when setting '%s' to '%s'"),
     171                       vrc, i_describeUSBFilterIdx(aIdx), aValue.c_str());
    173172        return E_FAIL;
    174173    }
     
    458457    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    459458
    460     aName = bd->mData.strName;
    461 
    462     return S_OK;
     459    return aName.assignEx(bd->mData.strName);
    463460}
    464461
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