Программирование - вопрос/ответ



         

Программирование - часть 23


  'A','B','C','D','E','F','G','H','I','J','K','L','M',
  'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
  'a','b','c','d','e','f','g','h','i','j','k','l','m',
  'n','o','p','q','r','s','t','u','v','w','x','y','z',
  '0','1','2','3','4','5','6','7','8','9','+','/'
};


BOOL
uudecode(
     char * bufcoded,
     BUFFER * pbuffdecoded,
     DWORD * pcbDecoded )
/*++

  Routine Description:

     uudecode a string of data

  Arguments:

     bufcoded pointer to uuencoded data
     pbuffdecoded pointer to output BUFFER structure
     pcbDecoded number of decode bytes

  Return Value:

  Returns TRUE is successful; otherwise FALSE is returned.

--*/
{
     int nbytesdecoded;
     char *bufin = bufcoded;
     unsigned char *bufout;
     int nprbytes;

     /* Strip leading whitespace. */

  while(*bufcoded==' ' || *bufcoded == '\t') bufcoded++;

  /* Figure out how many characters are in the input buffer.
  * If this would decode into more bytes than would fit into
  * the output buffer, adjust the number of input bytes downwards.
   */
  bufin = bufcoded;
  while(pr2six[*(bufin++)] <= 63);
  nprbytes = bufin — bufcoded — 1;
  nbytesdecoded = ((nprbytes+3)/4) * 3;

  if ( !BufferResize( pbuffdecoded, nbytesdecoded + 4 ))
      return FALSE;

     if ( pcbDecoded )
      *pcbDecoded = nbytesdecoded;

     bufout = (unsigned char *) BufferQueryPtr(pbuffdecoded);

     bufin = bufcoded;



Содержание  Назад  Вперед