VirtualBox

Changeset 93209 in vbox


Ignore:
Timestamp:
Jan 12, 2022 10:05:25 PM (3 years ago)
Author:
vboxsync
Message:

Main/Host: Don't double buffer the description string in Host::getProcessorDescription, just retrieve it straight into the return string.

File:
1 edited

Legend:

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

    r93115 r93209  
    11601160    // no locking required
    11611161
    1162     char szCPUModel[80];
    1163     szCPUModel[0] = 0;
    1164     int vrc = RTMpGetDescription(aCpuId, szCPUModel, sizeof(szCPUModel));
    1165     if (RT_FAILURE(vrc))
    1166         return E_FAIL; /** @todo error reporting? */
    1167 
    1168     aDescription = Utf8Str(szCPUModel);
    1169 
    1170     return S_OK;
     1162    int vrc = aDescription.reserveNoThrow(80);
     1163    if (RT_SUCCESS(vrc))
     1164    {
     1165        vrc = RTMpGetDescription(aCpuId, aDescription.mutableRaw(), aDescription.capacity());
     1166        if (RT_SUCCESS(vrc))
     1167        {
     1168            aDescription.jolt();
     1169            return S_OK;
     1170        }
     1171    }
     1172    return setErrorVrc(vrc);
    11711173}
    11721174
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