You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/10/18 23:52:21 UTC

cvs commit: xml-xerces/c/src/util XML256TableTranscoder.cpp

tng         01/10/18 14:52:21

  Modified:    c/src/util XML256TableTranscoder.cpp
  Log:
  The binary search in XML256TableTranscoder.cpp fails for the last item in whichever table it is searching.
  This affects transcoding from Unicode to Windows-1252, IBM037, and IBM1140.
  For example, the last item in IBM037's table (in XMLEBCDICTranscoder.cpp) is Unicode FF5E.
  So the "Unicode to IBM037" transcoding will fail for Unicode FF5E.
  Rather than rewrite the binary search algorithm, the XML256TableTranscoder is changed to check the last item in the table if the search fails.
  Patch from David McCreedy.
  
  Revision  Changes    Path
  1.3       +8 -0      xml-xerces/c/src/util/XML256TableTranscoder.cpp
  
  Index: XML256TableTranscoder.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/XML256TableTranscoder.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XML256TableTranscoder.cpp	2000/05/15 22:31:21	1.2
  +++ XML256TableTranscoder.cpp	2001/10/18 21:52:21	1.3
  @@ -252,5 +252,13 @@
               return fToTable[midOfs].extCh;
           }
       }   while (lowOfs + 1 < hiOfs);
  +
  +    // Check the high end of the range otherwise the
  +    // last item in the table may never be found.
  +        if (toXlat == fToTable[hiOfs].intCh)
  +        {
  +            return fToTable[hiOfs].extCh;
  +        }
  +
       return 0;
   }
  
  
  

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