dbertoni 2003/12/02 14:38:01
Modified: c/src/xalanc/Utils/MsgCreator ICUResHandler.cpp
ICUResHandler.hpp InMemHandler.cpp MsgCreator.cpp
MsgFileOutputStream.cpp MsgFileOutputStream.hpp
NLSHandler.cpp NLSHandler.hpp SAX2Handler.cpp
SAX2Handler.hpp
Log:
General cleanup.
Revision Changes Path
1.2 +7 -7 xml-xalan/c/src/xalanc/Utils/MsgCreator/ICUResHandler.cpp
Index: ICUResHandler.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/ICUResHandler.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ICUResHandler.cpp 2 Dec 2003 19:58:52 -0000 1.1
+++ ICUResHandler.cpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -168,7 +168,7 @@
}
else if(!XMLString::compareString(localname,targetXMLCh))
{
- if ( m_XML_lang != NULL )
+ if ( m_XML_lang != 0 )
{
m_startCollectingCharacters = true;
@@ -179,7 +179,7 @@
}
-void ICUResHandler::createHeaderForDataFile ( void )
+void ICUResHandler::createHeaderForDataFile ()
{
printToDataFile( szApacheLicense );
@@ -196,7 +196,7 @@
-void ICUResHandler::printBeginOfDataLine ( void )
+void ICUResHandler::printBeginOfDataLine ()
{
// if ( m_isTheFirstLineInArray ){
// m_isTheFirstLineInArray = false;
@@ -209,7 +209,7 @@
-void ICUResHandler::createBottomForDataFile ( void )
+void ICUResHandler::createBottomForDataFile ()
{
printToDataFile( szEndDataFile );
@@ -217,17 +217,17 @@
}
-void ICUResHandler::printEndOfDataLine ( void )
+void ICUResHandler::printEndOfDataLine ()
{
printToDataFile( szEndOfLineInDataFile );
}
void ICUResHandler::printToDataFile( const char* sArrayOfStrins[] )
{
- if ( sArrayOfStrins == NULL)
+ if ( sArrayOfStrins == 0)
return;
- for (int i = 0; sArrayOfStrins[i] != NULL; i++)
+ for (int i = 0; sArrayOfStrins[i] != 0; i++)
{
m_fStream.write(sArrayOfStrins[i],strlen(sArrayOfStrins[i]));
}
1.2 +4 -4 xml-xalan/c/src/xalanc/Utils/MsgCreator/ICUResHandler.hpp
Index: ICUResHandler.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/ICUResHandler.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ICUResHandler.hpp 2 Dec 2003 19:58:52 -0000 1.1
+++ ICUResHandler.hpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -92,11 +92,11 @@
, const unsigned int length);
protected:
- virtual void createHeaderForDataFile ( void );
- virtual void createBottomForDataFile ( void );
+ virtual void createHeaderForDataFile ();
+ virtual void createBottomForDataFile ();
- virtual void printBeginOfDataLine ( void );
- virtual void printEndOfDataLine ( void );
+ virtual void printBeginOfDataLine ();
+ virtual void printEndOfDataLine ();
void printToDataFile( const char* sArrayOfStrins[] );
1.2 +2 -2 xml-xalan/c/src/xalanc/Utils/MsgCreator/InMemHandler.cpp
Index: InMemHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/InMemHandler.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InMemHandler.cpp 2 Dec 2003 19:58:52 -0000 1.1
+++ InMemHandler.cpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -86,11 +86,11 @@
void InMemHandler::printToDataFile( const char* sArrayOfStrins[] )
{
- if ( sArrayOfStrins == NULL)
+ if ( sArrayOfStrins == 0)
return;
- for (int i = 0; sArrayOfStrins[i] != NULL; i++)
+ for (int i = 0; sArrayOfStrins[i] != 0; i++)
{
m_fStream.writeAsASCII(sArrayOfStrins[i],
strlen(sArrayOfStrins[i]));
1.2 +16 -15 xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgCreator.cpp
Index: MsgCreator.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgCreator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MsgCreator.cpp 2 Dec 2003 19:58:52 -0000 1.1
+++ MsgCreator.cpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -127,13 +127,13 @@
bool isLocalGiven;
CmdLineParams():
- inXMLFileName(NULL),
+ inXMLFileName(0),
enTypeOfLocalMsg(INMEM_LOCALMSG),
encodingName("LATIN1"),
localName(0),
isLocalGiven(false){}
- ~CmdLineParams() { if ( localName != NULL) delete[] localName; }
+ ~CmdLineParams() { delete[] localName; }
};
#if defined(OS390)
@@ -162,8 +162,9 @@
bool
getArgs(
int argc,
- const char* argv[],
- CmdLineParams& p, const char** pErrorMsg)
+ char* argv[],
+ CmdLineParams& p,
+ const char** pErrorMsg)
{
bool fSuccess = true;
char* errorMessage = 0;
@@ -254,7 +255,7 @@
return fSuccess;
}
-static const char* buildInputFileName(const CmdLineParams& p)
+static char* buildInputFileName(const CmdLineParams& p)
{
char* result = new char[85];
@@ -286,7 +287,7 @@
return result;
}
-static const char* buildOutputFileName(const CmdLineParams& p)
+static char* buildOutputFileName(const CmdLineParams& p)
{
char* pOutputFileName = new char[80];
pOutputFileName[0] = '\0';
@@ -345,7 +346,7 @@
//
---------------------------------------------------------------------------
// Program entry point
//
---------------------------------------------------------------------------
-int main(int argC, const char* argV[])
+int main(int argC, char* argV[])
{
#if !defined(NDEBUG) && defined(_MSC_VER)
@@ -405,13 +406,13 @@
// handler for the parser. Then parse the file
and catch any exceptions
// that propogate out
//
-
+
int errorCount = 0;
-
- const char* fileName =
buildInputFileName(theParams);
-
- const char* pOutputFileName =
buildOutputFileName(theParams);
-
+
+ char* const fileName =
buildInputFileName(theParams);
+
+ char* const pOutputFileName =
buildOutputFileName(theParams);
+
SAX2Handler* handler = 0;
try
{
@@ -513,9 +514,9 @@
delete handler;
- delete[] (const_cast <char*> (pOutputFileName));
+ delete[] pOutputFileName;
- delete[] (const_cast <char*> (fileName));
+ delete[] fileName;
//
// Delete the parser itself. Must be done
prior to calling Terminate, below.
//
1.2 +7 -16
xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.cpp
Index: MsgFileOutputStream.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MsgFileOutputStream.cpp 2 Dec 2003 19:58:52 -0000 1.1
+++ MsgFileOutputStream.cpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -181,7 +181,7 @@
-static const char*
+static char*
FormatMessageLocal(
const char* theMessage,
const char* theFileName,
@@ -227,10 +227,7 @@
XalanFileOutputStream::XalanFileOutputStreamOpenException::~XalanFileOutputStreamOpenException()
{
- if(m_pMessage)
- {
- delete const_cast<char*> (m_pMessage);
- }
+ delete [] m_pMessage;
}
@@ -249,17 +246,14 @@
XalanFileOutputStream::XalanFileOutputStreamWriteException::~XalanFileOutputStreamWriteException()
{
- if(m_pMessage)
- {
- delete const_cast<char*>(m_pMessage);
- }
+ delete [] m_pMessage;
}
void XalanFileOutputStream::write(const UTF16Ch* theString,
unsigned int theLength)
{
assert ( theString != 0 );
- writeData((const char*)theString,theLength * 2 );
+ writeData((const char*)theString,theLength * sizeof(UTF16Ch) );
}
void XalanFileOutputStream::write(const char* theString,
unsigned int theLength)
@@ -275,9 +269,9 @@
void XalanFileOutputStream::writeAsASCII(const UTF16Ch* theString,
unsigned int theLengts)
{
- const char* szString = XMLString::transcode(theString);
+ char* szString = XMLString::transcode(theString);
writeData( szString, theLengts );
- XMLString::release(const_cast<char**>(&szString));
+ XMLString::release(&szString);
}
@@ -292,10 +286,7 @@
UTF16Ch(0)
};
-void XalanFileOutputStream::writeUTFprefix( void )
+void XalanFileOutputStream::writeUTFprefix()
{
write(s_UTF16ByteOrderMark,1);
}
-
-
-
1.2 +6 -6
xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.hpp
Index: MsgFileOutputStream.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MsgFileOutputStream.hpp 2 Dec 2003 19:58:52 -0000 1.1
+++ MsgFileOutputStream.hpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -116,13 +116,13 @@
* @param theErrorCode number of error encountered
*/
XalanFileOutputStreamOpenException(
- const char* theFileName,
- int
theErrorCode);
+ const char* theFileName,
+ int theErrorCode);
virtual
~XalanFileOutputStreamOpenException();
- const char* m_pMessage;
+ char* m_pMessage;
};
class XalanFileOutputStreamWriteException
@@ -143,7 +143,7 @@
virtual
~XalanFileOutputStreamWriteException();
- const char* m_pMessage;
+ char* m_pMessage;
};
@@ -158,7 +158,7 @@
void
writeAsASCII(const UTF16Ch* theString, unsigned int
theLengts);
void
- writeUTFprefix( void );
+ writeUTFprefix();
protected:
void
@@ -184,7 +184,7 @@
// Data members...
const char* m_fileName;
- const HandleType m_handle;
+ const HandleType m_handle;
};
1.2 +4 -10 xml-xalan/c/src/xalanc/Utils/MsgCreator/NLSHandler.cpp
Index: NLSHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/NLSHandler.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NLSHandler.cpp 2 Dec 2003 19:58:52 -0000 1.1
+++ NLSHandler.cpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -107,7 +107,7 @@
}
}
-void NLSHandler::createHeaderForDataFile ( void )
+void NLSHandler::createHeaderForDataFile ()
{
if (m_bCreateUnicode )
{
@@ -133,7 +133,7 @@
}
}
-void NLSHandler::printBeginOfDataLine ( void )
+void NLSHandler::printBeginOfDataLine ()
{
char szNumb[20];
@@ -153,14 +153,14 @@
-void NLSHandler::createBottomForDataFile ( void )
+void NLSHandler::createBottomForDataFile ()
{
}
-void NLSHandler::printEndOfDataLine ( void )
+void NLSHandler::printEndOfDataLine ()
{
if ( m_bCreateUnicode )
{
@@ -171,9 +171,3 @@
m_fStream.writeAsASCII("^\n",2);
}
}
-
-
-
-
-
-
1.2 +5 -5 xml-xalan/c/src/xalanc/Utils/MsgCreator/NLSHandler.hpp
Index: NLSHandler.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/NLSHandler.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NLSHandler.hpp 2 Dec 2003 19:58:52 -0000 1.1
+++ NLSHandler.hpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -64,18 +64,18 @@
XERCES_CPP_NAMESPACE_USE
-class NLSHandler : public ICUResHandler
+class NLSHandler : public ICUResHandler
{
public:
NLSHandler(const char* fileName, bool bCreateUnicode = false);
~NLSHandler(void){}
- virtual void createHeaderForDataFile ( void );
- virtual void createBottomForDataFile ( void );
+ virtual void createHeaderForDataFile ();
+ virtual void createBottomForDataFile ();
- virtual void printBeginOfDataLine ( void );
- virtual void printEndOfDataLine ( void );
+ virtual void printBeginOfDataLine ();
+ virtual void printEndOfDataLine ();
void characters( const XMLCh* const chars
, const unsigned int length);
1.2 +14 -16 xml-xalan/c/src/xalanc/Utils/MsgCreator/SAX2Handler.cpp
Index: SAX2Handler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/SAX2Handler.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SAX2Handler.cpp 2 Dec 2003 19:58:52 -0000 1.1
+++ SAX2Handler.cpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -83,7 +83,7 @@
SAX2Handler::SAX2Handler( ) :
m_fIndexFormatter(INDEX_FILE_NAME),
m_numberOfRecords(0),
- m_XML_lang(NULL),
+ m_XML_lang(0),
m_startCollectingCharacters(false)
{
@@ -91,20 +91,18 @@
SAX2Handler::~SAX2Handler()
{
- if (m_XML_lang != NULL)
+ if (m_XML_lang != 0)
{
XMLString::release(&m_XML_lang);
-
- m_XML_lang = NULL;
}
}
-bool SAX2Handler::translateCharToXMLByteArr ( XMLByte* const buffer, int
iBufLen, const char* const szSource)const
+bool SAX2Handler::translateCharToXMLByteArr ( XMLByte* buffer, int iBufLen,
const char* szSource)const
{
bool bResult = false;
- if ( iBufLen == 0 || szSource == NULL || buffer == NULL )
+ if ( iBufLen == 0 || szSource == 0 || buffer == 0 )
{
return bResult;
}
@@ -130,27 +128,27 @@
-void SAX2Handler::createHeaderForIndexFile ( void )
+void SAX2Handler::createHeaderForIndexFile ()
{
printToIndexFile( szApacheLicense );
printToIndexFile ( szStartIndexFile );
}
-void SAX2Handler::printBeginOfIndexLine ( void )
+void SAX2Handler::printBeginOfIndexLine ()
{
printToIndexFile ( szBeginIndexLine );
}
-void SAX2Handler::printEndOfIndexLine ( void )
+void SAX2Handler::printEndOfIndexLine ()
{
// printToIndexFile ( szEndIndexLine );
}
-void SAX2Handler::createBottomForIndexFile ( void )
+void SAX2Handler::createBottomForIndexFile ()
{
printToIndexFile ( szEndIndexFile );
}
@@ -270,16 +268,16 @@
void SAX2Handler::setXML_Lang( const char* localName)
{
- assert(localName != NULL);
+ assert(localName != 0);
- m_XML_lang = XMLString::transcode(localName);
+ if (m_XML_lang != 0)
+ {
+ XMLString::release(&m_XML_lang);
+ }
+ m_XML_lang = XMLString::transcode(localName);
}
-const XMLCh* const SAX2Handler::getXML_lang (void) const
-{
- return m_XML_lang;
-}
void SAX2Handler::startDocument()
{
1.2 +17 -13 xml-xalan/c/src/xalanc/Utils/MsgCreator/SAX2Handler.hpp
Index: SAX2Handler.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/SAX2Handler.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SAX2Handler.hpp 2 Dec 2003 19:58:52 -0000 1.1
+++ SAX2Handler.hpp 2 Dec 2003 22:38:00 -0000 1.2
@@ -159,9 +159,9 @@
const
XMLCh* const qname,
const Attributes&
attributes);
- void startDocument( void );
+ void startDocument();
- void endDocument( void );
+ void endDocument();
// -----------------------------------------------------------------------
// Implementations of the SAX ErrorHandler interface
@@ -179,31 +179,35 @@
void setXML_Lang( const char* localName);
- const XMLCh* const getXML_lang (void) const;
+ const XMLCh*
+ getXML_lang () const
+ {
+ return m_XML_lang;
+ }
protected:
- bool translateCharToXMLByteArr ( XMLByte* const buffer, int iBufLen,
const char* const szSource)const;
+ bool translateCharToXMLByteArr ( XMLByte* buffer, int iBufLen, const
char* szSource)const;
- virtual void createHeaderForDataFile ( void )=0;
- virtual void createBottomForDataFile ( void )=0;
+ virtual void createHeaderForDataFile ()=0;
+ virtual void createBottomForDataFile ()=0;
- virtual void printBeginOfDataLine ( void )=0;
- virtual void printEndOfDataLine ( void )=0;
+ virtual void printBeginOfDataLine ()=0;
+ virtual void printEndOfDataLine ()=0;
virtual void printToDataFile( const char* sArrayOfStrins[] ) = 0;
void printToIndexFile( const char* sArrayOfStrins[] );
- void printNumbOfRecords (void );
+ void printNumbOfRecords ();
private:
- void createHeaderForIndexFile ( void );
- void createBottomForIndexFile ( void );
+ void createHeaderForIndexFile ();
+ void createBottomForIndexFile ();
- void printBeginOfIndexLine ( void );
- void printEndOfIndexLine ( void );
+ void printBeginOfIndexLine ();
+ void printEndOfIndexLine ();
protected :
int m_numberOfRecords;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]