Loading CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ enable_testing () set(LIBV "1.0.0") set(Upstream_VERSION 1.0.0) SET(CMAKE_CXX_FLAGS "-fPIC -Wall") SET(CMAKE_CXX_FLAGS "-fPIC -Wall -fstack-check -fstack-protector") configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) Loading src/html.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -971,19 +971,27 @@ PRINTNEXTEL: } libhtmlpp::HtmlElement *libhtmlpp::HtmlElement::getElementbyID(const char *id) const{ for(const Element *curel=this; curel; curel=curel->nextElement()){ std::stack <Element*> *childs=new std::stack <Element*>; const Element *curel=this; SEARCHBYID: while( (curel=curel->nextElement()) ) { if(curel->getType()==HtmlEl){ if(((HtmlElement*)curel)->_childElement){ HtmlElement *find=((HtmlElement*)((HtmlElement*)curel)->_childElement)->getElementbyID(id); if(find) return find; childs->push(((HtmlElement*)curel)->_childElement); } const char *key=((HtmlElement*)curel)->getAtributte("id"); if(key && strcmp(key,id)==0){ delete childs; return (HtmlElement*)curel; } } } if(!childs->empty()){ curel=childs->top(); childs->pop(); goto SEARCHBYID; } delete childs; return nullptr; } Loading Loading
CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ enable_testing () set(LIBV "1.0.0") set(Upstream_VERSION 1.0.0) SET(CMAKE_CXX_FLAGS "-fPIC -Wall") SET(CMAKE_CXX_FLAGS "-fPIC -Wall -fstack-check -fstack-protector") configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) Loading
src/html.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -971,19 +971,27 @@ PRINTNEXTEL: } libhtmlpp::HtmlElement *libhtmlpp::HtmlElement::getElementbyID(const char *id) const{ for(const Element *curel=this; curel; curel=curel->nextElement()){ std::stack <Element*> *childs=new std::stack <Element*>; const Element *curel=this; SEARCHBYID: while( (curel=curel->nextElement()) ) { if(curel->getType()==HtmlEl){ if(((HtmlElement*)curel)->_childElement){ HtmlElement *find=((HtmlElement*)((HtmlElement*)curel)->_childElement)->getElementbyID(id); if(find) return find; childs->push(((HtmlElement*)curel)->_childElement); } const char *key=((HtmlElement*)curel)->getAtributte("id"); if(key && strcmp(key,id)==0){ delete childs; return (HtmlElement*)curel; } } } if(!childs->empty()){ curel=childs->top(); childs->pop(); goto SEARCHBYID; } delete childs; return nullptr; } Loading