- Timestamp:
- Oct 2, 2015 10:15:58 AM (9 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/USBIdDatabase.h
r58000 r58001 76 76 { 77 77 protected: 78 static Product productArray[];79 static const size_t cProducts;80 static Vendor vendorArray[];81 static const size_t cVendors;78 static Product const aProducts[]; 79 static const size_t cProducts; 80 static Vendor const aVendors[]; 81 static const size_t cVendors; 82 82 83 83 public: … … 85 85 { 86 86 Product lookFor = { USBKEY(vendorId, productId) }; 87 Product * it = std::lower_bound(productArray, productArray+ cProducts, lookFor, ProductLess());87 Product const *it = std::lower_bound(aProducts, aProducts + cProducts, lookFor, ProductLess()); 88 88 return lookFor.key == it->key ? it->product : NULL; 89 89 } … … 92 92 { 93 93 Vendor lookFor = { vendorID }; 94 Vendor * it = std::lower_bound(vendorArray, vendorArray+ cVendors, lookFor, VendorLess());94 Vendor const *it = std::lower_bound(aVendors, aVendors + cVendors, lookFor, VendorLess()); 95 95 return lookFor.vendorID == it->vendorID ? it->vendor : NULL; 96 96 } -
trunk/src/VBox/Main/src-server/USBIdDatabaseGenerator.cpp
r58000 r58001 56 56 " * The source of the list is http://www.linux-usb.org/usb.ids\n" 57 57 " */\n" 58 "Product AliasDictionary::productArray[] =\n"58 "Product const AliasDictionary::aProducts[] =\n" 59 59 "{\n"; 60 60 … … 62 62 "};\n" 63 63 "\n" 64 "const size_t AliasDictionary::cProducts = sizeof(AliasDictionary::productArray) / sizeof(Product);\n";64 "const size_t AliasDictionary::cProducts = RT_ELEMENTS(AliasDictionary::aProducts);\n"; 65 65 66 66 const char *vendor_header = 67 "\nVendor AliasDictionary::vendorArray[] =\n"67 "\nVendor const AliasDictionary::aVendors[] =\n" 68 68 "{\n"; 69 69 const char *vendor_footer = 70 70 "};\n" 71 71 "\n" 72 "const size_t AliasDictionary::cVendors = sizeof(AliasDictionary::vendorArray) / sizeof(Vendor);\n";72 "const size_t AliasDictionary::cVendors = RT_ELEMENTS(AliasDictionary::aVendors);\n"; 73 73 74 74 const char *start_block = "# Vendors, devices and interfaces. Please keep sorted."; -
trunk/src/VBox/Main/src-server/USBIdDatabaseStub.cpp
r58000 r58001 18 18 #include "USBIdDatabase.h" 19 19 20 Product 21 const size_t AliasDictionary:: products_size = 0;22 Vendor 23 const size_t AliasDictionary:: vendors_size = 0;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 */ 24 24
Note:
See TracChangeset
for help on using the changeset viewer.