- Timestamp:
- Nov 26, 2008 9:05:46 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r14618 r14619 36 36 #include <vector> 37 37 #include <list> 38 #include <cstdlib>39 #include <cctype>40 38 #endif /* !VBOX_ONLY_DOCS */ 41 39 40 #include <iprt/asm.h> 41 #include <iprt/cidr.h> 42 #include <iprt/ctype.h> 43 #include <iprt/dir.h> 44 #include <iprt/env.h> 45 #include <VBox/err.h> 46 #include <iprt/file.h> 42 47 #include <iprt/initterm.h> 48 #include <iprt/param.h> 49 #include <iprt/path.h> 43 50 #include <iprt/stream.h> 44 51 #include <iprt/string.h> 45 52 #include <iprt/stdarg.h> 46 #include <iprt/ asm.h>53 #include <iprt/thread.h> 47 54 #include <iprt/uuid.h> 48 #include <iprt/thread.h>49 #include <iprt/path.h>50 #include <iprt/param.h>51 #include <iprt/dir.h>52 #include <iprt/file.h>53 #include <iprt/env.h>54 #include <iprt/cidr.h>55 #include <VBox/err.h>56 55 #include <VBox/version.h> 57 56 #include <VBox/VBoxHDD.h> … … 331 330 " [-name <name>]\n" 332 331 " [-ostype <ostype>]\n" 333 " [-memory <memorysize >]\n"334 " [-vram <vramsize >]\n"332 " [-memory <memorysize in MB>]\n" 333 " [-vram <vramsize in MB>]\n" 335 334 " [-acpi on|off]\n" 336 335 " [-ioapic on|off]\n" … … 381 380 " <devicename>]\n" 382 381 #ifdef VBOX_WITH_MEM_BALLOONING 383 " [-guestmemoryballoon <balloonsize >]\n"382 " [-guestmemoryballoon <balloonsize in MB>]\n" 384 383 #endif 385 384 " [-gueststatisticsinterval <seconds>]\n" … … 1245 1244 return errorArgument("Missing argument to '%s'", argv[i]); 1246 1245 i++; 1247 port = atoi(argv[i]);1246 port = RTStrToUInt16(argv[i]); 1248 1247 } 1249 1248 else if (strcmp(argv[i], "-lun") == 0) … … 1456 1455 Bstr name; 1457 1456 Bstr ostype; 1458 ULONGmemorySize = 0;1459 ULONGvramSize = 0;1457 uint32_t memorySize = 0; 1458 uint32_t vramSize = 0; 1460 1459 char *acpi = NULL; 1461 1460 char *hwvirtex = NULL; … … 1464 1463 char *pae = NULL; 1465 1464 char *ioapic = NULL; 1466 int monitorcount = -1;1465 uint32_t monitorcount = ~0; 1467 1466 char *accelerate3d = NULL; 1468 1467 char *bioslogofadein = NULL; … … 1559 1558 return errorArgument("Missing argument to '%s'", argv[i]); 1560 1559 i++; 1561 memorySize = atoi(argv[i]);1560 memorySize = RTStrToUInt32(argv[i]); 1562 1561 } 1563 1562 else if (strcmp(argv[i], "-vram") == 0) … … 1566 1565 return errorArgument("Missing argument to '%s'", argv[i]); 1567 1566 i++; 1568 vramSize = atoi(argv[i]);1567 vramSize = RTStrToUInt32(argv[i]); 1569 1568 } 1570 1569 else if (strcmp(argv[i], "-acpi") == 0) … … 1615 1614 return errorArgument("Missing argument to '%s'", argv[i]); 1616 1615 i++; 1617 monitorcount = atoi(argv[i]);1616 monitorcount = RTStrToUInt32(argv[i]); 1618 1617 } 1619 1618 else if (strcmp(argv[i], "-accelerate3d") == 0) … … 1643 1642 return errorArgument("Missing argument to '%s'", argv[i]); 1644 1643 i++; 1645 bioslogodisplaytime = atoi(argv[i]);1644 bioslogodisplaytime = RTStrToUInt32(argv[i]); 1646 1645 } 1647 1646 else if (strcmp(argv[i], "-bioslogoimagepath") == 0) … … 1675 1674 else if (strncmp(argv[i], "-boot", 5) == 0) 1676 1675 { 1677 ULONGn = 0;1676 uint32_t n = 0; 1678 1677 if (!argv[i][5]) 1679 1678 return errorSyntax(USAGE_MODIFYVM, "Missing boot slot number in '%s'", argv[i]); 1680 if ( (n = strtoul(&argv[i][5], NULL, 10)) < 1)1679 if (VINF_SUCCESS != RTStrToUInt32Full(&argv[i][5], 10, &n)) 1681 1680 return errorSyntax(USAGE_MODIFYVM, "Invalid boot slot number in '%s'", argv[i]); 1682 1681 if (argc <= i + 1) … … 1934 1933 vrdpport = 0; 1935 1934 else 1936 vrdpport = atoi(argv[i]);1935 vrdpport = RTStrToUInt16(argv[i]); 1937 1936 } 1938 1937 else if (strcmp(argv[i], "-vrdpaddress") == 0) … … 2294 2293 } 2295 2294 } 2296 if (monitorcount != -1)2295 if (monitorcount != ~0U) 2297 2296 { 2298 2297 CHECK_ERROR(machine, COMSETTER(MonitorCount)(monitorcount)); … … 2869 2868 uint32_t u32LineSpeed; 2870 2869 2871 u32LineSpeed = atoi(nicspeed[n]);2870 u32LineSpeed = RTStrToUInt32(nicspeed[n]); 2872 2871 2873 2872 if (u32LineSpeed < 1000 || u32LineSpeed > 4000000) … … 3455 3454 for (i = 1 + 1; i < argc && cScancodes < (int)RT_ELEMENTS(alScancodes); i++, cScancodes++) 3456 3455 { 3457 if ( isxdigit(argv[i][0])3458 && isxdigit(argv[i][1])3456 if ( RT_C_IS_XDIGIT (argv[i][0]) 3457 && RT_C_IS_XDIGIT (argv[i][1]) 3459 3458 && argv[i][2] == 0) 3460 3459 { … … 3591 3590 break; 3592 3591 } 3593 uint32_t xres = atoi(argv[2]);3594 uint32_t yres = atoi(argv[3]);3595 uint32_t bpp = atoi(argv[4]);3592 uint32_t xres = RTStrToUInt32(argv[2]); 3593 uint32_t yres = RTStrToUInt32(argv[3]); 3594 uint32_t bpp = RTStrToUInt32(argv[4]); 3596 3595 uint32_t displayIdx = 0; 3597 3596 if (argc == 6) 3598 displayIdx = atoi(argv[5]);3597 displayIdx = RTStrToUInt32(argv[5]); 3599 3598 3600 3599 ComPtr<IDisplay> display; … … 4680 4679 /* which index? */ 4681 4680 char *endptr = NULL; 4682 cmd.mIndex = strtoul (argv[1], &endptr, 10); 4683 if (!endptr || *endptr) 4681 if (VINF_SUCCESS != RTStrToUInt32Full (argv[1], 10, &cmd.mIndex)) 4684 4682 return errorSyntax(USAGE_USBFILTER, "Invalid index '%s'", argv[1]); 4685 4683 … … 5503 5501 return errorArgument("Missing argument to '%s'", argv[i]); 5504 5502 char *endptr = NULL; 5505 period = strtoul (argv[++i], &endptr, 10);5506 if (!endptr || *endptr|| !period)5503 if ( VINF_SUCCESS != RTStrToUInt32Full(argv[++i], 10, &period) 5504 || !period) 5507 5505 return errorArgument("Invalid value for 'period' parameter: '%s'", argv[i]); 5508 5506 } … … 5512 5510 return errorArgument("Missing argument to '%s'", argv[i]); 5513 5511 char *endptr = NULL; 5514 samples = strtoul (argv[++i], &endptr, 10);5512 if (VINF_SUCCESS != RTStrToUInt32Full(argv[++i], 10, &samples)) 5515 5513 if (!endptr || *endptr) 5516 5514 return errorArgument("Invalid value for 'samples' parameter: '%s'", argv[i]); … … 5670 5668 return errorArgument("Missing argument to '%s'", argv[i]); 5671 5669 char *endptr = NULL; 5672 period = strtoul (argv[++i], &endptr, 10);5673 if (!endptr || *endptr|| !period)5670 if ( VINF_SUCCESS != RTStrToUInt32Full(argv[++i], 10, &period) 5671 || !period) 5674 5672 return errorArgument("Invalid value for 'period' parameter: '%s'", argv[i]); 5675 5673 } … … 5679 5677 return errorArgument("Missing argument to '%s'", argv[i]); 5680 5678 char *endptr = NULL; 5681 samples = strtoul (argv[++i], &endptr, 10);5682 if (!endptr || *endptr|| !samples)5679 if ( VINF_SUCCESS != RTStrToUInt32Full(argv[++i], 10, &samples) 5680 || !samples) 5683 5681 return errorArgument("Invalid value for 'samples' parameter: '%s'", argv[i]); 5684 5682 }
Note:
See TracChangeset
for help on using the changeset viewer.