Convert a hzChain whose content is presumed to encoded using the Quoted-Printable method, back to it's original form.

Return TypeFunction nameArguments
hzEcodeQPDecode(hzChain&,hzChain&,)

Declared in file: hzCodec.h
Defined in file : hzCodec.cpp

Function Logic:

0:START 1:items 2:unknown 3:Return E_NODATA 4:zi 5:unknown 6:unknown 7:items 8:unknown 9:unknown 10:items 11:unknown 12:items 13:unknown 14:Return E_FORMAT 15:val items 16:unknown 17:Return E_FORMAT 18:val val items items 19:items items 20:Return E_OK

Function body:

hzEcode QPDecode (hzChain& Decoded)hzChain& Raw, 
{
   //  Category: Codec
   //  
   //  Convert a hzChain whose content is presumed to encoded using the Quoted-Printable method, back to it's original form.
   //  
   //  Arguments: 1) Decoded The hzChain reference that will contain the result. Any pre-existing contents of this are cleared at the outset.
   //     2) Raw  The encoded hzChain. This is not altered by this operation.
   //  
   //  Returns: E_NODATA If the encoded chain is empty
   //     E_FORMAT If there is an error in conversion
   //     E_OK  If the operation is successful
   _hzfunc("QPDecode") ;
   chIter  zi ;        //  Iterator
   int32_t val ;       //  Holds 24 bit value to be written as 3 bytes
   Decoded.Clear() ;
   if (!Raw.Size())
       return E_NODATA ;
   //  Interate the input. On the occurence of '=', the next two bytes are hex for the actual char.
   zi = Raw ;
   for (; !zi.eof() ;)
   {
       if (*zi == CHAR_EQUAL)
       {
           zi++ ;
           if (*zi == CHAR_CR || *zi == CHAR_NL)
           {
               //  Just skip to next line
               if (*zi == CHAR_CR) zi++ ;
               if (*zi == CHAR_NL) zi++ ;
               continue ;
           }
           if (zi.eof() || !IsHex(*zi))
               return E_FORMAT ;
           val = _get1hex(*zi) ;
           zi++ ;
           if (zi.eof() || !IsHex(*zi))
               return E_FORMAT ;
           val *= 16;
           val += _get1hex(*zi) ;
           Decoded.AddByte(val) ;
           zi++ ;
           continue ;
       }
       Decoded.AddByte(*zi) ;
       zi++ ;
   }
   return E_OK ;
}