Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 64165 Details for
Bug 167141
Remaining memory leak in Windows Agent Controller w/ compatibility layer when executing tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
patch
patch_167141.txt (text/plain), 27.37 KB, created by
Igor Alelekov
on 2007-04-18 07:44:49 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Igor Alelekov
Created:
2007-04-18 07:44:49 EDT
Size:
27.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.agentcontroller >Index: src-native-new/src/shared/TPTPUtil/TPTPUtil.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/shared/TPTPUtil/TPTPUtil.cpp,v >retrieving revision 1.34 >diff -u -r1.34 TPTPUtil.cpp >--- src-native-new/src/shared/TPTPUtil/TPTPUtil.cpp 28 Aug 2006 18:42:09 -0000 1.34 >+++ src-native-new/src/shared/TPTPUtil/TPTPUtil.cpp 18 Apr 2007 11:38:35 -0000 >@@ -128,26 +128,25 @@ > XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse(*domBufIS); > > //Get all the tags into the LnList >- DOMNodeList *nodelist = doc->getElementsByTagName(XMLString::transcode(XML_FRAG_BEGIN_TAG)); >+ XMLCh *cmdTag = XMLString::transcode(XML_FRAG_BEGIN_TAG); >+ DOMNodeList *nodelist = doc->getElementsByTagName(cmdTag); >+ XMLString::release(&cmdTag); > > int nodelength = nodelist->getLength(); > >- if(nodelength == 0) { return -1;} /* No Cmd tag and hence no more parsing */ >+ if(nodelength == 0) { return -1;} > >+ > for(int i = 0; i < nodelength; i++) > { >- tempnodename = XMLString::transcode(nodelist->item(i)->getNodeName()); >- >- if(strcmp(tempnodename,XML_FRAG_BEGIN_TAG)==0) >- { > DOMNode* cmdNode = nodelist->item(i)->getChildNodes()->item(0); > // Look out for whitespace before the command node > if ( cmdNode->getNodeType() == DOMNode::TEXT_NODE ) > cmdNode = nodelist->item(i)->getChildNodes()->item(1); > >- char* tempCmdName = XMLString::transcode(cmdNode->getNodeName()); >- *cmdName = (char *)tptp_malloc(strlen(tempCmdName) + 1); >- strcpy(*cmdName,tempCmdName); >+ int cmdLen = XMLString::stringLen(cmdNode->getNodeName()); >+ *cmdName = (char *)tptp_malloc(cmdLen+1); >+ XMLString::transcode(cmdNode->getNodeName(), *cmdName, cmdLen); > > /* Get the interface ID from the command sub-element */ > DOMNamedNodeMap *cmdattrs = cmdNode->getAttributes(); >@@ -156,15 +155,15 @@ > { > DOMAttr *attributeNode = (DOMAttr*) cmdattrs->item(j); > char *attrname = XMLString::transcode(attributeNode->getName()); >- char *attrvalue = XMLString::transcode(attributeNode->getValue()); > >- if(strcmp(attrname, XML_ATTR_IID) == 0) >- { >- *interfaceID = (char *)tptp_malloc(strlen(attrvalue) + 1); >- strcpy( *interfaceID, attrvalue ); >+ if(strcmp(attrname, XML_ATTR_IID) == 0) { >+ int attrLen = XMLString::stringLen(attributeNode->getValue()); >+ *interfaceID = (char *)tptp_malloc(attrLen + 1); >+ XMLString::transcode(attributeNode->getValue(), *interfaceID, attrLen); >+ XMLString::release(&attrname); >+ break; > } > >- XMLString::release(&attrvalue); > XMLString::release(&attrname); > > } //for(all attributes) >@@ -176,7 +175,6 @@ > { > DOMAttr *attributeNode = (DOMAttr*) attributes->item(k); > char *attrname = XMLString::transcode(attributeNode->getName()); >- > char *attrvalue = XMLString::transcode(attributeNode->getValue()); > > if(strcmp(attrname, XML_ATTR_SRC) == 0){*sourceID = atoi(attrvalue);} >@@ -248,7 +246,6 @@ > tptp_list_add(*paramList, (void*)newParam); > tptp_free( parambuffer ); > } >- > } > else > { >@@ -284,13 +281,13 @@ > } > > XMLString::release( &tempparmname ); >- } >- } //for(all childnodelist.items()) >- } > >- XMLString::release(&tempnodename); >+ } // ELEMENT node >+ } //for(all childnodelist.items()) > }// For the nodes in the nodelist > >+ delete domBufIS; >+ delete tptp_dom_err; > parser->release(); > > return 0; >@@ -334,52 +331,52 @@ > int getDestinationID(const char* cmd, int *dest) > { > try { >+ //Build a MemBuf Input source >+ MemBufInputSource *is = new MemBufInputSource((const XMLByte*)cmd, strlen(cmd), "getDestinationID()", false); >+ >+ //Wrap the MemBufInputSource >+ Wrapper4InputSource *domBufIS = new Wrapper4InputSource(is); >+ > //Initialize the XML parser > DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(&chNull); > DOMBuilder *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); >- >+ > TPTPParserErrorHandler* tptp_dom_err = new TPTPParserErrorHandler(); > parser->setErrorHandler(tptp_dom_err); > >- //Build a MemBuf Input source >- MemBufInputSource *is = new MemBufInputSource(reinterpret_cast<XMLByte const*>(cmd), >- strlen(cmd),"getDestinationID()",false ); >- //Wrap the MemBufInputSource >- Wrapper4InputSource* domBufIS = NULL; >- domBufIS = new Wrapper4InputSource(is); >- > //Get the DOM document by passing the input string to the parser > XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse(*domBufIS); > > //Get all the tags into the LnList - just get the node "Cmd", its children and attributes >- DOMNodeList *nodelist = doc->getElementsByTagName(XMLString::transcode(XML_FRAG_BEGIN_TAG)); >- >+ XMLCh *cmdTag = XMLString::transcode(XML_FRAG_BEGIN_TAG); >+ DOMNodeList *nodelist = doc->getElementsByTagName(cmdTag); >+ XMLString::release(&cmdTag); >+ > int nodelength = nodelist->getLength(); >- if(nodelength == 0) { return -1;} /* No Cmd tag and hence no more parsing */ >+ if(nodelength == 0) return -1; > > /* Get the attribute related information */ > /* The attributes are stored in the NodeMap HashMap of the attribute name - value */ > DOMNamedNodeMap *attributes = nodelist->item(0)->getAttributes(); > int attrlen = attributes->getLength(); >+ XMLCh* destAttr = XMLString::transcode(XML_ATTR_DEST); > > for(int k=0;k<attrlen;k++) > { > DOMAttr *attributeNode = (DOMAttr*) attributes->item(k); >- char *attrname = XMLString::transcode(attributeNode->getName()); >- >- char *attrvalue = XMLString::transcode(attributeNode->getValue()); >- if(strcmp(attrname,XML_ATTR_DEST) == 0) >- { >+ if (XMLString::compareString(destAttr, attributeNode->getName()) == 0) { >+ char *attrvalue = XMLString::transcode(attributeNode->getValue()); > *dest = atoi(attrvalue); >- XMLString::release(&attrname); > XMLString::release(&attrvalue); > break; > } >- XMLString::release(&attrname); >- XMLString::release(&attrvalue); > } //Attribute loop > >- delete parser; >+ XMLString::release(&destAttr); >+ >+ delete domBufIS; >+ delete tptp_dom_err; >+ parser->release(); > > return 0; > } //end try >@@ -595,17 +592,15 @@ > XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse(*domBufIS); > > // Get all the tags into the LnList - just get the node "property" and its children >- DOMNodeList *nodelist = doc->getElementsByTagName(XMLString::transcode("property")); >+ XMLCh* propTag = XMLString::transcode("property"); >+ DOMNodeList *nodelist = doc->getElementsByTagName(propTag); >+ XMLString::release(&propTag); > > int nodelength = nodelist->getLength(); > if(nodelength == 0) { return -1;} /* No property tag and hence no more parsing */ > > for(int i = 0; i < nodelength; i++) > { >- char* tempnodename = XMLString::transcode(nodelist->item(i)->getNodeName()); >- >- if(strcmp(tempnodename,"property")==0) >- { > /* Get the parameters */ > DOMNodeList *childnodelist = nodelist->item(i)->getChildNodes(); > int childnodelength = childnodelist->getLength(); >@@ -669,12 +664,11 @@ > XMLString::release( &tempparmname ); > } > } //for(all childnodelist.items()) >- } >- >- XMLString::release(&tempnodename); > }// For the nodes in the nodelist > >- delete parser; >+ delete domBufIS; >+ delete tptp_dom_err; >+ parser->release(); > > if ( (*name != NULL) && (*type != NULL) && (*value != NULL) ) > { >@@ -767,211 +761,6 @@ > return 0; > } > >-/******************Extract Commands from a batched command set***********/ >-int getCommands( const char* cmd, tptp_list_t *templist) >-{ >- try { >- //Initialize the XML parser >- //PENDING: Apply CHARSET in the DOMImplementation >- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(&chNull); >- DOMBuilder *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); >- >- TPTPParserErrorHandler* tptp_dom_err = new TPTPParserErrorHandler(); >- parser->setErrorHandler(tptp_dom_err); >- >- //placeholders >- char *tempnodename = 0; >- char *tempbuf = 0; >- >- //Build a MemBuf Input source >- MemBufInputSource *is = new MemBufInputSource((const XMLByte*)cmd,strlen(cmd),"getCommands()",false); >- >- //Wrap the MemBufInputSource >- Wrapper4InputSource* domBufIS = NULL; >- domBufIS = new Wrapper4InputSource(is); >- >- //Get the DOM document by passing the input string to the parser >- XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse(*domBufIS); >- >- //Get all the tags into the LnList >- DOMNodeList *nodelist = doc->getElementsByTagName(XMLString::transcode(XML_FRAG_BEGIN_TAG)); >- >- int nodelength = nodelist->getLength(); >- if(nodelength == 0) { return -1;} /* No Cmd tag and hence no more parsing */ >- >- //Initialize the tptp list >- tptp_list_init(templist); >- >- for(int i = 0; i < nodelength; i++) >- { >- tempnodename = (char *)tptp_malloc(strlen(XMLString::transcode(nodelist->item(i)->getNodeName()))); >- tempnodename = XMLString::transcode(nodelist->item(i)->getNodeName()); >- >- //TO DO >- char *nodedata = 0; >- int ret = openAttribTag(tempnodename, &nodedata); >- tempbuf = (char *)tptp_malloc(strlen(nodedata) +1); >- strcpy(tempbuf,nodedata); >- tptp_free(nodedata); >- >- /* Get all the attributes related information */ >- DOMNamedNodeMap *attributes = nodelist->item(i)->getAttributes(); >- int attrlen = attributes->getLength(); >- >- for(int k = attrlen-1; k >= 0; k--) >- { >- DOMAttr *attributeNode = (DOMAttr*) attributes->item(k); >- char *attrname = XMLString::transcode(attributeNode->getName()); >- >- char *attrvalue = XMLString::transcode(attributeNode->getValue()); >- >- char *catvalue = 0; >- ret = fmtAttrib(attrname, attrvalue, &catvalue); >- >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(catvalue)+1); >- strcat(tempbuf,catvalue); >- >- tptp_free(catvalue); >- >- XMLString::release(&attrvalue); >- XMLString::release(&attrname); >- >- } >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(TAG_CLS)+1); >- strcat(tempbuf,TAG_CLS); >- >- DOMNodeList *childnodelist = nodelist->item(i)->getChildNodes(); >- int childnodelength = childnodelist->getLength(); >- >- for(int nl = 0; nl < childnodelength; nl++) >- { >- char *childnodename = XMLString::transcode(childnodelist->item(nl)->getNodeName()); >- char *childdata = 0; >- int ret = openAttribTag(childnodename, &childdata); >- >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(childdata)+1); >- strcat(tempbuf, childdata); >- >- if(childnodelist->item(nl)->hasChildNodes()) >- { >- if(childnodelist->item(nl)->hasAttributes()) >- { >- DOMNamedNodeMap *cattributes = childnodelist->item(nl)->getAttributes(); >- int cattrlen = cattributes->getLength(); >- >- for(int cattr=0;cattr<cattrlen;cattr++) >- { >- DOMAttr *cattributeNode = (DOMAttr*)cattributes->item(cattr); >- char *cattrname = XMLString::transcode(cattributeNode->getName()); >- >- char *cattrvalue = XMLString::transcode(cattributeNode->getValue()); >- >- char *chatvalue = 0; >- ret = fmtAttrib(cattrname, cattrvalue, &chatvalue); >- >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(chatvalue)+1); >- strcat(tempbuf,chatvalue); >- >- tptp_free(chatvalue); >- >- XMLString::release(&cattrvalue); >- XMLString::release(&cattrname); >- } >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(TAG_CLS)+1); >- strcat(tempbuf,TAG_CLS); >- } >- >- DOMNodeList *nextchildnodelist = childnodelist->item(nl)->getChildNodes(); >- int childnllength = nextchildnodelist->getLength(); >- for(int i= 0; i < childnllength; i++) >- { >- char *nextchildname = XMLString::transcode(nextchildnodelist->item(i)->getNodeName()); >- char *tempdata = 0; >- int ret = 0; >- ret = openTag(nextchildname, &tempdata); >- >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(tempdata)+1); >- strcat(tempbuf, tempdata); >- tptp_free(tempdata); >- >- if( nextchildnodelist->item(i)->hasChildNodes() && nextchildnodelist->item(i)->getFirstChild()->getNodeType() == DOMNode::TEXT_NODE) >- { >- char *childnodevalue = XMLString::transcode(nextchildnodelist->item(i)->getFirstChild()->getNodeValue()); >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(childnodevalue)+1); >- strcat(tempbuf, childnodevalue); >- XMLString::release(&childnodevalue); >- } >- //reset the tempdata >- tempdata = 0; >- ret = closeTag(nextchildname, &tempdata); >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(tempdata)+1); >- strcat(tempbuf, tempdata); >- tptp_free(tempdata); >- XMLString::release(&nextchildname); >- } >- >- } >- tptp_free(childdata); >- char *clstag = 0; >- ret = closeTag(childnodename,&clstag); >- >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(clstag)+1); >- strcat(tempbuf, clstag); >- tptp_free(clstag); >- XMLString::release(&childnodename); >- } >- >- char *closehdrtag = 0; >- ret = closeTag(tempnodename, &closehdrtag); >- tempbuf = (char *)realloc(tempbuf,strlen(tempbuf)+strlen(closehdrtag)+1); >- strcat(tempbuf, closehdrtag); >- tptp_free(closehdrtag); >- >- int retlist = tptp_list_add(templist, (void *)tempbuf); >- >- XMLString::release(&tempnodename); >- }// For the nodes in the nodelist >- >- tptp_free(tempbuf); >- >- delete parser; >- >- return 0; >- } //end try >- >- catch (const DOMException& error) >- { >- if ( error.msg != 0 ) >- { >- char *errmesg = XMLString::transcode(error.msg); >- TPTP_LOG_PARSE_MSG1("XML/DOM Exception: %s", errmesg); >- XMLString::release(&errmesg); >- } >- else >- { >- // Can't get the msg string so print the error code. >- TPTP_LOG_PARSE_MSG1("XML/DOM Exception: error code %d", error.code); >- >- } >- >- TPTP_LOG_PARSE_MSG1("XML/DOM Exception occurred while parsing Cmd from batch command string \"%s\"\n", (cmd?cmd:"null")); >- return -1; >- } >- catch (const XMLException& error) >- { >- char *errmesg = XMLString::transcode(error.getMessage()); >- TPTP_LOG_PARSE_MSG2("XML Exception: %s (at line %d)", errmesg, error.getSrcLine()); >- XMLString::release(&errmesg); >- TPTP_LOG_PARSE_MSG1("XML Exception occurred while parsing Cmd from batch command string \"%s\"\n", (cmd?cmd:"null")); >- return -1; >- } >- catch(...) >- { >- TPTP_LOG_PARSE_MSG1("Unexpected exception occurred while parsing Cmd from batch command string \"%s\"\n", (cmd?cmd:"null")); >- return -1; >- } >-} >- > int isEqualString( const char* str1, const char* str2 ) > { > /* Even if both strings pointers are NULL, that isn't what we're looking for */ >@@ -1539,7 +1328,9 @@ > } > } > >- delete parser; >+ delete domBufIS; >+ delete tptp_dom_err; >+ parser->release(); > return 0; > } //end try > >@@ -1614,7 +1405,9 @@ > XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse(*domBufIS); > > //Get all the tags into the LnList - just get the node "Cmd", its children and attributes >- DOMNodeList *nodelist = doc->getElementsByTagName(XMLString::transcode(rootName)); >+ XMLCh* rootTag = XMLString::transcode(rootName); >+ DOMNodeList *nodelist = doc->getElementsByTagName(rootTag); >+ XMLString::release(&rootTag); > > int nodelength = nodelist->getLength(); > >@@ -1629,10 +1422,6 @@ > > for(int i = 0; i < nodelength; i++) > { >- char* tempnodename = XMLString::transcode(nodelist->item(i)->getNodeName()); >- >- if(strcmp(tempnodename,rootName)==0) >- { > DOMNodeList *childlist = nodelist->item(i)->getChildNodes(); > > int childlength = childlist->getLength(); >@@ -1668,13 +1457,9 @@ > } > else if ( elemnode->getNodeType() == DOMNode::TEXT_NODE ) > { >- char *tempval = XMLString::transcode(elemnode->getNodeValue()); >- *value = (char*)tptp_malloc( strlen(tempval)+1 ); >- if ( *value != NULL ) >- { >- strcpy( *value, tempval ); >- } >- XMLString::release( &tempval ); >+ int valueLen = XMLString::stringLen(elemnode->getNodeValue()); >+ *value = (char*)tptp_malloc(valueLen+1); >+ XMLString::transcode(elemnode->getNodeValue(), *value, valueLen); > XMLString::release( &nodeName ); > break; > } >@@ -1690,13 +1475,11 @@ > > XMLString::release( &nodeName ); > } >- } >- >- XMLString::release(&tempnodename); > }// For the nodes in the nodelist > >- delete parser; > delete domBufIS; >+ delete tptp_dom_err; >+ parser->release(); > > if ( *value == 0 ) > { >@@ -1947,13 +1730,10 @@ > *nList = NULL; > > //Get all the tags into the LnList >- DOMNodeList *node = doc->getElementsByTagName(XMLString::transcode(ELEMENT_CONFIGURATION_VARIABLE)); >- char *tempnodename = XMLString::transcode(node->item(0)->getNodeName()); >- >- if(strcmp(tempnodename, ELEMENT_CONFIGURATION_VARIABLE) != 0) >- { >- return -1; // return fast if we cannot parse an application >- } >+ XMLCh *varTag = XMLString::transcode(ELEMENT_CONFIGURATION_VARIABLE); >+ DOMNodeList *node = doc->getElementsByTagName(varTag); >+ XMLString::release(&varTag); >+ > DOMNodeList *varNode = node->item(0)->getChildNodes(); > int varNodeLength = varNode->getLength(); > >@@ -1998,6 +1778,9 @@ > mask = (char *) tptp_malloc(strlen(cAttrValue) +1); > strcpy(mask, cAttrValue); > } >+ >+ XMLString::release(&cAttrName); >+ XMLString::release(&cAttrValue); > } > > if(host) { /* Is this a host specification or a network */ >@@ -2046,6 +1829,9 @@ > mask = (char *) tptp_malloc(strlen(cAttrValue) +1); > strcpy(mask, cAttrValue); > } >+ >+ XMLString::release(&cAttrName); >+ XMLString::release(&cAttrValue); > } > > if(host) { /* Is this a host specification or a network */ >@@ -2074,10 +1860,16 @@ > if(mask) tptp_free(mask); mask = NULL; > } > >+ XMLString::release(&childnodeName); > } > } >+ >+ XMLString::release(&nodeName); > } >- delete parser; >+ >+ delete domBufIS; >+ delete tptp_dom_err; >+ parser->release(); > > return 0; > } //end try >Index: src-native-new/src/transport/TPTPClientCompTL/Connect2AC.c >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/transport/TPTPClientCompTL/Connect2AC.c,v >retrieving revision 1.65 >diff -u -r1.65 Connect2AC.c >--- src-native-new/src/transport/TPTPClientCompTL/Connect2AC.c 9 Apr 2007 17:01:24 -0000 1.65 >+++ src-native-new/src/transport/TPTPClientCompTL/Connect2AC.c 18 Apr 2007 11:38:37 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2006 Intel Corporation. >+ * Copyright (c) 2005, 2007 Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -8,7 +8,7 @@ > * Contributors: > * Andy Kaylor, Intel - Initial API and Implementation > * >- * $Id: Connect2AC.c,v 1.65 2007/04/09 17:01:24 gnagarajan Exp $ >+ * $Id: Connect2AC.c,v 1.66 2007/04/13 16:10:11 jkubasta Exp $ > * > *******************************************************************************/ > >@@ -58,8 +58,8 @@ > tptp_int32 ret; > tptp_int32 sourceID; > tptp_int32 context; >- char* interfaceID = 0; >- char* cmdName = 0; >+ char* interfaceID = NULL; >+ char* cmdName = NULL; > tptp_list_t* paramList; > > /* Parse the XML into useful blocks */ >@@ -76,8 +76,8 @@ > ret = processCommand( stateData, ccb, pCmdBlock, sourceID, context, interfaceID, cmdName, paramList ); > > /* Free the resources allocated by parseCommand */ >- tptp_free( interfaceID ); >- tptp_free( cmdName ); >+ if (interfaceID != NULL) tptp_free( interfaceID ); >+ if (cmdName != NULL) tptp_free( cmdName ); > tptp_list_clear( paramList ); > tptp_free( paramList ); > >@@ -287,6 +287,7 @@ > > DO NOT EVEN CONSIDER COPYING THIS CODE!!! */ > agentID = (agent->agentToken & (~0x40000000)); >+ agent->agentID = agentID; > } > } > else >Index: src-native-new/src/transport/TPTPAgentCompTL/Connect2AC.c >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/transport/TPTPAgentCompTL/Connect2AC.c,v >retrieving revision 1.52 >diff -u -r1.52 Connect2AC.c >--- src-native-new/src/transport/TPTPAgentCompTL/Connect2AC.c 9 Apr 2007 17:01:25 -0000 1.52 >+++ src-native-new/src/transport/TPTPAgentCompTL/Connect2AC.c 18 Apr 2007 11:38:35 -0000 >@@ -230,8 +230,8 @@ > tptp_int32 ret; > tptp_int32 sourceID; > tptp_int32 context; >- char* interfaceID = 0; >- char* cmdName = 0; >+ char* interfaceID = NULL; >+ char* cmdName = NULL; > tptp_list_t* paramList; > > /* Parse the XML into useful blocks */ >@@ -245,11 +245,12 @@ > } > else > { >+ > ret = processCommand( stateData, agent, pCmdBlock, sourceID, context, interfaceID, cmdName, paramList ); > > /* Free the resources allocated by parseCommand */ >- tptp_free( interfaceID ); >- tptp_free( cmdName ); >+ if (interfaceID != NULL) tptp_free( interfaceID ); >+ if (cmdName != NULL) tptp_free( cmdName ); > tptp_list_clear( paramList ); > tptp_free( paramList ); > return ret; >Index: src-native-new/src/CmdExtractor/MsgParser.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/CmdExtractor/MsgParser.cpp,v >retrieving revision 1.22 >diff -u -r1.22 MsgParser.cpp >--- src-native-new/src/CmdExtractor/MsgParser.cpp 8 Sep 2006 22:24:24 -0000 1.22 >+++ src-native-new/src/CmdExtractor/MsgParser.cpp 18 Apr 2007 11:38:35 -0000 >@@ -33,6 +33,8 @@ > > #include "tptp/ParserErrorHandler.h" > >+#define COMMAND_TAG "Cmd" >+ > int writeNodeToBuffer( DOMNode* node, char** buffer ) > { > DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(&chNull); >@@ -52,9 +54,8 @@ > > strcpy( *buffer, (char *)target->getRawBuffer() ); > >- writer->release(); >- > delete target; >+ writer->release(); > > return 0; > } >@@ -73,7 +74,7 @@ > msgLen, > "parseMessage()", > false ); >- Wrapper4InputSource inputSrc(stringInputSrc); >+ Wrapper4InputSource *inputSrc = new Wrapper4InputSource(stringInputSrc); > > DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(&chNull); > DOMBuilder *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); >@@ -81,71 +82,36 @@ > TPTPParserErrorHandler* tptp_dom_err = new TPTPParserErrorHandler(); > parser->setErrorHandler(tptp_dom_err); > >- XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse( inputSrc ); >+ XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse( *inputSrc ); > > DOMNode *node = doc->getDocumentElement(); >+ char *nodename = XMLString::transcode(node->getNodeName()); >+ if (strcmp(nodename, "Cmd") == 0) { >+ cx->ac.processCommand( cx->ac.cmo, strlen(msg), msg); >+ } >+ else { >+ XMLCh* cmdTag = XMLString::transcode(COMMAND_TAG); >+ DOMNodeList *nodelist = doc->getElementsByTagName(cmdTag); >+ XMLString::release(&cmdTag); > >- DOMNodeList *nodelist = doc->getElementsByTagName(XMLString::transcode("*")); >- >- int nodelength = nodelist->getLength(); >- >- for(int i = 0; i < nodelength; i++) >- { >- char *tempnodename = XMLString::transcode(nodelist->item(i)->getNodeName()); >- >- if ( 0 == strcmp("Cmd", tempnodename) ) >- { >+ int nodelength = nodelist->getLength(); >+ >+ for(int i=0; i<nodelength; i++) { > char* cmdstr=NULL; >- DOMNode *node = nodelist->item(i); >- unsigned int destID = 0; > >- if (node->getNodeType() != DOMNode::ELEMENT_NODE) >- { >- TPTP_LOG_WARNING_MSG( cx, "Unexpected non-element node named Cmd." ); >- continue; >- } >- >- if ( 0 == writeNodeToBuffer( node, &cmdstr ) ) >- { >- size_t srcLen = msgLen; >- size_t resultLen = strlen(cmdstr); >- >- /* We might have stripped out white space, so a small difference (less than about 2%) >- is only noteworthy if the result is bigger than the source */ >- if ( (resultLen > srcLen) || >- ((srcLen - resultLen) > (srcLen/50)) ) >- { >- /* >- * The diagnostic messages below have been causing problems. The top message was supposed to >- * work around the problem that if you pass more than 8k of output to the LOG macro it can >- * crash. HOWEVER, it appears the 64-bit versions of Windows don't recognize the precision >- * specifier, so this doesn't solve the problem. >- * >- * Generally, this diagnostic hasn't proven useful anyway, so it seemed better to just >- * comment it out than to "fix" it again. If you are debugging a problem with message >- * parsing, this might be temporarily useful to you. >- * >- *if ((TPTP_MAX_MSG_SIZE <= resultLen) || (TPTP_MAX_MSG_SIZE <= srcLen)) >- *{ >- * TPTP_LOG_WARNING_MSG3( cx, "The reassembled command created by the command extractor is a different size : in = %d, out = %d, (msg exceeds log buffer, truncated to 1k) msg=%.1024s", srcLen, resultLen, msg ); >- *} else { >- * TPTP_LOG_WARNING_MSG2( cx, "The reassembled command created by the command extractor is a different size : in = %s, out = %s", msg, cmdstr ); >- *} >- */ >- } >+ if ( 0 == writeNodeToBuffer( nodelist->item(i), &cmdstr ) ) { > cx->ac.processCommand( cx->ac.cmo, strlen(cmdstr), cmdstr ); >- >- tptp_free( cmdstr ); >+ tptp_free (cmdstr); > } >- else >- { >+ else { > TPTP_LOG_ERROR_MSG1( cx, "Unable to allocate buffer for cmd: %s", msg ); > } > } >- >- XMLString::release(&tempnodename); > } > >+ XMLString::release(&nodename); >+ delete inputSrc; >+ delete tptp_dom_err; > parser->release(); > > return 0; >Index: src-native-new/include/tptp/TPTPUtils.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/include/tptp/TPTPUtils.h,v >retrieving revision 1.20 >diff -u -r1.20 TPTPUtils.h >--- src-native-new/include/tptp/TPTPUtils.h 4 Apr 2006 21:26:00 -0000 1.20 >+++ src-native-new/include/tptp/TPTPUtils.h 18 Apr 2007 11:38:34 -0000 >@@ -147,8 +147,6 @@ > > int parsePropertyListEntry( char* property, char** name, char** type, char** value ); > >-int getCommands( const char* cmd, tptp_list_t* templist ); >- > int getXMLElements( const char* cmd, tptp_list_t** paramList); > > int getXmlFragmentElementString( const char* fragment, char* rootName, char* elemName, char **value );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 167141
:
55269
| 64165