You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2007/04/17 10:42:09 UTC

svn commit: r529526 - in /xerces/c/trunk/src/xercesc/util/Transcoders/Win32: Win32TransService.cpp Win32TransService.hpp

Author: amassari
Date: Tue Apr 17 01:42:08 2007
New Revision: 529526

URL: http://svn.apache.org/viewvc?view=rev&rev=529526
Log:
In the Windows registry, the code page for an encoding is stored in MIME\Database\Charset\<encoding>\@InternetEncoding, not in MIME\Database\Charset\<encoding>\@Codepage (XERCESC-1092)

Modified:
    xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
    xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp?view=diff&rev=529526&r1=529525&r2=529526
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp Tue Apr 17 01:42:08 2007
@@ -146,14 +146,12 @@
     CPMapEntry
     (
         const   XMLCh* const    encodingName
-        , const unsigned int    cpId
         , const unsigned int    ieId
     );
 
     CPMapEntry
     (
         const   char* const     encodingName
-        , const unsigned int    cpId
         , const unsigned int    ieId
     );
 
@@ -165,7 +163,6 @@
     // -----------------------------------------------------------------------
     const XMLCh* getEncodingName() const;
     const XMLCh* getKey() const;
-    unsigned int getWinCP() const;
     unsigned int getIEEncoding() const;
 
 
@@ -185,16 +182,10 @@
     //      This is the encoding name for the code page that this instance
     //      represents.
     //
-    //  fCPId
-    //      This is the Windows specific code page for the encoding that this
-    //      instance represents.
-    //
     //  fIEId
-    //      This is the IE encoding id. Its not used at this time, but we
-    //      go ahead and get it and store it just in case for later.
+    //      This is the code page id.
     // -----------------------------------------------------------------------
     XMLCh*          fEncodingName;
-    unsigned int    fCPId;
     unsigned int    fIEId;
 };
 
@@ -202,10 +193,8 @@
 //  CPMapEntry: Constructors and Destructor
 // ---------------------------------------------------------------------------
 CPMapEntry::CPMapEntry( const   char* const     encodingName
-                        , const unsigned int    cpId
                         , const unsigned int    ieId) :
     fEncodingName(0)
-    , fCPId(cpId)
     , fIEId(ieId)
 {
     // Transcode the name to Unicode and store that copy
@@ -231,11 +220,9 @@
 }
 
 CPMapEntry::CPMapEntry( const   XMLCh* const    encodingName
-                        , const unsigned int    cpId
                         , const unsigned int    ieId) :
 
     fEncodingName(0)
-    , fCPId(cpId)
     , fIEId(ieId)
 {
     fEncodingName = XMLString::replicate(encodingName, XMLPlatformUtils::fgMemoryManager);
@@ -261,11 +248,6 @@
     return fEncodingName;
 }
 
-unsigned int CPMapEntry::getWinCP() const
-{
-    return fCPId;
-}
-
 unsigned int CPMapEntry::getIEEncoding() const
 {
     return fIEId;
@@ -273,9 +255,6 @@
 
 
 
-
-
-
 //---------------------------------------------------------------------------
 //
 //  class Win32TransService Implementation ...
@@ -360,6 +339,9 @@
             //  interested in. There should be a code page entry and an
             //  IE entry.
             //
+            //  The Codepage entry is the default code page for a computer using that charset
+            //  while the InternetEncoding holds the code page that represents that charset
+            //
             unsigned long theType;
             unsigned int CPId;
             unsigned int IEId;
@@ -398,7 +380,7 @@
                     continue;
                 }
 
-                CPMapEntry* newEntry = new CPMapEntry(nameBuf, CPId, IEId);
+                CPMapEntry* newEntry = new CPMapEntry(nameBuf, IEId);
                 fCPMap->put((void*)newEntry->getEncodingName(), newEntry);
             }
         }
@@ -486,7 +468,7 @@
                     //
                     if (::wcscmp(uniName, aliasedEntry->getEncodingName()))
                     {
-                        CPMapEntry* newEntry = new CPMapEntry(uniName, aliasedEntry->getWinCP(), aliasedEntry->getIEEncoding());
+                        CPMapEntry* newEntry = new CPMapEntry(uniName, aliasedEntry->getIEEncoding());
                         fCPMap->put((void*)newEntry->getEncodingName(), newEntry);
                     }
 
@@ -611,7 +593,6 @@
     return new (manager) Win32Transcoder
     (
         encodingName
-        , theEntry->getWinCP()
         , theEntry->getIEEncoding()
         , blockSize
         , manager
@@ -636,14 +617,12 @@
 //  Win32Transcoder: Constructors and Destructor
 // ---------------------------------------------------------------------------
 Win32Transcoder::Win32Transcoder(const  XMLCh* const    encodingName
-                                , const unsigned int    winCP
                                 , const unsigned int    ieCP
                                 , const unsigned int    blockSize
                                 , MemoryManager* const manager) :
 
     XMLTranscoder(encodingName, blockSize, manager)
     , fIECP(ieCP)
-    , fWinCP(winCP)
 {
 }
 
@@ -683,7 +662,7 @@
         //  If we are looking at a leading byte of a multibyte sequence,
         //  then we are going to eat 2 bytes, else 1.
         //
-        unsigned char toEat = ::IsDBCSLeadByteEx(fWinCP, *inPtr) ?
+        unsigned char toEat = ::IsDBCSLeadByteEx(fIECP, *inPtr) ?
                                     2 : 1;
 
         // Make sure a whol char is in the source
@@ -693,7 +672,7 @@
         // Try to translate this next char and check for an error
         const unsigned int converted = ::MultiByteToWideChar
         (
-            fWinCP
+            fIECP
             , MB_PRECOMPOSED | MB_ERR_INVALID_CHARS
             , (const char*)inPtr
             , toEat
@@ -767,7 +746,7 @@
         //  Do one char and see if it made it.
         const unsigned int bytesStored = ::WideCharToMultiByte
         (
-            fWinCP
+            fIECP
             , WC_COMPOSITECHECK | WC_SEPCHARS
             , srcPtr
             , 1
@@ -840,7 +819,7 @@
     BOOL usedDef;
     const unsigned int bytesStored = ::WideCharToMultiByte
     (
-        fWinCP
+        fIECP
         , WC_COMPOSITECHECK | WC_SEPCHARS
         , srcBuf
         , srcCount

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp?view=diff&rev=529526&r1=529525&r2=529526
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp Tue Apr 17 01:42:08 2007
@@ -132,7 +132,6 @@
     Win32Transcoder
     (
         const   XMLCh* const    encodingName
-        , const unsigned int    winCP
         , const unsigned int    ieCP
         , const unsigned int    blockSize
         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager);
@@ -180,13 +179,10 @@
     //  Private data members
     //
     //  fIECP
-    //      This is the internet explorer code page for this encoding.
+    //      This is the code page for this encoding.
     //
-    //  fWinCP
-    //      This is the windows code page for this encoding.
     // -----------------------------------------------------------------------
     unsigned int    fIECP;
-    unsigned int    fWinCP;
 };
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org