Hi William,

Thanks for your reply. I followed your suggestion and changed the buffer size
to 480: where the original program shows `500' it now has
`480'. Unfortunately, after uncommenting the `Doesn't work' section the
problem remains. Only the first block is decoded. Since 480 clearly fits the
requirement of being divisible by both 8 and 6 I'm slightly worried about how
to `find the exact point where an 8 bit is not shared'.

So I thought about reading larger chunks and extracting a smaller number of
characters so as not to exhaust the input buffer. After all extracting in
blocks from a s_mem that completely contains the encoded file works fine, so
why not do it while s_mem is being filled? 

But this was met with variable results: reading blocks of 700 bytes and then
converting 480 bytes after each read-operation works fine, but reading blocks
of 500 bytes and then extracting blocks of 240 bytes fails.

Somehow I don't like this shotgun-approach, thinking that there must be a more
systematic way to handle my problem....

Anyway, here are the essential changes I made to read + extract information:

        size_t const bufSize = 700;
        size_t const readBlock = 480;

        while ((inlen = fread(inbuf, 1, bufSize, stdin)) != 0)
        {
            BIO_write(mem, inbuf, inlen);
            BIO_flush(mem);
                                            // decode some chars at each
                                            // read from stdin
            inlen = BIO_read(bio, inbuf, readBlock);

            if (inlen <= 0)                 // once this happens no more
                break;                      // successful decodes occur

            fwrite(inbuf, 1, inlen, stdout);
        }

So, thanks again for the reply, but I think I'm still looking for a general
(algorithmic) solution....

Cheers,

-- 
    Frank B. Brokken
    Center for Information Technology, University of Groningen
    (+31) 50 363 9281
    Public PGP key: http://pgp.surfnet.nl
    Key Fingerprint: 8E36 9FC4 1DAA FCDF 1A0D  B19F DAC4 BE50 38C6 6170
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to