Changeset 76361 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Dec 22, 2018 1:43:57 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlInterface.cpp
r75425 r76361 33 33 34 34 /* Misc. includes: */ 35 # include <iprt/err.h> 35 36 # include <iprt/getopt.h> 36 37 … … 45 46 #define GCTLCMD_COMMON_OPT_SESSION_ID 994 /**< The --sessionid option number. */ 46 47 47 #define RETURN_ERROR(strError) \48 {\49 m_strStatus.append(strError); \50 return false; \51 } 52 53 #define RETURN_MESSAGE(strMessage) \54 {\55 m_strStatus.append(strMessage); \56 return true; \57 } 48 #define RETURN_ERROR(strError) \ 49 do { \ 50 m_strStatus.append(strError); \ 51 return false; \ 52 } while (0) 53 54 #define RETURN_MESSAGE(strMessage) \ 55 do { \ 56 m_strStatus.append(strMessage); \ 57 return true; \ 58 } while (0) 58 59 59 60 #define GCTLCMD_COMMON_OPTION_DEFS() \ … … 78 79 switch(type) 79 80 { 80 case (KFsObjType_Unknown):81 case KFsObjType_Unknown: 81 82 strType = "Unknown"; 82 83 break; 83 case (KFsObjType_Fifo): 84 strType = "Fifo"; 85 break; 86 87 case (KFsObjType_DevChar): 88 strType = "DevChar"; 89 break; 90 91 case (KFsObjType_Directory): 92 strType = "Directory"; 93 break; 94 95 case (KFsObjType_DevBlock): 96 strType = "DevBlock"; 97 break; 98 99 case (KFsObjType_File): 100 strType = "File"; 101 break; 102 case (KFsObjType_Symlink): 103 strType = "Symlink"; 104 break; 105 case (KFsObjType_Socket): 106 strType = "Socket"; 107 break; 108 109 case (KFsObjType_WhiteOut): 110 strType = "WhiteOut"; 111 break; 112 default: 113 strType = "Unknown"; 114 break; 84 case KFsObjType_Fifo: 85 strType = "Fifo"; 86 break; 87 case KFsObjType_DevChar: 88 strType = "DevChar"; 89 break; 90 case KFsObjType_Directory: 91 strType = "Directory"; 92 break; 93 case KFsObjType_DevBlock: 94 strType = "DevBlock"; 95 break; 96 case KFsObjType_File: 97 strType = "File"; 98 break; 99 case KFsObjType_Symlink: 100 strType = "Symlink"; 101 break; 102 case KFsObjType_Socket: 103 strType = "Socket"; 104 break; 105 case KFsObjType_WhiteOut: 106 strType = "WhiteOut"; 107 break; 108 default: 109 strType = "Unknown"; 110 break; 115 111 } 116 112 return strType; … … 130 126 switch (getOptErrorCode) 131 127 { 132 case (VERR_GETOPT_UNKNOWN_OPTION):128 case VERR_GETOPT_UNKNOWN_OPTION: 133 129 errorString = errorString.append("RTGetOpt: Command line option not recognized."); 134 130 break; 135 case (VERR_GETOPT_REQUIRED_ARGUMENT_MISSING):131 case VERR_GETOPT_REQUIRED_ARGUMENT_MISSING: 136 132 errorString = errorString.append("RTGetOpt: Command line option needs argument."); 137 133 break; 138 case (VERR_GETOPT_INVALID_ARGUMENT_FORMAT):134 case VERR_GETOPT_INVALID_ARGUMENT_FORMAT: 139 135 errorString = errorString.append("RTGetOpt: Command line option has argument with bad format."); 140 136 break; 141 case (VINF_GETOPT_NOT_OPTION):137 case VINF_GETOPT_NOT_OPTION: 142 138 errorString = errorString.append("RTGetOpt: Not an option."); 143 139 break; 144 case (VERR_GETOPT_INDEX_MISSING):140 case VERR_GETOPT_INDEX_MISSING: 145 141 errorString = errorString.append("RTGetOpt: Command line option needs an index."); 146 142 break; … … 238 234 /* Allow only a single NOT_OPTION */ 239 235 else 240 RETURN_ERROR(generateErrorString(ch, ValueUnion)) 236 RETURN_ERROR(generateErrorString(ch, ValueUnion)); 241 237 242 238 break; 243 239 default: 244 RETURN_ERROR(generateErrorString(ch, ValueUnion)) 240 RETURN_ERROR(generateErrorString(ch, ValueUnion)); 245 241 } 246 242 } … … 307 303 /* Allow only a single NOT_OPTION */ 308 304 else 309 RETURN_ERROR(generateErrorString(ch, ValueUnion)) 305 RETURN_ERROR(generateErrorString(ch, ValueUnion)); 310 306 311 307 break; 312 308 default: 313 RETURN_ERROR(generateErrorString(ch, ValueUnion)) 309 RETURN_ERROR(generateErrorString(ch, ValueUnion)); 314 310 } 315 311 } … … 331 327 332 328 if (!isADirectory && !isAFile) 333 RETURN_ERROR("Specified object does not exist") 329 RETURN_ERROR("Specified object does not exist"); 334 330 335 331 CGuestFsObjInfo fsObjectInfo = guestSession.FsObjQueryInfo(commandData.m_strPath, false /*BOOL aFollowSymlinks*/); … … 410 406 break; 411 407 default: 412 RETURN_ERROR(generateErrorString(ch, ValueUnion)) 408 RETURN_ERROR(generateErrorString(ch, ValueUnion)); 413 409 } 414 410 } 415 411 if (commandData.m_strExePath.isEmpty()) 416 RETURN_ERROR(QString(m_strHelp).append("Syntax error! No executable is given\n")) 412 RETURN_ERROR(QString(m_strHelp).append("Syntax error! No executable is given\n")); 417 413 418 414 CGuestSession guestSession; … … 426 422 { 427 423 if (commandData.m_bSessionNameGiven && commandData.m_strSessionName.isEmpty()) 428 RETURN_ERROR(QString(m_strHelp).append("'Session Name' is not name valid\n")) 424 RETURN_ERROR(QString(m_strHelp).append("'Session Name' is not name valid\n")); 429 425 430 426 /* Check if sessionname and sessionid are both supplied */ 431 427 if (commandData.m_bSessionIdGiven && commandData.m_bSessionNameGiven) 432 RETURN_ERROR(QString(m_strHelp).append("Both 'Session Name' and 'Session Id' are supplied\n")) 428 RETURN_ERROR(QString(m_strHelp).append("Both 'Session Name' and 'Session Id' are supplied\n")); 433 429 434 430 /* If sessionid is given then look for the session. if not found return without starting the process: */ … … 437 433 if (!findSession(commandData.m_uSessionId, outGuestSession)) 438 434 { 439 RETURN_ERROR(QString(m_strHelp).append("No session with id %1 found.\n").arg(commandData.m_uSessionId)) 435 RETURN_ERROR(QString(m_strHelp).append("No session with id %1 found.\n").arg(commandData.m_uSessionId)); 440 436 } 441 437 } … … 453 449 return true; 454 450 /* if neither sessionname and session id is given then create a new session */ 455 else 456 { 457 if (!createSession(commandData, outGuestSession)) 458 return false; 459 } 451 if (!createSession(commandData, outGuestSession)) 452 return false; 460 453 return true; 461 454 } … … 507 500 if (commandData.m_strSessionName.isEmpty()) 508 501 { 509 RETURN_ERROR(QString("'Session Name' is not name valid\n").append(m_strHelp)) 502 RETURN_ERROR(QString("'Session Name' is not name valid\n").append(m_strHelp)); 510 503 } 511 504 break;
Note:
See TracChangeset
for help on using the changeset viewer.