- Timestamp:
- Oct 21, 2010 9:55:24 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/testcase/vbox-img.cpp
r33235 r33288 624 624 bool fStdIn = false; 625 625 bool fStdOut = false; 626 c har *pszSrcFormat = NULL;626 const char *pszSrcFormat = NULL; 627 627 const char *pszDstFormat = NULL; 628 628 const char *pszVariant = NULL; … … 670 670 break; 671 671 case 's': // --srcformat 672 pszSrcFormat = RTStrDup(ValueUnion.psz);672 pszSrcFormat = ValueUnion.psz; 673 673 break; 674 674 case 'd': // --dstformat 675 pszDstFormat = RTStrDup(ValueUnion.psz);675 pszDstFormat = ValueUnion.psz; 676 676 break; 677 677 case 'v': // --variant … … 686 686 } 687 687 688 /* Check for mandatory parameters. */ 688 /* Check for mandatory parameters and handle dummies/defaults. */ 689 if (fStdIn && !pszSrcFormat) 690 return errorSyntax("Mandatory --srcformat option missing\n"); 691 if (!pszDstFormat) 692 pszDstFormat = "VDI"; 693 if (fStdIn && !pszSrcFilename) 694 { 695 /* Complete dummy, will be just passed to various calls to fulfill 696 * the "must be non-NULL" requirement, and is completely ignored 697 * otherwise. It shown in the stderr message below. */ 698 pszSrcFilename = "stdin"; 699 } 700 if (fStdOut && !pszDstFilename) 701 { 702 /* Will be stored in the destination image if it is a streamOptimized 703 * VMDK, but it isn't really relevant - use it for "branding". */ 704 if (!RTStrICmp(pszDstFormat, "VMDK")) 705 pszDstFilename = "VirtualBoxStream.vmdk"; 706 else 707 pszDstFilename = "stdout"; 708 } 689 709 if (!pszSrcFilename) 690 710 return errorSyntax("Mandatory --srcfilename option missing\n"); … … 768 788 if (!pszSrcFormat) 769 789 { 770 rc = VDGetFormat(NULL, NULL, pszSrcFilename, &pszSrcFormat); 790 char *pszFormat; 791 rc = VDGetFormat(NULL, NULL, pszSrcFilename, &pszFormat); 771 792 if (RT_FAILURE(rc)) 772 793 { … … 774 795 break; 775 796 } 797 pszSrcFormat = pszFormat; 776 798 } 777 799 … … 791 813 break; 792 814 } 793 794 /* output format defaults to VDI */795 if (!pszDstFormat)796 pszDstFormat = "VDI";797 815 798 816 rc = VDCreate(pVDIfs, &pDstDisk);
Note:
See TracChangeset
for help on using the changeset viewer.