- Timestamp:
- Sep 7, 2015 11:51:23 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r57630 r57649 552 552 endif 553 553 # Whether to generate a database of USB vendor IDs and device IDs into VBoxSVC. 554 #VBOX_WITH_MAIN_USB_ID_DATABASE = 1554 VBOX_WITH_MAIN_USB_ID_DATABASE = 1 555 555 # The recompiler. 556 556 VBOX_WITH_REM = 1 -
trunk/src/VBox/Main/include/USBIdDatabase.h
r57358 r57649 71 71 protected: 72 72 static Product productArray[]; 73 static const size_t products_size;73 static const size_t cProducts; 74 74 static Vendor vendorArray[]; 75 static const size_t vendors_size;75 static const size_t cVendors; 76 76 77 77 public: … … 79 79 { 80 80 Product lookFor = { USBKEY(vendorId, productId) }; 81 Product* it = std::lower_bound(productArray, productArray + products_size, lookFor, ProductLess());81 Product* it = std::lower_bound(productArray, productArray + cProducts, lookFor, ProductLess()); 82 82 return lookFor.key == it->key ? it->product : NULL; 83 83 } … … 86 86 { 87 87 Vendor lookFor = { vendorID }; 88 Vendor* it = std::lower_bound(vendorArray, vendorArray + vendors_size, lookFor, VendorLess());88 Vendor* it = std::lower_bound(vendorArray, vendorArray + cVendors, lookFor, VendorLess()); 89 89 return lookFor.vendorID == it->vendorID ? it->vendor : NULL; 90 90 } -
trunk/src/VBox/Main/src-server/USBIdDatabaseGenerator.cpp
r57632 r57649 19 19 #include <string> 20 20 21 #include <iprt/initterm.h> 22 #include <iprt/message.h> 21 23 #include <iprt/string.h> 22 24 #include <iprt/stream.h> … … 51 53 "};\n" 52 54 "\n" 53 "const size_t AliasDictionary:: products_size= sizeof(AliasDictionary::productArray) / sizeof(Product);\n";55 "const size_t AliasDictionary::cProducts = sizeof(AliasDictionary::productArray) / sizeof(Product);\n"; 54 56 55 57 const char *vendor_header = … … 59 61 "};\n" 60 62 "\n" 61 "const size_t AliasDictionary:: vendors_size= sizeof(AliasDictionary::vendorArray) / sizeof(Vendor);\n";63 "const size_t AliasDictionary::cVendors = sizeof(AliasDictionary::vendorArray) / sizeof(Vendor);\n"; 62 64 63 65 const char *start_block = "# Vendors, devices and interfaces. Please keep sorted."; … … 110 112 { 111 113 string res = src; 112 for (size_t i = 0; i < res.length(); i++)114 for (size_t i = 0; i < res.length(); ++i) 113 115 { 114 116 switch (res[i]) 115 117 { 116 118 case '"': 117 case '\\': res.insert(i++, "\\"); 119 case '\\': res.insert(i++, "\\"); break; 120 default: 121 { 122 if ((unsigned char)res[i] >= 127) 123 { 124 size_t start = i; 125 string temp = "\" \""; 126 char buffer[8] = { 0 }; 127 do 128 { 129 RTStrPrintf(buffer, sizeof(buffer), "\\x%x", (unsigned char)res[i]); 130 temp.append(buffer); 131 } while ((unsigned char)res[++i] & 0x80); 132 temp.append("\" \""); 133 res.replace(start, i - start, temp); 134 i += temp.length(); 135 } 136 } 118 137 } 119 138 } … … 272 291 int main(int argc, char* argv[]) 273 292 { 293 int rc = RTR3InitExe(argc, &argv, 0); 294 if (RT_FAILURE(rc)) 295 return RTMsgInitFailure(rc); 296 274 297 if (argc < 4) 275 298 { … … 285 308 286 309 char* outName = NULL; 287 intrc = 0;310 rc = 0; 288 311 for (int i = 1; i < argc; i++) 289 312 {
Note:
See TracChangeset
for help on using the changeset viewer.