VirtualBox

Changeset 58001 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Oct 2, 2015 10:15:58 AM (9 years ago)
Author:
vboxsync
Message:

USBIdDatabase*: The product and vendor arrays should be const, just like the counts. If you're using hungarian for the element counts, use it for the arrays too. RT_ELEMENTS is a handy macro.

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

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

    r58000 r58001  
    5656    " * The source of the list is http://www.linux-usb.org/usb.ids\n"
    5757    " */\n"
    58     "Product AliasDictionary::productArray[] =\n"
     58    "Product const AliasDictionary::aProducts[] =\n"
    5959    "{\n";
    6060
     
    6262    "};\n"
    6363    "\n"
    64     "const size_t AliasDictionary::cProducts = sizeof(AliasDictionary::productArray) / sizeof(Product);\n";
     64    "const size_t AliasDictionary::cProducts = RT_ELEMENTS(AliasDictionary::aProducts);\n";
    6565
    6666const char *vendor_header =
    67     "\nVendor AliasDictionary::vendorArray[] =\n"
     67    "\nVendor const AliasDictionary::aVendors[] =\n"
    6868    "{\n";
    6969const char *vendor_footer =
    7070    "};\n"
    7171    "\n"
    72     "const size_t AliasDictionary::cVendors = sizeof(AliasDictionary::vendorArray) / sizeof(Vendor);\n";
     72    "const size_t AliasDictionary::cVendors = RT_ELEMENTS(AliasDictionary::aVendors);\n";
    7373
    7474const char *start_block = "# Vendors, devices and interfaces. Please keep sorted.";
  • trunk/src/VBox/Main/src-server/USBIdDatabaseStub.cpp

    r58000 r58001  
    1818#include "USBIdDatabase.h"
    1919
    20 Product         AliasDictionary::productArray[] = {0};
    21 const size_t    AliasDictionary::products_size  = 0;
    22 Vendor          AliasDictionary::vendorArray[]  = {0};
    23 const size_t    AliasDictionary::vendors_size   = 0;
     20Product const   AliasDictionary::productArray[] = {0};
     21const size_t    AliasDictionary::cProducts      = 1; /* std::lower_bound cannot deal with empty array */
     22Vendor const    AliasDictionary::vendorArray[]  = {0};
     23const size_t    AliasDictionary::cVendors       = 1; /* std::lower_bound cannot deal with empty array */
    2424
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