儲存庫 vbox 的更動 58006
- 時間撮記:
- 2015-10-2 上午11:52:56 (9 年 以前)
- 位置:
- trunk/src/VBox/Main/src-server
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/src-server/USBIdDatabaseGenerator.cpp
r58001 r58006 77 77 #define USBKEY(vendorId, productId) (((vendorId) << 16) | (productId)) 78 78 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) 85 84 86 85 struct VendorRecord … … 303 302 } 304 303 304 static 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 305 311 int main(int argc, char *argv[]) 306 312 { … … 311 317 if (argc < 4) 312 318 { 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; 317 322 } 318 323 ofstream fout; … … 329 334 continue; 330 335 } 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 } 331 343 332 344 rc = RTStrmOpen(argv[i], "r", &fin); 333 345 if (RT_FAILURE(rc)) 334 346 { 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; 338 348 return ERROR_OPEN_FILE; 339 349 } 340 350 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; 346 355 RTStrmClose(fin); 347 return r es;356 return rc; 348 357 } 349 358 RTStrmClose(fin); … … 357 366 if (ita != g_products.end()) 358 367 { 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; 363 370 } 364 371 365 372 if (!outName) 366 373 { 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; 370 375 return ERROR_OPEN_FILE; 371 376 } … … 376 381 if (!fout.is_open()) 377 382 { 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; 381 384 return ERROR_OPEN_FILE; 382 385 } … … 399 402 400 403 401 return 0;402 } 403 404 return RTEXITCODE_SUCCESS; 405 } 406 -
trunk/src/VBox/Main/src-server/USBIdDatabaseStub.cpp
r58001 r58006 18 18 #include "USBIdDatabase.h" 19 19 20 Product const AliasDictionary:: productArray[] = {0};21 const size_t AliasDictionary::cProducts 22 Vendor const AliasDictionary:: vendorArray[] = {0};23 const size_t AliasDictionary::cVendors 20 Product const AliasDictionary::aProducts[] = {0}; 21 const size_t AliasDictionary::cProducts = 1; /* std::lower_bound cannot deal with empty array */ 22 Vendor const AliasDictionary::aVendors[] = {0}; 23 const size_t AliasDictionary::cVendors = 1; /* std::lower_bound cannot deal with empty array */ 24 24
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器