From ae683cd7944768f5b88c85a75627da3aacbdb941 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Sat, 17 Feb 2018 15:16:44 +0000 Subject: [PATCH] Remove exception specifiers as they are depreciated. Remove some trailing spaces and add some spaces for readability. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4079 --- include/setup.h | 57 +++++++------- src/misc/setup.cpp | 186 ++++++++++++++++++++++----------------------- 2 files changed, 121 insertions(+), 122 deletions(-) diff --git a/include/setup.h b/include/setup.h index 15fc3b8c..345d027e 100644 --- a/include/setup.h +++ b/include/setup.h @@ -55,7 +55,6 @@ public: Hex():_hex(0) { }; bool operator==(Hex const& other) {return _hex == other._hex;} operator int () const { return _hex; } - }; class Value { @@ -75,7 +74,7 @@ private: public: class WrongType { }; // Conversion error class enum Etype { V_NONE, V_HEX, V_BOOL, V_INT, V_STRING, V_DOUBLE,V_CURRENT} type; - + /* Constructors */ Value() :_string(0), type(V_NONE) { }; Value(Hex in) :_hex(in), type(V_HEX) { }; @@ -87,28 +86,28 @@ public: Value(Value const& in):_string(0) {plaincopy(in);} ~Value() { destroy();}; Value(std::string const& in,Etype _t) :_hex(0),_bool(false),_int(0),_string(0),_double(0),type(V_NONE) {SetValue(in,_t);} - + /* Assigment operators */ - Value& operator= (Hex in) throw(WrongType) { return copy(Value(in));} - Value& operator= (int in) throw(WrongType) { return copy(Value(in));} - Value& operator= (bool in) throw(WrongType) { return copy(Value(in));} - Value& operator= (double in) throw(WrongType) { return copy(Value(in));} - Value& operator= (std::string const& in) throw(WrongType) { return copy(Value(in));} - Value& operator= (char const * const in) throw(WrongType) { return copy(Value(in));} - Value& operator= (Value const& in) throw(WrongType) { return copy(Value(in));} + Value& operator= (Hex in) { return copy(Value(in));} + Value& operator= (int in) { return copy(Value(in));} + Value& operator= (bool in) { return copy(Value(in));} + Value& operator= (double in) { return copy(Value(in));} + Value& operator= (std::string const& in) { return copy(Value(in));} + Value& operator= (char const * const in) { return copy(Value(in));} + Value& operator= (Value const& in) { return copy(Value(in));} bool operator== (Value const & other); - operator bool () const throw(WrongType); - operator Hex () const throw(WrongType); - operator int () const throw(WrongType); - operator double () const throw(WrongType); - operator char const* () const throw(WrongType); - bool SetValue(std::string const& in,Etype _type = V_CURRENT) throw(WrongType); + operator bool () const; + operator Hex () const; + operator int () const; + operator double () const; + operator char const* () const; + bool SetValue(std::string const& in,Etype _type = V_CURRENT); std::string ToString() const; private: void destroy() throw(); - Value& copy(Value const& in) throw(WrongType); + Value& copy(Value const& in); void plaincopy(Value const& in) throw(); bool set_hex(std::string const& in); bool set_int(std::string const&in); @@ -134,7 +133,7 @@ public: //specific features. virtual bool CheckValue(Value const& in, bool warn); public: - virtual ~Property(){ } + virtual ~Property(){ } virtual const std::vector& GetValues() const; Value::Etype Get_type(){return default_value.type;} Changeable::Value getChange() {return change;} @@ -143,9 +142,9 @@ protected: //Set interval value to in or default if in is invalid. force always sets the value. //Can be overriden to set a different value if invalid. virtual bool SetVal(Value const& in, bool forced,bool warn=true) { - if(forced || CheckValue(in,warn)) { + if(forced || CheckValue(in,warn)) { value = in; return true; - } else { + } else { value = default_value; return false; } } @@ -159,12 +158,12 @@ protected: class Prop_int:public Property { public: Prop_int(std::string const& _propname,Changeable::Value when, int _value) - :Property(_propname,when) { + :Property(_propname,when) { default_value = value = _value; min = max = -1; } Prop_int(std::string const& _propname,Changeable::Value when, int _min,int _max,int _value) - :Property(_propname,when) { + :Property(_propname,when) { default_value = value = _value; min = _min; max = _max; @@ -177,7 +176,7 @@ public: virtual bool CheckValue(Value const& in, bool warn); // Override SetVal, so it takes min,max in account when there are no suggested values virtual bool SetVal(Value const& in, bool forced,bool warn=true); - + private: Value min,max; }; @@ -195,7 +194,7 @@ public: class Prop_bool:public Property { public: Prop_bool(std::string const& _propname, Changeable::Value when, bool _value) - :Property(_propname,when) { + :Property(_propname,when) { default_value = value = _value; } bool SetValue(std::string const& in); @@ -205,7 +204,7 @@ public: class Prop_string:public Property{ public: Prop_string(std::string const& _propname, Changeable::Value when, char const * const _value) - :Property(_propname,when) { + :Property(_propname,when) { default_value = value = _value; } bool SetValue(std::string const& in); @@ -216,7 +215,7 @@ class Prop_path:public Prop_string{ public: std::string realpath; Prop_path(std::string const& _propname, Changeable::Value when, char const * const _value) - :Prop_string(_propname,when,_value) { + :Prop_string(_propname,when,_value) { default_value = value = _value; realpath = _value; } @@ -227,7 +226,7 @@ public: class Prop_hex:public Property { public: Prop_hex(std::string const& _propname, Changeable::Value when, Hex _value) - :Property(_propname,when) { + :Property(_propname,when) { default_value = value = _value; } bool SetValue(std::string const& in); @@ -281,7 +280,7 @@ public: Prop_path* Add_path(std::string const& _propname, Property::Changeable::Value when, char const * const _value=NULL); Prop_bool* Add_bool(std::string const& _propname, Property::Changeable::Value when, bool _value=false); Prop_hex* Add_hex(std::string const& _propname, Property::Changeable::Value when, Hex _value=0); -// void Add_double(char const * const _propname, double _value=0.0); +// void Add_double(char const * const _propname, double _value=0.0); Prop_multival *Add_multi(std::string const& _propname, Property::Changeable::Value when,std::string const& sep); Prop_multival_remain *Add_multiremain(std::string const& _propname, Property::Changeable::Value when,std::string const& sep); @@ -324,7 +323,7 @@ public: virtual bool SetValue(std::string const& input); }; - + class Section_line: public Section{ public: Section_line(std::string const& _sectionname):Section(_sectionname){} diff --git a/src/misc/setup.cpp b/src/misc/setup.cpp index c79ae665..a15c289c 100644 --- a/src/misc/setup.cpp +++ b/src/misc/setup.cpp @@ -37,7 +37,7 @@ void Value::destroy() throw(){ if (type == V_STRING) delete _string; } -Value& Value::copy(Value const& in) throw(WrongType) { +Value& Value::copy(Value const& in) { if (this != &in) { //Selfassigment! if(type != V_NONE && type != in.type) throw WrongType(); destroy(); @@ -55,27 +55,27 @@ void Value::plaincopy(Value const& in) throw(){ if(type == V_STRING) _string = new string(*in._string); } -Value::operator bool () const throw(WrongType) { +Value::operator bool () const { if(type != V_BOOL) throw WrongType(); return _bool; } -Value::operator Hex () const throw(WrongType) { +Value::operator Hex () const { if(type != V_HEX) throw WrongType(); return _hex; } -Value::operator int () const throw(WrongType) { +Value::operator int () const { if(type != V_INT) throw WrongType(); return _int; } -Value::operator double () const throw(WrongType) { +Value::operator double () const { if(type != V_DOUBLE) throw WrongType(); return _double; } -Value::operator char const* () const throw(WrongType) { +Value::operator char const* () const { if(type != V_STRING) throw WrongType(); return _string->c_str(); } @@ -105,7 +105,7 @@ bool Value::operator==(Value const& other) { } return false; } -bool Value::SetValue(string const& in,Etype _type) throw(WrongType) { +bool Value::SetValue(string const& in,Etype _type) { /* Throw exception if the current type isn't the wanted type * Unless the wanted type is current. */ @@ -176,13 +176,13 @@ bool Value::set_bool(string const &in) { lowcase(result); _bool = true; // TODO if(!result.size()) return false; - + if(result=="0" || result=="disabled" || result=="false" || result=="off") { _bool = false; } else if(result=="1" || result=="enabled" || result=="true" || result=="on") { _bool = true; } else return false; - + return true; } @@ -260,7 +260,7 @@ bool Prop_int::SetVal(Value const& in, bool forced, bool warn) { int mi = min; int ma = max; int va = static_cast(Value(in)); - + //No ranges if (mi == -1 && ma == -1) { value = in; return true;} @@ -271,7 +271,7 @@ bool Prop_int::SetVal(Value const& in, bool forced, bool warn) { if (va > ma ) va = ma; else va = mi; if (warn) LOG_MSG("%s is outside the allowed range %s-%s for variable: %s.\nIt has been set to the closest boundary: %d.",in.ToString().c_str(),min.ToString().c_str(),max.ToString().c_str(),propname.c_str(),va); - + value = va; return true; } @@ -286,100 +286,98 @@ bool Prop_int::CheckValue(Value const& in, bool warn) { int va = static_cast(Value(in)); if (mi == -1 && ma == -1) return true; if (va >= mi && va <= ma) return true; - + if (warn) LOG_MSG("%s lies outside the range %s-%s for variable: %s.\nIt might now be reset to the default value: %s",in.ToString().c_str(),min.ToString().c_str(),max.ToString().c_str(),propname.c_str(),default_value.ToString().c_str()); return false; } -bool Prop_double::SetValue(std::string const& input){ +bool Prop_double::SetValue(std::string const& input) { Value val; if(!val.SetValue(input,Value::V_DOUBLE)) return false; return SetVal(val,false,true); } -//void Property::SetValue(char* input){ +//void Property::SetValue(char* input){ // value.SetValue(input, Value::V_CURRENT); //} -bool Prop_int::SetValue(std::string const& input){; +bool Prop_int::SetValue(std::string const& input) { Value val; - if(!val.SetValue(input,Value::V_INT)) return false; + if (!val.SetValue(input,Value::V_INT)) return false; bool retval = SetVal(val,false,true); return retval; } -bool Prop_string::SetValue(std::string const& input){ +bool Prop_string::SetValue(std::string const& input) { //Special version for lowcase stuff std::string temp(input); - //suggested values always case insensitive. + //suggested values always case insensitive. //If there are none then it can be paths and such which are case sensitive - if(!suggested_values.empty()) lowcase(temp); + if (!suggested_values.empty()) lowcase(temp); Value val(temp,Value::V_STRING); return SetVal(val,false,true); } -bool Prop_string::CheckValue(Value const& in, bool warn){ - if(suggested_values.empty()) return true; +bool Prop_string::CheckValue(Value const& in, bool warn) { + if (suggested_values.empty()) return true; for(iter it = suggested_values.begin();it != suggested_values.end();it++) { if ( (*it) == in) { //Match! return true; } - if((*it).ToString() == "%u") { + if ((*it).ToString() == "%u") { Bit32u value; if(sscanf(in.ToString().c_str(),"%u",&value) == 1) { return true; } } } - if(warn) LOG_MSG("\"%s\" is not a valid value for variable: %s.\nIt might now be reset to the default value: %s",in.ToString().c_str(),propname.c_str(),default_value.ToString().c_str()); + if (warn) LOG_MSG("\"%s\" is not a valid value for variable: %s.\nIt might now be reset to the default value: %s",in.ToString().c_str(),propname.c_str(),default_value.ToString().c_str()); return false; } -bool Prop_path::SetValue(std::string const& input){ +bool Prop_path::SetValue(std::string const& input) { //Special version to merge realpath with it Value val(input,Value::V_STRING); bool retval = SetVal(val,false,true); - if(input.empty()) { + if (input.empty()) { realpath = ""; return false; } std::string workcopy(input); Cross::ResolveHomedir(workcopy); //Parse ~ and friends //Prepend config directory in it exists. Check for absolute paths later - if( current_config_dir.empty()) realpath = workcopy; + if ( current_config_dir.empty()) realpath = workcopy; else realpath = current_config_dir + CROSS_FILESPLIT + workcopy; //Absolute paths if (Cross::IsPathAbsolute(workcopy)) realpath = workcopy; return retval; } - -bool Prop_bool::SetValue(std::string const& input){ + +bool Prop_bool::SetValue(std::string const& input) { return value.SetValue(input,Value::V_BOOL); } -bool Prop_hex::SetValue(std::string const& input){ +bool Prop_hex::SetValue(std::string const& input) { Value val; val.SetValue(input,Value::V_HEX); return SetVal(val,false,true); } -void Prop_multival::make_default_value(){ +void Prop_multival::make_default_value() { Bitu i = 1; Property *p = section->Get_prop(0); - if(!p) return; + if (!p) return; std::string result = p->Get_Default_Value().ToString(); while( (p = section->Get_prop(i++)) ) { std::string props = p->Get_Default_Value().ToString(); - if(props == "") continue; + if (props == "") continue; result += separator; result += props; } Value val(result,Value::V_STRING); SetVal(val,false,true); } - - //TODO checkvalue stuff bool Prop_multival_remain::SetValue(std::string const& input) { Value val(input,Value::V_STRING); @@ -389,30 +387,30 @@ bool Prop_multival_remain::SetValue(std::string const& input) { int i = 0,number_of_properties = 0; Property *p = section->Get_prop(0); //No properties in this section. do nothing - if(!p) return false; - + if (!p) return false; + while( (section->Get_prop(number_of_properties)) ) number_of_properties++; - + string::size_type loc = string::npos; while( (p = section->Get_prop(i++)) ) { //trim leading separators loc = local.find_first_not_of(separator); - if(loc != string::npos) local.erase(0,loc); + if (loc != string::npos) local.erase(0,loc); loc = local.find_first_of(separator); string in = "";//default value - /* when i == number_of_properties add the total line. (makes more then + /* when i == number_of_properties add the total line. (makes more then * one string argument possible for parameters of cpu) */ - if(loc != string::npos && i < number_of_properties) { //separator found + if (loc != string::npos && i < number_of_properties) { //separator found in = local.substr(0,loc); local.erase(0,loc+1); - } else if(local.size()) { //last argument or last property + } else if (local.size()) { //last argument or last property in = local; local = ""; } //Test Value. If it fails set default Value valtest (in,p->Get_type()); - if(!p->CheckValue(valtest,true)) { + if (!p->CheckValue(valtest,true)) { make_default_value(); return false; } @@ -430,24 +428,24 @@ bool Prop_multival::SetValue(std::string const& input) { int i = 0; Property *p = section->Get_prop(0); //No properties in this section. do nothing - if(!p) return false; + if (!p) return false; string::size_type loc = string::npos; while( (p = section->Get_prop(i++)) ) { //trim leading separators loc = local.find_first_not_of(separator); - if(loc != string::npos) local.erase(0,loc); + if (loc != string::npos) local.erase(0,loc); loc = local.find_first_of(separator); string in = "";//default value - if(loc != string::npos) { //separator found + if (loc != string::npos) { //separator found in = local.substr(0,loc); local.erase(0,loc+1); - } else if(local.size()) { //last argument + } else if (local.size()) { //last argument in = local; local = ""; - } + } //Test Value. If it fails set default Value valtest (in,p->Get_type()); - if(!p->CheckValue(valtest,true)) { + if (!p->CheckValue(valtest,true)) { make_default_value(); return false; } @@ -460,11 +458,10 @@ bool Prop_multival::SetValue(std::string const& input) { const std::vector& Property::GetValues() const { return suggested_values; } -const std::vector& Prop_multival::GetValues() const -{ +const std::vector& Prop_multival::GetValues() const { Property *p = section->Get_prop(0); //No properties in this section. do nothing - if(!p) return suggested_values; + if (!p) return suggested_values; int i =0; while( (p = section->Get_prop(i++)) ) { std::vector v = p->GetValues(); @@ -512,16 +509,19 @@ Prop_bool* Section_prop::Add_bool(string const& _propname, Property::Changeable: properties.push_back(test); return test; } + Prop_hex* Section_prop::Add_hex(string const& _propname, Property::Changeable::Value when, Hex _value) { Prop_hex* test=new Prop_hex(_propname,when,_value); properties.push_back(test); return test; } + Prop_multival* Section_prop::Add_multi(std::string const& _propname, Property::Changeable::Value when,std::string const& sep) { Prop_multival* test = new Prop_multival(_propname,when,sep); properties.push_back(test); return test; } + Prop_multival_remain* Section_prop::Add_multiremain(std::string const& _propname, Property::Changeable::Value when,std::string const& sep) { Prop_multival_remain* test = new Prop_multival_remain(_propname,when,sep); properties.push_back(test); @@ -530,7 +530,7 @@ Prop_multival_remain* Section_prop::Add_multiremain(std::string const& _propname int Section_prop::Get_int(string const&_propname) const { for(const_it tel=properties.begin();tel!=properties.end();tel++){ - if((*tel)->propname==_propname){ + if ((*tel)->propname==_propname){ return ((*tel)->GetValue()); } } @@ -539,15 +539,16 @@ int Section_prop::Get_int(string const&_propname) const { bool Section_prop::Get_bool(string const& _propname) const { for(const_it tel=properties.begin();tel!=properties.end();tel++){ - if((*tel)->propname==_propname){ + if ((*tel)->propname==_propname){ return ((*tel)->GetValue()); } } return false; } + double Section_prop::Get_double(string const& _propname) const { for(const_it tel=properties.begin();tel!=properties.end();tel++){ - if((*tel)->propname==_propname){ + if ((*tel)->propname==_propname){ return ((*tel)->GetValue()); } } @@ -556,9 +557,9 @@ double Section_prop::Get_double(string const& _propname) const { Prop_path* Section_prop::Get_path(string const& _propname) const { for(const_it tel=properties.begin();tel!=properties.end();tel++){ - if((*tel)->propname==_propname){ + if ((*tel)->propname==_propname){ Prop_path* val = dynamic_cast((*tel)); - if(val) return val; else return NULL; + if (val) return val; else return NULL; } } return NULL; @@ -576,16 +577,16 @@ Prop_multival* Section_prop::Get_multival(string const& _propname) const { Prop_multival_remain* Section_prop::Get_multivalremain(string const& _propname) const { for(const_it tel=properties.begin();tel!=properties.end();tel++){ - if((*tel)->propname==_propname){ + if ((*tel)->propname==_propname){ Prop_multival_remain* val = dynamic_cast((*tel)); - if(val) return val; else return NULL; + if (val) return val; else return NULL; } } return NULL; } Property* Section_prop::Get_prop(int index){ for(it tel=properties.begin();tel!=properties.end();tel++){ - if(!index--) return (*tel); + if (!index--) return (*tel); } return NULL; } @@ -609,15 +610,15 @@ Hex Section_prop::Get_hex(string const& _propname) const { void trim(string& in) { string::size_type loc = in.find_first_not_of(" \r\t\f\n"); - if(loc != string::npos) in.erase(0,loc); + if (loc != string::npos) in.erase(0,loc); loc = in.find_last_not_of(" \r\t\f\n"); - if(loc != string::npos) in.erase(loc+1); + if (loc != string::npos) in.erase(loc+1); } bool Section_prop::HandleInputline(string const& gegevens){ string str1 = gegevens; string::size_type loc = str1.find('='); - if(loc == string::npos) return false; + if (loc == string::npos) return false; string name = str1.substr(0,loc); string val = str1.substr(loc + 1); @@ -625,9 +626,9 @@ bool Section_prop::HandleInputline(string const& gegevens){ trim(val); string::size_type length = val.length(); if (length > 1 && - ((val[0] == '"' && val[length - 1] == '"' ) || + ((val[0] == '\"' && val[length - 1] == '\"' ) || (val[0] == '\'' && val[length - 1] == '\'')) - ) val = val.substr(1,length - 2); + ) val = val.substr(1,length - 2); /* trim the results incase there were spaces somewhere */ trim(name);trim(val); for(it tel = properties.begin();tel != properties.end();tel++){ @@ -645,16 +646,16 @@ void Section_prop::PrintData(FILE* outfile) const { } } -string Section_prop::GetPropValue(string const& _property) const{ +string Section_prop::GetPropValue(string const& _property) const { for(const_it tel=properties.begin();tel!=properties.end();tel++){ - if(!strcasecmp((*tel)->propname.c_str(),_property.c_str())){ + if (!strcasecmp((*tel)->propname.c_str(),_property.c_str())){ return (*tel)->GetValue().ToString(); } } return NO_SUCH_PROPERTY; } -bool Section_line::HandleInputline(string const& line){ +bool Section_line::HandleInputline(string const& line) { data+=line; data+="\n"; return true; @@ -693,13 +694,13 @@ bool Config::PrintConfig(char const * const configfilename) const { i=0; char prefix[80]; snprintf(prefix,80, "\n# %*s ", (int)maxwidth, ""); - while ((p = sec->Get_prop(i++))) { + while ((p = sec->Get_prop(i++))) { std::string help = p->Get_help(); std::string::size_type pos = std::string::npos; while ((pos = help.find("\n", pos+1)) != std::string::npos) { help.replace(pos, 1, prefix); } - + fprintf(outfile, "# %*s: %s", (int)maxwidth, p->propname.c_str(), help.c_str()); std::vector values = p->GetValues(); @@ -732,7 +733,7 @@ bool Config::PrintConfig(char const * const configfilename) const { helpstr++; } } - + fprintf(outfile,"\n"); (*tel)->PrintData(outfile); fprintf(outfile,"\n"); /* Always an empty line between sections */ @@ -740,9 +741,9 @@ bool Config::PrintConfig(char const * const configfilename) const { fclose(outfile); return true; } - -Section_prop* Config::AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange){ + +Section_prop* Config::AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange) { Section_prop* blah = new Section_prop(_name); blah->AddInitFunction(_initfunction,canchange); sectionlist.push_back(blah); @@ -758,7 +759,7 @@ Section_prop::~Section_prop() { } -Section_line* Config::AddSection_line(char const * const _name,void (*_initfunction)(Section*)){ +Section_line* Config::AddSection_line(char const * const _name,void (*_initfunction)(Section*)) { Section_line* blah = new Section_line(_name); blah->AddInitFunction(_initfunction); sectionlist.push_back(blah); @@ -767,7 +768,7 @@ Section_line* Config::AddSection_line(char const * const _name,void (*_initfunct void Config::Init() { - for (const_it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ + for (const_it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++) { (*tel)->ExecuteInit(); } } @@ -806,36 +807,35 @@ Config::~Config() { } } -Section* Config::GetSection(int index){ +Section* Config::GetSection(int index) { for (it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ if (!index--) return (*tel); } return NULL; } -Section* Config::GetSection(string const& _sectionname) const{ +Section* Config::GetSection(string const& _sectionname) const { for (const_it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ if (!strcasecmp((*tel)->GetName(),_sectionname.c_str())) return (*tel); } return NULL; } -Section* Config::GetSectionFromProperty(char const * const prop) const{ +Section* Config::GetSectionFromProperty(char const * const prop) const { for (const_it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ if ((*tel)->GetPropValue(prop) != NO_SUCH_PROPERTY) return (*tel); } return NULL; } - -bool Config::ParseConfigFile(char const * const configfilename){ +bool Config::ParseConfigFile(char const * const configfilename) { //static bool first_configfile = true; ifstream in(configfilename); if (!in) return false; const char * settings_type; settings_type = (configfiles.size() == 0)? "primary":"additional"; configfiles.push_back(configfilename); - + LOG_MSG("CONFIG:Loading %s settings from config file %s", settings_type,configfilename); //Get directory from configfilename, used with relative paths. @@ -848,7 +848,7 @@ bool Config::ParseConfigFile(char const * const configfilename){ Section* currentsection = NULL; Section* testsec = NULL; while (getline(in,gegevens)) { - + /* strip leading/trailing whitespace */ trim(gegevens); if(!gegevens.size()) continue; @@ -909,7 +909,7 @@ void Config::ParseEnv(char ** envp) { } } -void Config::SetStartUp(void (*_function)(void)) { +void Config::SetStartUp(void (*_function)(void)) { _start_function=_function; } @@ -996,7 +996,7 @@ bool CommandLine::FindStringRemain(char const * const name,std::string & value) return true; } -/* Only used for parsing command.com /C +/* Only used for parsing command.com /C * Allowing /C dir and /Cdir * Restoring quotes back into the commands so command /C mount d "/tmp/a b" works as intended */ @@ -1030,8 +1030,8 @@ bool CommandLine::FindStringRemainBegin(char const * const name,std::string & va } bool CommandLine::GetStringRemain(std::string & value) { - if(!cmds.size()) return false; - + if (!cmds.size()) return false; + cmd_it it=cmds.begin();value=(*it++); for(;it != cmds.end();it++) { value+=" "; @@ -1039,7 +1039,7 @@ bool CommandLine::GetStringRemain(std::string & value) { } return true; } - + unsigned int CommandLine::GetCount(void) { return (unsigned int)cmds.size(); @@ -1083,7 +1083,7 @@ int CommandLine::GetParameterFromList(const char* const params[], std::vector