VirtualBox

忽略:
時間撮記:
2019-2-22 下午05:40:00 (6 年 以前)
作者:
vboxsync
訊息:

Main: Eradicate the use of BSTR in regular API code, there were leaks in almost every occurrence. Also do some Bstr->Utf8Str shuffling to reduce the number of conversions.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/src-client/USBDeviceImpl.cpp

    r76553 r77436  
    7171    ComAssertComRCRet(hrc, hrc);
    7272
    73     BSTR tmp;
    74     BSTR *bptr = &tmp;
    75 
    76     hrc = aUSBDevice->COMGETTER(Manufacturer)(bptr);
    77     ComAssertComRCRet(hrc, hrc);
    78     unconst(mData.manufacturer) = Utf8Str(tmp);
    79 
    80     hrc = aUSBDevice->COMGETTER(Product)(bptr);
    81     ComAssertComRCRet(hrc, hrc);
    82     unconst(mData.product) = Utf8Str(tmp);
    83 
    84     hrc = aUSBDevice->COMGETTER(SerialNumber)(bptr);
    85     ComAssertComRCRet(hrc, hrc);
    86     unconst(mData.serialNumber) = Utf8Str(tmp);
    87 
    88     hrc = aUSBDevice->COMGETTER(Address)(bptr);
    89     ComAssertComRCRet(hrc, hrc);
    90     unconst(mData.address) = Utf8Str(tmp);
    91 
    92     hrc = aUSBDevice->COMGETTER(Backend)(bptr);
    93     ComAssertComRCRet(hrc, hrc);
    94     unconst(mData.backend) = Utf8Str(tmp);
     73    Bstr bstr;
     74
     75    hrc = aUSBDevice->COMGETTER(Manufacturer)(bstr.asOutParam());
     76    ComAssertComRCRet(hrc, hrc);
     77    unconst(mData.manufacturer) = bstr;
     78
     79    hrc = aUSBDevice->COMGETTER(Product)(bstr.asOutParam());
     80    ComAssertComRCRet(hrc, hrc);
     81    unconst(mData.product) = bstr;
     82
     83    hrc = aUSBDevice->COMGETTER(SerialNumber)(bstr.asOutParam());
     84    ComAssertComRCRet(hrc, hrc);
     85    unconst(mData.serialNumber) = bstr;
     86
     87    hrc = aUSBDevice->COMGETTER(Address)(bstr.asOutParam());
     88    ComAssertComRCRet(hrc, hrc);
     89    unconst(mData.address) = bstr;
     90
     91    hrc = aUSBDevice->COMGETTER(Backend)(bstr.asOutParam());
     92    ComAssertComRCRet(hrc, hrc);
     93    unconst(mData.backend) = bstr;
    9594
    9695    hrc = aUSBDevice->COMGETTER(Port)(&unconst(mData.port));
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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