Re: Compiler Errors



Hi Team,

Two questions below:

1/ � Iam getting one more crash where iam passing std::string to a get_children() function. Iam using std::string type as inp argument. is this ok to pass std::string to an ustring. I learnt that if it is english then it will not be an issue.�


std::string node_str = "example"
Node::NodeList tmp_lst = rnode->get_children( node_str );

What if i change the inp argument to function call as node_str.c_str(). Please let me know.


(gdb) bt
#0  0x0000003cea6a287b in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) ()
   from /lib64/libstdc++.so.6

2/ � Iam getting the below crash trace with the function code ( see the code after stack trace here ). This happens some times.

0x00007f2d9d3122e6 in ?? () from /lib64/libxml++-2.6.so.2
#1 �0x00007f2d9cfec86a in xmlFreeNodeList__internal_alias (cur=0x7f2d9405ac4f)
� � at /home/rupesh/install/rootfs_tmp1/build/libxml2/src/libxml2-2.6.30/tree.c:3382
#2 �0x00007f2d9cfec73d in xmlFreeNodeList__internal_alias (cur=0x7f2d94012d10)
� � at /home/rupesh/install/rootfs_tmp1/build/libxml2/src/libxml2-2.6.30/tree.c:3386
#3 �0x00007f2d9cfec73d in xmlFreeNodeList__internal_alias (cur=0x7f2d940cf380)
� � at /home/rupesh/install/rootfs_tmp1/build/libxml2/src/libxml2-2.6.30/tree.c:3386
#4 �0x00007f2d9cfec588 in xmlFreeDoc__internal_alias (cur=0x7f2d940de110) at /home/rupesh/install/rootfs_tmp1/build/libxml2/src/libxml2-2.6.30/tree.c:1216
#5 �0x00007f2d9d311ef8 in xmlpp::Document::~Document() () from /lib64/libxml++-2.6.so.2
#6 �0x00007f2d9d3158b3 in xmlpp::DomParser::release_underlying() () from /lib64/libxml++-2.6.so.2
#7 �0x00007f2d9d315bf4 in xmlpp::DomParser::~DomParser() () from /lib64/libxml++-2.6.so.2


err GetConfig( const string &feature,const vector<string> &keys,vector< vector <T> >& values )
{

� � � � � � � � int count = 0,loop = 0;
� � � � � � � � bool feat_avl = false,sem_check = true;
� � � � � � � � Node *N = NULL,*r = NULL;
� � � � � � � � string temp_str;
� � � � � � � � const TextNode* text_node = NULL;
� � � � � � � � const CommentNode* comment_node = NULL;

� � � � � � � � try�
� � � � � � � � { ��
� � � � � � � � � � � � if ( ( feature.empty() ) || ( keys.empty() ) || ( mConfFile == "" ) )�
� � � � � � � � � � � � { ��
� � � � � � � � � � � � � � � � return NBA_ERR_ERROR;
� � � � � � � � � � � � } ��

� � � � � � � � � � � � for ( ;count< keys.size(); count++ )
� � � � � � � � � � � � { ��
� � � � � � � � � � � � � � � � if ( keys[count].empty() )
� � � � � � � � � � � � � � � � { ��
� � � � � � � � � � � � � � � � � � �return NBA_ERR_ERROR;
� � � � � � � � � � � � � � � � } ��
� � � � � � � � � � � � } ��
� � � � � � � � � � � � DomParser parser( mConfFile,false );
� � � � � � � � � � � � if( parser )
� � � � � � � � � � � � { ��
� � � � � � � � � � � � � � � � r = parser.get_document()->get_root_node();
� � � � � � � � � � � � } ��

� � � � � � � � � � � � if ( �r == NULL �)�
� � � � � � � � � � � � {
return ERROR; ��
}
� � � � � � � � � � � � � � � ��
Node::NodeList t_lst = r->get_children();
� � � � � � � � � � � � for ( Node::NodeList::iterator temp_node = t_lst.begin(); temp_node != t_lst.end(); ++temp_node )
� � � � � � � � � � � � {
� � � � � � � � � � � � � � � � text_node = dynamic_cast<const TextNode*>( *temp_node);
� � � � � � � � � � � � � � � � comment_node = dynamic_cast<const CommentNode*>(*temp_node);
� � � � � � � � � � � � � � � � if ( ( text_node �&& text_node->is_white_space() ) || ( comment_node ) )
� � � � � � � � � � � � � � � � � � � � continue;
� � � � � � � � � � � � � � � � if ( (*temp_node)->get_name() == feature )
� � � � � � � � � � � � � � � � {
� � � � � � � � � � � � � � � � � � � � feat_avl = true;
� � � � � � � � � � � � � � � � � � � � N = *temp_node;
� � � � � � � � � � � � � � � � � � � � break;
� � � � � � � � � � � � � � � � }
� � � � � � � � � � � � }
� � � � � � � � � � � � if ( feat_avl == false )
� � � � � � � � � � � � {
� � � � � � � � � � � � � � � � return NBA_ERR_ERROR;
� � � � � � � � � � � � }
� � � � � � � � � � � � Node::NodeList tmp_lst = N->get_children();
� � � � � � � � � � � � vector<T> temp_vec_str;
� � � � � � � � � � � � Element *node_element = NULL;
� � � � � � � � � � � � TextNode *con = NULL;
� � � � � � � � � � � � string s;
� � � � � � � � � � � � for( count =0;count< keys.size(); count++ )
� � � � � � � � � � � � {
� � � � � � � � � � � � � � � � temp_vec_str.clear();
� � � � � � � � � � � � � � � � for ( Node::NodeList::iterator t_node = tmp_lst.begin(); t_node != tmp_lst.end(); ++t_node )
� � � � � � � � � � � � � � � � {
� � � � � � � � � � � � � � � � � � � � text_node = dynamic_cast<const TextNode*>( *t_node);
� � � � � � � � � � � � � � � � � � � � comment_node = dynamic_cast<const CommentNode*>(*t_node);
� � � � � � � � � � � � � � � � � � � � if ( ( text_node �&& text_node->is_white_space() ) || ( comment_node ) || ( keys[count] �!= (*t_node)->get_name() ))
� � � � � � � � � � � � � � � � � � � � � � � � continue;

� � � � � � � � � � � � � � � � � � � � node_element = dynamic_cast<Element*>( *t_node );
� � � � � � � � � � � � � � � � � � � � con = node_element->get_child_text();

� � � � � � � � � � � � � � � � � � � � if ( con )
� � � � � � � � � � � � � � � � � � � � {
� � � � � � � � � � � � � � � � � � � � � � � � s = con->get_content();
� � � � � � � � � � � � � � � � � � � � � � � � temp_vec_str.push_back( s );
� � � � � � � � � � � � � � � � � � � � }
� � � � � � � � � � � � � � � � � � � � else
� � � � � � � � � � � � � � � � � � � � {
� � � � � � � � � � � � � � � � � � � � � � � � temp_vec_str.push_back(" ");
� � � � � � � � � � � � � � � � � � � � }
� � � � � � � � � � � � � � � � � � � � values.push_back( temp_vec_str );
� � � � � � � � � � � � � � � � }
� � � � � � � � � � � � }
return NBA_ERR_SUCCESS;
� � � � � � � � }
� � � � � � � � catch( const std::exception &e )
� � � � � � � � {
� � � � � � � � � � � � return NBA_ERR_ERROR;
� � � � � � � � }
}



Thanks!
Santhosh


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]