ref: e65525d7b45f0b7ad07dd45b8259baedf3314160
parent: e307cbb6a1c426e2dbb23054d02d6ebdaaa559c7
author: Varun B Patil <varun.basavaraj.patil@gmail.com>
date: Mon Dec 16 03:41:54 EST 2013
Improve handling of help switch in enc test app welsenc.exe -h is now a valid command which returns success. No longer prints help text twice in the case when the -h switch is given along with a wrong cfg.
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -451,11 +451,11 @@
void PrintHelp() {
printf ("\n Wels SVC Encoder Usage:\n\n");
+ printf (" Syntax: welsenc.exe -h\n");
printf (" Syntax: welsenc.exe welsenc.cfg\n");
printf (" Syntax: welsenc.exe welsenc.cfg [options]\n");
printf ("\n Supported Options:\n");
- printf (" -h Print Help\n");
printf (" -bf Bit Stream File\n");
printf (" -frms Number of total frames to be encoded\n");
printf (" -gop GOPSize - GOP size (2,4,8,16,32,64, default: 1)\n");
@@ -497,10 +497,6 @@
while (n < argc) {
pCommand = argv[n++];
- if (!strcmp (pCommand, "-h")) { // confirmed_safe_unsafe_usage
- PrintHelp();
- continue;
- }
if (!strcmp (pCommand, "-bf")) { // confirmed_safe_unsafe_usage
sFileSet.strBsFile.assign (argv[n]);
++ n;
@@ -1420,14 +1416,15 @@
} else {
string strCfgFileName = argv[1];
basic_string <char>::size_type index;
- static const basic_string <char>::size_type npos = size_t (-1);
index = strCfgFileName.rfind (".cfg"); // check configuration type (like .cfg?)
- if (index == npos) {
+ if (index == std::string::npos) {
if (argc > 2) {
iRet = ProcessEncodingSvcWithParam (pSVCEncoder, argc, argv);
if (iRet != 0)
goto exit;
- } else {
+ } else if (argc == 2 && ! strcmp(argv[1], "-h"))
+ PrintHelp();
+ else {
cout << "You specified pCommand is invalid!!" << endl;
goto exit;
}