1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -16,9 +16,9 @@
MA 02110-1301, USA. */
/*******************************************************************************
* $Id: we_xmlop.cpp 4450 2013-01-21 14:13:24Z rdempsey $
*
*******************************************************************************/
* $Id: we_xmlop.cpp 4450 2013-01-21 14:13:24Z rdempsey $
*
*******************************************************************************/
/** @file */
#include <stdio.h>
@ -29,11 +29,10 @@
namespace WriteEngine
{
//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------
XMLOp::XMLOp( ) : m_fDoc( NULL ), m_pRoot( NULL )
XMLOp::XMLOp() : m_fDoc(NULL), m_pRoot(NULL)
{
}
@ -42,8 +41,8 @@ XMLOp::XMLOp( ) : m_fDoc( NULL ), m_pRoot( NULL )
//------------------------------------------------------------------------------
XMLOp::~XMLOp()
{
closeDoc();
xmlCleanupParser();
closeDoc();
xmlCleanupParser();
}
//------------------------------------------------------------------------------
@ -51,11 +50,11 @@ XMLOp::~XMLOp()
//------------------------------------------------------------------------------
void XMLOp::closeDoc()
{
if ( m_fDoc != NULL )
{
xmlFreeDoc( m_fDoc );
m_fDoc = NULL;
}
if (m_fDoc != NULL)
{
xmlFreeDoc(m_fDoc);
m_fDoc = NULL;
}
}
//------------------------------------------------------------------------------
@ -63,29 +62,20 @@ void XMLOp::closeDoc()
// buf - data buffer
// dataType - data type
//------------------------------------------------------------------------------
void XMLOp::convertNodeValue( void* pVal, const char* buf,
XML_DTYPE dataType ) const
void XMLOp::convertNodeValue(void* pVal, const char* buf, XML_DTYPE dataType) const
{
switch ( dataType )
{
case TYPE_CHAR :
strcpy( (char*) pVal, buf );
break;
switch (dataType)
{
case TYPE_CHAR: strcpy((char*)pVal, buf); break;
case TYPE_DOUBLE :
case TYPE_FLOAT :
*((float*)pVal) = (float) atof( buf );
break;
case TYPE_DOUBLE:
case TYPE_FLOAT: *((float*)pVal) = (float)atof(buf); break;
case TYPE_LONGLONG :
*((long long*)pVal) = (long long) atoll( buf );
break;
case TYPE_LONGLONG: *((long long*)pVal) = (long long)atoll(buf); break;
case TYPE_INT :
default :
*((int*)pVal) = (int) atoi( buf );
break;
}
case TYPE_INT:
default: *((int*)pVal) = (int)atoi(buf); break;
}
}
//------------------------------------------------------------------------------
@ -96,25 +86,24 @@ void XMLOp::convertNodeValue( void* pVal, const char* buf,
// pVal (output) - return value buffer
// returns TRUE if found, FALSE otherwise
//------------------------------------------------------------------------------
bool XMLOp::getNodeAttribute( xmlNode* pNode, const char* pTag,
void* pVal, XML_DTYPE dataType ) const
bool XMLOp::getNodeAttribute(xmlNode* pNode, const char* pTag, void* pVal, XML_DTYPE dataType) const
{
char buf[XML_NODE_BUF_SIZE];
xmlChar* pTmp = NULL;
bool bFound = false;
char buf[XML_NODE_BUF_SIZE];
xmlChar* pTmp = NULL;
bool bFound = false;
pTmp = xmlGetProp( pNode, (xmlChar*) pTag );
pTmp = xmlGetProp(pNode, (xmlChar*)pTag);
if ( pTmp )
{
bFound = true;
strcpy( buf, (char*) pTmp );
xmlFree( pTmp );
if (pTmp)
{
bFound = true;
strcpy(buf, (char*)pTmp);
xmlFree(pTmp);
convertNodeValue( pVal, buf, dataType );
} // end if
convertNodeValue(pVal, buf, dataType);
} // end if
return bFound;
return bFound;
}
//------------------------------------------------------------------------------
@ -125,22 +114,21 @@ bool XMLOp::getNodeAttribute( xmlNode* pNode, const char* pTag,
// pVal (output) - return value buffer
// returns TRUE if found, FALSE otherwise
//------------------------------------------------------------------------------
bool XMLOp::getNodeAttributeStr( xmlNode* pNode, const char* pTag,
std::string& strVal ) const
bool XMLOp::getNodeAttributeStr(xmlNode* pNode, const char* pTag, std::string& strVal) const
{
xmlChar* pTmp = NULL;
bool bFound = false;
xmlChar* pTmp = NULL;
bool bFound = false;
pTmp = xmlGetProp( pNode, (xmlChar*) pTag );
pTmp = xmlGetProp(pNode, (xmlChar*)pTag);
if ( pTmp )
{
bFound = true;
strVal = (char*)pTmp;
xmlFree( pTmp );
} // end if
if (pTmp)
{
bFound = true;
strVal = (char*)pTmp;
xmlFree(pTmp);
} // end if
return bFound;
return bFound;
}
//------------------------------------------------------------------------------
@ -150,27 +138,26 @@ bool XMLOp::getNodeAttributeStr( xmlNode* pNode, const char* pTag,
// dataType - column data type
// returns TRUE if found, FALSE otherwise
//------------------------------------------------------------------------------
bool XMLOp::getNodeContent( const xmlNode* pNode, void* pVal,
XML_DTYPE dataType )
bool XMLOp::getNodeContent(const xmlNode* pNode, void* pVal, XML_DTYPE dataType)
{
char buf[XML_NODE_BUF_SIZE];
xmlChar* pTmp = NULL;
bool bFound = false;
char buf[XML_NODE_BUF_SIZE];
xmlChar* pTmp = NULL;
bool bFound = false;
if ( pNode->children != NULL )
if (pNode->children != NULL)
{
pTmp = xmlNodeGetContent(pNode->children);
if (pTmp)
{
pTmp = xmlNodeGetContent( pNode->children );
if ( pTmp )
{
bFound = true;
strcpy( buf, (char*) pTmp );
xmlFree( pTmp );
convertNodeValue( pVal, buf, dataType );
}
bFound = true;
strcpy(buf, (char*)pTmp);
xmlFree(pTmp);
convertNodeValue(pVal, buf, dataType);
}
}
return bFound;
return bFound;
}
//------------------------------------------------------------------------------
@ -179,24 +166,24 @@ bool XMLOp::getNodeContent( const xmlNode* pNode, void* pVal,
// strVal - return value
// returns TRUE if found, FALSE otherwise
//------------------------------------------------------------------------------
bool XMLOp::getNodeContentStr( const xmlNode* pNode, std::string& strVal)
bool XMLOp::getNodeContentStr(const xmlNode* pNode, std::string& strVal)
{
xmlChar* pTmp = NULL;
bool bFound = false;
xmlChar* pTmp = NULL;
bool bFound = false;
if ( pNode->children != NULL )
if (pNode->children != NULL)
{
pTmp = xmlNodeGetContent(pNode->children);
if (pTmp)
{
pTmp = xmlNodeGetContent( pNode->children );
if ( pTmp )
{
bFound = true;
strVal = (char*)pTmp;
xmlFree( pTmp );
}
bFound = true;
strVal = (char*)pTmp;
xmlFree(pTmp);
}
}
return bFound;
return bFound;
}
//------------------------------------------------------------------------------
@ -204,16 +191,16 @@ bool XMLOp::getNodeContentStr( const xmlNode* pNode, std::string& strVal)
// xmlFileName - xml file name
// returns NO_ERROR if success; other if failure
//------------------------------------------------------------------------------
int XMLOp::parseDoc( const char* xmlFileName )
int XMLOp::parseDoc(const char* xmlFileName)
{
int rc;
int rc;
rc = readDoc( xmlFileName );
rc = readDoc(xmlFileName);
if ( rc != NO_ERROR )
return rc;
if (rc != NO_ERROR)
return rc;
return processNode( m_pRoot ) ? NO_ERROR : ERR_XML_PARSE;
return processNode(m_pRoot) ? NO_ERROR : ERR_XML_PARSE;
}
//------------------------------------------------------------------------------
@ -221,23 +208,23 @@ int XMLOp::parseDoc( const char* xmlFileName )
// xmlFileName - xml file name
// returns NO_ERROR if success; other if failure
//------------------------------------------------------------------------------
int XMLOp::readDoc( const char* xmlFileName )
int XMLOp::readDoc(const char* xmlFileName)
{
// xmlNodePtr curPtr;
m_fDoc = xmlParseFile( xmlFileName );
// xmlNodePtr curPtr;
m_fDoc = xmlParseFile(xmlFileName);
if ( m_fDoc == NULL )
return ERR_XML_FILE;
if (m_fDoc == NULL)
return ERR_XML_FILE;
m_pRoot = xmlDocGetRootElement( m_fDoc );
m_pRoot = xmlDocGetRootElement(m_fDoc);
if ( m_pRoot == NULL )
{
closeDoc();
return ERR_XML_ROOT_ELEM;
}
if (m_pRoot == NULL)
{
closeDoc();
return ERR_XML_ROOT_ELEM;
}
return NO_ERROR;
return NO_ERROR;
}
//------------------------------------------------------------------------------
@ -245,16 +232,16 @@ int XMLOp::readDoc( const char* xmlFileName )
// pParentNode - parent node
// returns true if more nodes, else returns false.
//------------------------------------------------------------------------------
bool XMLOp::processNode( xmlNode* pParentNode )
bool XMLOp::processNode(xmlNode* pParentNode)
{
xmlNode* pCurNode = NULL;
bool bContinue = true;
xmlNode* pCurNode = NULL;
bool bContinue = true;
for ( pCurNode = pParentNode->children; pCurNode; pCurNode = pCurNode->next)
if ( pCurNode->type == XML_ELEMENT_NODE)
bContinue = processNode( pCurNode );
for (pCurNode = pParentNode->children; pCurNode; pCurNode = pCurNode->next)
if (pCurNode->type == XML_ELEMENT_NODE)
bContinue = processNode(pCurNode);
return bContinue;
return bContinue;
}
} //end of namespace
} // namespace WriteEngine