1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

feature #1617: Remove leading blanks from file attributes

This commit is contained in:
Ruben S. Montero 2012-11-23 19:51:45 +01:00
parent f51a3a45ce
commit d6538d5081
2 changed files with 17 additions and 6 deletions

View File

@ -679,9 +679,9 @@ public:
* @param error description in case of failure
* @return 0 on success.
*/
int parse_file_attribute(const string& attribute,
vector<int>& img_ids,
string& error);
int parse_file_attribute(string attribute,
vector<int>& img_ids,
string& error);
/**
* Factory method for virtual machine templates

View File

@ -2114,9 +2114,9 @@ error_yy:
/* -------------------------------------------------------------------------- */
int VirtualMachine::parse_file_attribute(const string& attribute,
vector<int>& img_ids,
string& error)
int VirtualMachine::parse_file_attribute(string attribute,
vector<int>& img_ids,
string& error)
{
YY_BUFFER_STATE str_buffer = 0;
const char * str;
@ -2124,6 +2124,17 @@ int VirtualMachine::parse_file_attribute(const string& attribute,
ostringstream oss_parsed;
char * error_msg = 0;
size_t non_blank_pos;
//Removes leading blanks from attribute, these are not managed
//by the parser as it is common to the other VM varibales
non_blank_pos = attribute.find_first_not_of(" \t\n\v\f\r");
if ( non_blank_pos != string::npos )
{
attribute.erase(0, non_blank_pos);
}
pthread_mutex_lock(&lex_mutex);
str = attribute.c_str();