Convert a QP encoded cstr, back to it's original form.

Return TypeFunction nameArguments
hzEcodeQPDecode(hzString&,const char*,)

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

Function Logic:

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

Function body:

hzEcode QPDecode (hzString& Decoded)const char* pRaw, 
{
   //  Category: Codec
   //  
   //  Convert a QP encoded cstr, back to it's original form.
   //  
   //  Arguments: 1) Decoded The hzString reference that will contain the result. Any pre-existing contents of this are cleared at the outset.
   //     2) pRaw The encoded cstr.
   //  
   //  Returns: E_NODATA If the encoded cstr is empty
   //     E_FORMAT If there is an error in conversion
   //     E_OK  If the operation is successful
   _hzfunc("QPDecode") ;
   hzChain     R ;         //  Result
   const char* i ;         //  Iterator
   int32_t     val ;       //  Holds 24 bit value to be written as 3 bytes
   if (!pRaw || !pRaw[0])
       return E_NODATA ;
   //  Interate the input. On the occurence of '=', the next two bytes are hex for the actual char.
   i = pRaw ;
   for (; *i ;)
   {
       if (*i == ''='')
       {
           i++ ;
           if (*i == CHAR_CR || *i == CHAR_NL)
           {
               //  Just skip to next line
               if (*i == CHAR_CR)  i++ ;
               if (*i == CHAR_NL)  i++ ;
               continue ;
           }
           if (!IsHex(*i))
               return E_FORMAT ;
           val = _get1hex(*i) ;
           i++ ;
           if (!IsHex(*i))
               return E_FORMAT ;
           val *= 16;
           val += _get1hex(*i) ;
           R.AddByte(val) ;
           i++ ;
           continue ;
       }
       R.AddByte(*i) ;
       i++ ;
   }
   Decoded = R ;
   //  threadLog("decoded=[%s]\n", *Decoded) ;
   return E_OK ;
}