VirtualBox

Changeset 57649 in vbox for trunk


Ignore:
Timestamp:
Sep 7, 2015 11:51:23 PM (9 years ago)
Author:
vboxsync
Message:
 
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r57630 r57649  
    552552endif
    553553# Whether to generate a database of USB vendor IDs and device IDs into VBoxSVC.
    554 #VBOX_WITH_MAIN_USB_ID_DATABASE = 1
     554VBOX_WITH_MAIN_USB_ID_DATABASE = 1
    555555# The recompiler.
    556556VBOX_WITH_REM = 1
  • trunk/src/VBox/Main/include/USBIdDatabase.h

    r57358 r57649  
    7171protected:
    7272    static Product productArray[];
    73     static const size_t products_size;
     73    static const size_t cProducts;
    7474    static Vendor vendorArray[];
    75     static const size_t vendors_size;
     75    static const size_t cVendors;
    7676
    7777public:
     
    7979    {
    8080        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());
    8282        return lookFor.key == it->key ? it->product : NULL;
    8383    }
     
    8686    {
    8787        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());
    8989        return lookFor.vendorID == it->vendorID ? it->vendor : NULL;
    9090    }
  • trunk/src/VBox/Main/src-server/USBIdDatabaseGenerator.cpp

    r57632 r57649  
    1919#include <string>
    2020
     21#include <iprt/initterm.h>
     22#include <iprt/message.h>
    2123#include <iprt/string.h>
    2224#include <iprt/stream.h>
     
    5153    "};\n"
    5254    "\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";
    5456
    5557const char *vendor_header =
     
    5961    "};\n"
    6062    "\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";
    6264
    6365const char *start_block = "# Vendors, devices and interfaces. Please keep sorted.";
     
    110112{
    111113    string res = src;
    112     for (size_t i = 0; i < res.length(); i++)
     114    for (size_t i = 0; i < res.length(); ++i)
    113115    {
    114116        switch (res[i])
    115117        {
    116118        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        }
    118137        }
    119138    }
     
    272291int main(int argc, char* argv[])
    273292{
     293    int rc = RTR3InitExe(argc, &argv, 0);
     294    if (RT_FAILURE(rc))
     295        return RTMsgInitFailure(rc);
     296
    274297    if (argc < 4)
    275298    {
     
    285308
    286309    char* outName = NULL;
    287     int rc = 0;
     310    rc = 0;
    288311    for (int i = 1; i < argc; i++)
    289312    {
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