Hi, I'm trying to encode base64 data by composing base64_from_binary with transform_width but this doesn't appear to work correctly when the data is not a multiple of 3 long. What is the correct way to handle this - do I have to handle the padding myself by extending the input data and then patching the tail of the result? Thanks Andrew
I had to separately record the number of bytes. Then when I decode, just pull off that number of bytes.
Robert Ramey
"Eames, Andrew"
But there is still the problem with running off the end of the source -
If the source is not a multiple of 3 bytes then the input iterator will
run off the end of the input sequence which can cause an error.
Andrew
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Robert Ramey
Sent: Thursday, January 03, 2008 6:47 PM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] base 64 encoding
I had to separately record the number of bytes. Then when I decode,
just pull off that number of bytes.
Robert Ramey
"Eames, Andrew"
"Eames, Andrew"
Take a look at basic_text_oprimitive.ipp around line # 64.
Note that I add "padding" here to address this problem. Perhaps that is the missing
magic. Hmmm. perhaps that code should be part of the iterator.
Also look at the code text_iterators_base64 in the serialization test suite.
Robert Ramey
"Eames, Andrew"
I must be missing something fundamental here. The following code
fragment doesn't work (VC++ 8.0 SP1) - the checked iterators in STL
catch walking off the end of the source - transform_width is attempting
to access the second element of the vector
typedef
base64_from_binary<
transform_width
I browsed around the boost site, but couldn't find which library includes base64_from_binary. Where is it located? -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download http://www.xmission.com/~legalize/book/download/index.html Legalize Adulthood! http://blogs.xmission.com/legalize/
participants (3)
-
Eames, Andrew
-
Richard
-
Robert Ramey