Advertisement
a3f

martin

a3f
Feb 7th, 2014
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <string.h>
  2. static int ORYGINAL_encode( char *input, char **output, int linesize )
  3. {
  4.     char in[3];
  5.     char out[4];
  6.     int i, len, blocksout = 0;
  7.     int retcode = 0;
  8.  
  9.  
  10.     *in = 0;
  11.     *out = 0;
  12.     while (*input)
  13.     {
  14.         len = 0;
  15.         for ( i = 0; i < 3; i++ )
  16.         {
  17.             in[i] = *(input++);
  18.  
  19.             if (*input)
  20.             {
  21.                 len++;
  22.             }
  23.             else
  24.             {
  25.                 in[i] = 0;
  26.             }
  27.         }
  28.         if ( len > 0 )
  29.         {
  30.             encodeblock( in, out, len );
  31.             strcat(*output, out);
  32.             blocksout++;
  33.         }
  34.         if ( blocksout >= (linesize / 4) || !input )
  35.         {
  36.             if ( blocksout > 0 )
  37.             {
  38.                 strcat(*output, "\r\n" );
  39.             }
  40.             blocksout = 0;
  41.         }
  42.     }
  43.     return ( retcode );
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement