NlMakesis Y-Browser Y-Tasks
Gabor Torok Software architect, Agil Eight (http://www.agileight.com/) Blog: http://mobile-thoughts.blogspot.com/
Today is a gift by GOD, that's why it is called the present.
Forum posts: 723
Tote
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 12
ihave used for image sending and sound it works superb
void YourClass::EcodeBase(const TBuf8<255> Srt)
{
ret.FillZ();
ret.SetLength(0);
TBuf8<64> cvt;
TUint8 fillchar = '=';
for(int i = 0; i < 26; i++)
{
cvt.Append('A' +i);
}
for(int i = 0; i < 26; i++)
{
cvt.Append('a' +i);
}
for(int i = 0; i < 10; i++)
{
cvt.Append('0' +i);
}
cvt.Append('+');
cvt.Append('/');
TUint8 c;
for (int i = 0; i < Srt.Length(); ++i)
{
c = (Srt[i] >> 2) & 0x3f;
ret.Append(cvt[c]);
c = (Srt[i] << 4) & 0x3f;
if (++i < Srt.Length())
c |= (Srt[i] >> 4) & 0x0f;
ret.Append(cvt[c]);
if (i < Srt.Length())
{
c = (Srt[i] << 2) & 0x3f;
if (++i < Srt.Length())
c |= (Srt[i] >> 6) & 0x03;
ret.Append(cvt[c]);
}
else
{
++i;
ret.Append(fillchar);
}
if (i < Srt.Length())
{
c = Srt[i] & 0x3f;
ret.Append(cvt[c]);
}
else
{
ret.Append(fillchar);
}
}
}
Forum posts: 12
TBuf8<340> ret;
shuld bie buffer Size + 1/3
in my case
255 + (1/3) =340
u can do this dynamic but i havet had the need for it..
Forum posts: 21
tnx
Forum posts: 12
Forum posts: 276
TImCodecB64 class is not a documented class.... You can use it .....
include the header imcvcodc.h and link with imut.lib library
Dennis
Today is a gift by GOD, that's why it is called the present.
Forum posts: 723
tnx
Well, the oldest SDK I checked was 2.1 and it contains this file. Can't you start using newer SDKs?
Tote
Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/
Forum posts: 276
Today is a gift by GOD, that's why it is called the present.
Forum posts: 235
But the imut.lib and IMCVCODC.H do exist on these SDKs and they work fine.
Forum posts: 21
Forum posts: 29
:-oTImCodecB64 b64;
b64.Initialise();
TPtr8 result(bufferEncoded->Des() );
if(b64.Encode(readbuffer, result) )
{
__LOG2("%d, %d\n", readbuffer.Length(), encodeLen);
__LOG1("content=%S\n", &result);
aBuffer.Append(result);
}
if(b64.Decode(result, readbuffer) )
{
__LOG2("%S, org=%S\n", &result, &readbuffer);
}
else
{
__LOG("decode failed\n");
}
CleanupStack::PopAndDestroy(2);
Forum posts: 4
The same pieace of code works ok for text encoding decoding but for this image it always gives empty destination buffer.
Is there some ration on size of input and output buffers? like the output buffer must be more then "input+(input/3)" ?
did some one expreced some trouble while decoing large data all at once like a big image or voice etc. ?
S.
Forum posts: 276
Using base64 the size is increased by 1/3. So if your input length is "x" then the target length should be "4x/3".
And TImCodecB64 works fine for both binary (e.g. jpg) and ascii data.
Encode function will panic if the target size is not sufficient.
Today is a gift by GOD, that's why it is called the present.