From d0c30461fdcb02400a4384b6e7042c90ae5897c0 Mon Sep 17 00:00:00 2001 From: "Unknown (jpolast)" <dev-null@apache.org> Date: Fri, 7 Jul 2000 22:16:56 +0000 Subject: [PATCH] remove old put(value) function. use put(key,value) instead. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@172246 13f79535-47bb-0310-9956-ffa450edef68 --- src/util/RefHashTableOf.c | 9 ++-- src/util/RefHashTableOf.hpp | 4 +- src/util/StringPool.cpp | 9 ++-- src/util/StringPool.hpp | 6 ++- src/util/TransService.cpp | 46 +++++++++++-------- .../Transcoders/Win32/Win32TransService.cpp | 19 +++----- 6 files changed, 48 insertions(+), 45 deletions(-) diff --git a/src/util/RefHashTableOf.c b/src/util/RefHashTableOf.c index 82d0f95fd..fa8e506fd 100644 --- a/src/util/RefHashTableOf.c +++ b/src/util/RefHashTableOf.c @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.6 2000/07/07 22:16:50 jpolast + * remove old put(value) function. use put(key,value) instead. + * * Revision 1.5 2000/06/29 18:27:09 jpolast * bug fix for passing hasher class references to constructor * @@ -249,12 +252,6 @@ template <class TVal> void RefHashTableOf<TVal>::put(void* key, TVal* const valu } } -// this function is deprecated in favor of put(key,value). use at your own risk. -template <class TVal> void RefHashTableOf<TVal>::put(TVal* const valueToAdopt) -{ - put((void*)(valueToAdopt->getKey()), valueToAdopt); -} - // --------------------------------------------------------------------------- diff --git a/src/util/RefHashTableOf.hpp b/src/util/RefHashTableOf.hpp index 973de10f6..4c57142a9 100644 --- a/src/util/RefHashTableOf.hpp +++ b/src/util/RefHashTableOf.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2000/07/07 22:16:51 jpolast + * remove old put(value) function. use put(key,value) instead. + * * Revision 1.7 2000/06/29 18:27:09 jpolast * bug fix for passing hasher class references to constructor * @@ -170,7 +173,6 @@ public: // Putters // ----------------------------------------------------------------------- void put(void* key, TVal* const valueToAdopt); - void put(TVal* const valueToAdopt); // deprecated. use at your own risk. instead use put(key, value) private : diff --git a/src/util/StringPool.cpp b/src/util/StringPool.cpp index 413c56155..e99a769a5 100644 --- a/src/util/StringPool.cpp +++ b/src/util/StringPool.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2000/07/07 22:16:51 jpolast + * remove old put(value) function. use put(key,value) instead. + * * Revision 1.4 2000/05/15 22:31:20 andyh * Replace #include<memory.h> with <string.h> everywhere. * @@ -105,10 +108,6 @@ XMLStringPool::PoolElem::~PoolElem() // --------------------------------------------------------------------------- // StringPool::PoolElem: Public methods // --------------------------------------------------------------------------- -const XMLCh* XMLStringPool::PoolElem::getKey() const -{ - return fString; -} void XMLStringPool::PoolElem::reset(const XMLCh* const string, const unsigned int id) @@ -222,7 +221,7 @@ unsigned int XMLStringPool::addNewEntry(const XMLCh* const newString) // id index. // PoolElem* newElem = new PoolElem(newString, fCurId); - fHashTable->put(newElem); + fHashTable->put((void*)(newElem->getKey()), newElem); fIdMap[fCurId] = newElem; // Bump the current id and return the id of the new elem we just added diff --git a/src/util/StringPool.hpp b/src/util/StringPool.hpp index 4737842a8..eaca86020 100644 --- a/src/util/StringPool.hpp +++ b/src/util/StringPool.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.4 2000/07/07 22:16:52 jpolast + * remove old put(value) function. use put(key,value) instead. + * * Revision 1.3 2000/02/24 20:05:25 abagchi * Swat for removing Log from API docs * @@ -121,11 +124,12 @@ private : PoolElem(const XMLCh* const string, const unsigned int id); ~PoolElem(); - const XMLCh* getKey() const; + inline const XMLCh* getKey() const { return fString; } void reset(const XMLCh* const string, const unsigned int id); unsigned int fId; XMLCh* fString; + }; diff --git a/src/util/TransService.cpp b/src/util/TransService.cpp index 1daf4f943..f395b4037 100644 --- a/src/util/TransService.cpp +++ b/src/util/TransService.cpp @@ -276,33 +276,33 @@ void XMLTransService::initTransService() // Add in the magical mapping for the native XMLCh transcoder. This // is used for internal entities. // - gMappings->put(new ENameMapFor<XMLChTranscoder>(XMLUni::fgXMLChEncodingString)); + gMappings->put((void*)XMLUni::fgXMLChEncodingString, new ENameMapFor<XMLChTranscoder>(XMLUni::fgXMLChEncodingString)); // // Add in our mappings for ASCII. // - gMappings->put(new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString)); - gMappings->put(new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString2)); - gMappings->put(new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString3)); - gMappings->put(new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString4)); + gMappings->put((void*)XMLUni::fgUSASCIIEncodingString, new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString)); + gMappings->put((void*)XMLUni::fgUSASCIIEncodingString2, new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString2)); + gMappings->put((void*)XMLUni::fgUSASCIIEncodingString3, new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString3)); + gMappings->put((void*)XMLUni::fgUSASCIIEncodingString4, new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString4)); // // Add in our mappings for UTF-8 // - gMappings->put(new ENameMapFor<XMLUTF8Transcoder>(XMLUni::fgUTF8EncodingString)); - gMappings->put(new ENameMapFor<XMLUTF8Transcoder>(XMLUni::fgUTF8EncodingString2)); + gMappings->put((void*)XMLUni::fgUTF8EncodingString, new ENameMapFor<XMLUTF8Transcoder>(XMLUni::fgUTF8EncodingString)); + gMappings->put((void*)XMLUni::fgUTF8EncodingString2, new ENameMapFor<XMLUTF8Transcoder>(XMLUni::fgUTF8EncodingString2)); // // Add in our mappings for Latin1 // - gMappings->put(new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString)); - gMappings->put(new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString2)); - gMappings->put(new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString3)); - gMappings->put(new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString4)); - gMappings->put(new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString5)); - gMappings->put(new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString6)); - gMappings->put(new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString7)); - gMappings->put(new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString8)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString, new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString2, new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString2)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString3, new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString3)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString4, new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString4)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString5, new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString5)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString6, new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString6)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString7, new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString7)); + gMappings->put((void*)XMLUni::fgISO88591EncodingString8, new ENameMapFor<XML88591Transcoder>(XMLUni::fgISO88591EncodingString8)); // // Add in our mappings for UTF-16 and UCS-4, little endian @@ -314,6 +314,7 @@ void XMLTransService::initTransService() #endif gMappings->put ( + (void*)XMLUni::fgUTF16LEncodingString, new EEndianNameMapFor<XMLUTF16Transcoder> ( XMLUni::fgUTF16LEncodingString @@ -323,6 +324,7 @@ void XMLTransService::initTransService() gMappings->put ( + (void*)XMLUni::fgUTF16LEncodingString2, new EEndianNameMapFor<XMLUTF16Transcoder> ( XMLUni::fgUTF16LEncodingString2 @@ -332,6 +334,7 @@ void XMLTransService::initTransService() gMappings->put ( + (void*)XMLUni::fgUCS4LEncodingString, new EEndianNameMapFor<XMLUCS4Transcoder> ( XMLUni::fgUCS4LEncodingString @@ -341,6 +344,7 @@ void XMLTransService::initTransService() gMappings->put ( + (void*)XMLUni::fgUCS4LEncodingString2, new EEndianNameMapFor<XMLUCS4Transcoder> ( XMLUni::fgUCS4LEncodingString2 @@ -357,6 +361,7 @@ void XMLTransService::initTransService() #endif gMappings->put ( + (void*)XMLUni::fgUTF16BEncodingString, new EEndianNameMapFor<XMLUTF16Transcoder> ( XMLUni::fgUTF16BEncodingString @@ -366,6 +371,7 @@ void XMLTransService::initTransService() gMappings->put ( + (void*)XMLUni::fgUTF16BEncodingString2, new EEndianNameMapFor<XMLUTF16Transcoder> ( XMLUni::fgUTF16BEncodingString2 @@ -375,6 +381,7 @@ void XMLTransService::initTransService() gMappings->put ( + (void*)XMLUni::fgUCS4BEncodingString, new EEndianNameMapFor<XMLUCS4Transcoder> ( XMLUni::fgUCS4BEncodingString @@ -384,6 +391,7 @@ void XMLTransService::initTransService() gMappings->put ( + (void*)XMLUni::fgUCS4BEncodingString2, new EEndianNameMapFor<XMLUCS4Transcoder> ( XMLUni::fgUCS4BEncodingString2 @@ -395,18 +403,18 @@ void XMLTransService::initTransService() // Add in our mappings for IBM037, and the one alias we support for // it, which is EBCDIC-CP-US. // - gMappings->put(new ENameMapFor<XMLEBCDICTranscoder>(XMLUni::fgIBM037EncodingString)); - gMappings->put(new ENameMapFor<XMLEBCDICTranscoder>(XMLUni::fgIBM037EncodingString2)); + gMappings->put((void*)XMLUni::fgIBM037EncodingString, new ENameMapFor<XMLEBCDICTranscoder>(XMLUni::fgIBM037EncodingString)); + gMappings->put((void*)XMLUni::fgIBM037EncodingString2, new ENameMapFor<XMLEBCDICTranscoder>(XMLUni::fgIBM037EncodingString2)); // // Add in our mappings for IBM037 with Euro update, i.e. IBM1140. It // has no aliases // - gMappings->put(new ENameMapFor<XMLIBM1140Transcoder>(XMLUni::fgIBM1140EncodingString)); + gMappings->put((void*)XMLUni::fgIBM1140EncodingString, new ENameMapFor<XMLIBM1140Transcoder>(XMLUni::fgIBM1140EncodingString)); // // Add in our mappings for Windows-1252. We don't have any aliases for // this one, so there is just one mapping. // - gMappings->put(new ENameMapFor<XMLWin1252Transcoder>(XMLUni::fgWin1252EncodingString)); + gMappings->put((void*)XMLUni::fgWin1252EncodingString, new ENameMapFor<XMLWin1252Transcoder>(XMLUni::fgWin1252EncodingString)); } diff --git a/src/util/Transcoders/Win32/Win32TransService.cpp b/src/util/Transcoders/Win32/Win32TransService.cpp index fecc3da41..92f06cbfb 100644 --- a/src/util/Transcoders/Win32/Win32TransService.cpp +++ b/src/util/Transcoders/Win32/Win32TransService.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.14 2000/07/07 22:16:56 jpolast + * remove old put(value) function. use put(key,value) instead. + * * Revision 1.13 2000/05/09 00:22:44 andyh * Memory Cleanup. XMLPlatformUtils::Terminate() deletes all lazily * allocated memory; memory leak checking tools will no longer report @@ -261,11 +264,6 @@ const XMLCh* CPMapEntry::getEncodingName() const return fEncodingName; } -const XMLCh* CPMapEntry::getKey() const -{ - return fEncodingName; -} - unsigned int CPMapEntry::getWinCP() const { return fCPId; @@ -402,7 +400,7 @@ Win32TransService::Win32TransService() } CPMapEntry* newEntry = new CPMapEntry(nameBuf, CPId, IEId); - fCPMap->put(newEntry); + fCPMap->put(nameBuf, newEntry); } } @@ -472,13 +470,8 @@ Win32TransService::Win32TransService() // if (::wcscmp(uniAlias, aliasedEntry->getEncodingName())) { - CPMapEntry* newEntry = new CPMapEntry - ( - uniAlias - , aliasedEntry->getWinCP() - , aliasedEntry->getIEEncoding() - ); - fCPMap->put(newEntry); + CPMapEntry* newEntry = new CPMapEntry(uniAlias, aliasedEntry->getWinCP(), aliasedEntry->getIEEncoding()); + fCPMap->put(uniAlias, newEntry); } } delete [] uniAlias; -- GitLab