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 2003/01/06 22:47:48 UTC

cvs commit: xml-xerces/c/src/xercesc/util/Transcoders/Iconv400 Iconv400TransService.cpp Iconv400TransService.hpp

tng         2003/01/06 13:47:48

  Modified:    c/src/xercesc/util/Transcoders/Iconv400
                        Iconv400TransService.cpp Iconv400TransService.hpp
  Log:
  Remove obsolete old functions transcodeXML and transcodeOne
  
  Revision  Changes    Path
  1.7       +1 -119    xml-xerces/c/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp
  
  Index: Iconv400TransService.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Iconv400TransService.cpp	4 Nov 2002 15:14:33 -0000	1.6
  +++ Iconv400TransService.cpp	6 Jan 2003 21:47:48 -0000	1.7
  @@ -365,124 +365,6 @@
   }
   
   
  -
  -XMLCh Iconv400Transcoder::transcodeOne(  const   XMLByte* const  srcData
  -                                    , const unsigned int    srcBytes
  -                                    ,       unsigned int&   bytesEaten)
  -{
  -    // Check for stupid stuff
  -    if (!srcBytes)
  -        return 0;
  -
  -    UErrorCode err = U_ZERO_ERROR;
  -    const XMLByte* startSrc = srcData;
  -    const XMLCh chRet = ucnv_getNextUChar
  -    (
  -        fConverter
  -        , (const char**)&startSrc
  -        , (const char*)((srcData + srcBytes) - 1)
  -        , &err
  -    );
  -
  -    // Bail out if an error
  -    if (U_FAILURE(err))
  -        return 0;
  -
  -    // Calculate the bytes eaten and return the char
  -    bytesEaten = startSrc - srcData;
  -    return chRet;
  -}
  -
  -
  -unsigned int
  -Iconv400Transcoder::transcodeXML(const   XMLByte* const          srcData
  -                            , const unsigned int            srcCount
  -                            ,       XMLCh* const            toFill
  -                            , const unsigned int            maxChars
  -                            ,       unsigned int&           bytesEaten
  -                            ,       unsigned char* const    charSizes)
  -{
  -    // If debugging, insure the block size is legal
  -    #if defined(XERCES_DEBUG)
  -    checkBlockSize(maxChars);
  -    #endif
  -
  -    // Set up pointers to the source and destination buffers.
  -    UChar*          startTarget = toFill;
  -    const XMLByte*  startSrc = srcData;
  -    const XMLByte*  endSrc = srcData + srcCount;
  -
  -    //
  -    //  Transoode the buffer.  Buffer overflow errors are normal, occuring
  -    //  when the raw input buffer holds more characters than will fit in
  -    //  the Unicode output buffer.
  -    //
  -    UErrorCode  err = U_ZERO_ERROR;
  -    ucnv_toUnicode
  -    (
  -        fConverter
  -        , &startTarget
  -        , toFill + maxChars
  -        , (const char**)&startSrc
  -        , (const char*)endSrc
  -        , (fFixed ? 0 : fSrcOffsets)
  -        , false
  -        , &err
  -    );
  -
  -    if ((err != U_ZERO_ERROR) && (err != U_BUFFER_OVERFLOW_ERROR))
  -        ThrowXML(TranscodingException, XMLExcepts::Trans_Unrepresentable);
  -
  -    // Calculate the bytes eaten and store in caller's param
  -    bytesEaten = startSrc - srcData;
  -
  -    // And the characters decoded
  -    const unsigned int charsDecoded = startTarget - toFill;
  -
  -    //
  -    //  Translate the array of char offsets into an array of character
  -    //  sizes, which is what the transcoder interface semantics requires.
  -    //  If its fixed, then we can optimize it.
  -    //
  -    if (fFixed)
  -    {
  -        const unsigned char fillSize = (unsigned char)ucnv_getMaxCharSize(fConverter);;
  -        memset(charSizes, fillSize, maxChars);
  -    }
  -     else
  -    {
  -        //
  -        //  We have to convert the series of offsets into a series of
  -        //  sizes. If just one char was decoded, then its the total bytes
  -        //  eaten. Otherwise, do a loop and subtract out each element from
  -        //  its previous element.
  -        //
  -        if (charsDecoded == 1)
  -        {
  -            charSizes[0] = (unsigned char)bytesEaten;
  -        }
  -         else
  -        {
  -            //  ICU does not return an extra element to allow us to figure
  -            //  out the last char size, so we have to compute it from the
  -            //  total bytes used.
  -            unsigned int index;
  -            for (index = 0; index < charsDecoded - 1; index++)
  -            {
  -                charSizes[index] = (unsigned char)(fSrcOffsets[index + 1]
  -                                                    - fSrcOffsets[index]);
  -            }
  -            if( charsDecoded > 0 ) {
  -                charSizes[charsDecoded - 1] = (unsigned char)(bytesEaten
  -                                              - fSrcOffsets[charsDecoded - 1]);
  -            }
  -        }
  -    }
  -
  -    // Return the chars we put into the target buffer
  -    return charsDecoded;
  -}
  -
   // ---------------------------------------------------------------------------
   //  Iconv400Transcoder: The virtual transcoder API
   // ---------------------------------------------------------------------------
  
  
  
  1.5       +11 -29    xml-xerces/c/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp
  
  Index: Iconv400TransService.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Iconv400TransService.hpp	4 Nov 2002 15:14:33 -0000	1.4
  +++ Iconv400TransService.hpp	6 Jan 2003 21:47:48 -0000	1.5
  @@ -156,6 +156,9 @@
       );
       ~Iconv400Transcoder();
   
  +    // -----------------------------------------------------------------------
  +    //  Implementation of the virtual transcoder interface
  +    // -----------------------------------------------------------------------
       virtual unsigned int transcodeFrom
       (
           const   XMLByte* const          srcData
  @@ -168,39 +171,18 @@
   
       virtual unsigned int transcodeTo
       (
  -        const   XMLCh* const    srcData
  -        , const unsigned int    srcCount
  -        ,       XMLByte* const  toFill
  -        , const unsigned int    maxBytes
  -        ,       unsigned int&   charsEaten
  -        , const UnRepOpts       options
  +        const   XMLCh* const	srcData
  +        , const unsigned int	srcCount
  +        ,       XMLByte* const	toFill
  +        , const unsigned int	maxBytes
  +        ,       unsigned int&	charsEaten
  +        , const UnRepOpts	options
       );
   
       virtual bool canTranscodeTo
       (
  -        const   unsigned int    toCheck
  +        const   unsigned int	toCheck
       )   const;
  -
  -    // -----------------------------------------------------------------------
  -    //  Implementation of the virtual transcoder interface
  -    // -----------------------------------------------------------------------
  -
  -    virtual XMLCh transcodeOne
  -    (
  -        const   XMLByte* const  srcData
  -        , const unsigned int    srcBytes
  -        ,       unsigned int&   bytesEaten
  -    );
  -
  -    virtual unsigned int transcodeXML
  -    (
  -        const   XMLByte* const          srcData
  -        , const unsigned int            srcCount
  -        ,       XMLCh* const            toFill
  -        , const unsigned int            maxChars
  -        ,       unsigned int&           bytesEaten
  -        ,       unsigned char* const    charSizes
  -    );
   
   
   
  
  
  

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