VirtualBox

儲存庫 vbox 的更動 58006


忽略:
時間撮記:
2015-10-2 上午11:52:56 (9 年 以前)
作者:
vboxsync
訊息:

USBIdDatabase*: ERROR_DUPLICATE_ENTRY and duplicate usage statement.

位置:
trunk/src/VBox/Main/src-server
檔案:
修改 2 筆資料

圖例:

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

    r58001 r58006  
    7777#define USBKEY(vendorId, productId) (((vendorId) << 16) | (productId))
    7878
    79 // error codes
    80 #define ERROR_INVALID_ARGUMENTS (1)
    81 #define ERROR_OPEN_FILE         (2)
    82 #define ERROR_IN_PARSE_LINE     (3)
    83 #define ERROR_DUPLICATE_ENTRY   (4)
    84 #define ERROR_WRONG_FILE_FORMAT (5)
     79// error codes (complements RTEXITCODE_XXX).
     80#define ERROR_OPEN_FILE         (12)
     81#define ERROR_IN_PARSE_LINE     (13)
     82#define ERROR_DUPLICATE_ENTRY   (14)
     83#define ERROR_WRONG_FILE_FORMAT (15)
    8584
    8685struct VendorRecord
     
    303302}
    304303
     304static int usage(ostream &rOut, const char *argv0)
     305{
     306    rOut << "Usage: " << argv0
     307         << " [linux.org usb list file] [custom usb list file] [-o output file]" << endl;
     308    return RTEXITCODE_SYNTAX;
     309}
     310
    305311int main(int argc, char *argv[])
    306312{
     
    311317    if (argc < 4)
    312318    {
    313         cerr << "Format: " << argv[0] <<
    314             " [linux.org usb list file] [custom usb list file] [-o output file]" << endl;
    315         cerr << "Error: Invalid arguments." << endl;
    316         return ERROR_INVALID_ARGUMENTS;
     319        usage(cerr, argv[0]);
     320        cerr << "Error: Not enough arguments." << endl;
     321        return RTEXITCODE_SYNTAX;
    317322    }
    318323    ofstream fout;
     
    329334            continue;
    330335        }
     336        if (   strcmp(argv[i], "-h") == 0
     337            || strcmp(argv[i], "-?") == 0
     338            || strcmp(argv[i], "--help") == 0)
     339        {
     340            usage(cout, argv[0]);
     341            return RTEXITCODE_SUCCESS;
     342        }
    331343
    332344        rc = RTStrmOpen(argv[i], "r", &fin);
    333345        if (RT_FAILURE(rc))
    334346        {
    335             cerr << "Format: " << argv[0] <<
    336                 " [linux.org usb list file] [custom usb list file] [-o output file]" << endl;
    337             cerr << "Error: Can not open file '" << argv[i] << "'. Error: " << hex << rc << endl;
     347            cerr << "Error: Failed to open file '" << argv[i] << "' for reading. rc=" << rc << endl;
    338348            return ERROR_OPEN_FILE;
    339349        }
    340350
    341         int res = ParseUsbIds(fin);
    342         if (res != 0)
    343         {
    344             cerr << "Error in parsing USB devices file '" <<
    345                 argv[i] << "'" << endl;
     351        rc = ParseUsbIds(fin);
     352        if (rc != 0)
     353        {
     354            cerr << "Error: Failed parsing USB devices file '" << argv[i] << "'" << endl;
    346355            RTStrmClose(fin);
    347             return res;
     356            return rc;
    348357        }
    349358        RTStrmClose(fin);
     
    357366    if (ita != g_products.end())
    358367    {
    359         cerr << "Warning: Duplicate alias detected. " << *ita << endl;
    360         /** @todo r=bird: Why return success (0) when we didn't generate the
    361          *        file?!?!? */
    362         return 0;
     368        cerr << "Error: Duplicate alias detected. " << *ita << endl;
     369        return ERROR_DUPLICATE_ENTRY;
    363370    }
    364371
    365372    if (!outName)
    366373    {
    367         cerr << "Format: " << argv[0] <<
    368             " [linux.org usb list file] [custom usb list file] [-o output file]" << endl;
    369         cerr << "Error: Output file is not defined." << endl;
     374        cerr << "Error: Output file is not specified." << endl;
    370375        return ERROR_OPEN_FILE;
    371376    }
     
    376381    if (!fout.is_open())
    377382    {
    378         cerr << "Format: " << argv[0] <<
    379             " [linux.org usb list file] [custom usb list file] [-o output file]" << endl;
    380         cerr << "Error: Can not open file to write '" << argv[1] << "'." << endl;
     383        cerr << "Error: Can not open file to write '" << outName << "'." << endl;
    381384        return ERROR_OPEN_FILE;
    382385    }
     
    399402
    400403
    401     return 0;
    402 }
    403 
     404    return RTEXITCODE_SUCCESS;
     405}
     406
  • trunk/src/VBox/Main/src-server/USBIdDatabaseStub.cpp

    r58001 r58006  
    1818#include "USBIdDatabase.h"
    1919
    20 Product const   AliasDictionary::productArray[] = {0};
    21 const size_t    AliasDictionary::cProducts      = 1; /* std::lower_bound cannot deal with empty array */
    22 Vendor const    AliasDictionary::vendorArray[]  = {0};
    23 const size_t    AliasDictionary::cVendors       = 1; /* std::lower_bound cannot deal with empty array */
     20Product const   AliasDictionary::aProducts[] = {0};
     21const size_t    AliasDictionary::cProducts   = 1; /* std::lower_bound cannot deal with empty array */
     22Vendor const    AliasDictionary::aVendors[]  = {0};
     23const size_t    AliasDictionary::cVendors    = 1; /* std::lower_bound cannot deal with empty array */
    2424
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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