Thread View: borland.public.cppbuilder.internet.socket
2 messages
2 total messages
Started by Mike Ruskai
Thu, 05 Jun 2008 15:18
IdEncoderMIME doesn't work when created dynamically
Author: Mike Ruskai
Date: Thu, 05 Jun 2008 15:18
Date: Thu, 05 Jun 2008 15:18
32 lines
2070 bytes
2070 bytes
I looked to this for doing base64 encoding, to save a little time doing my own
implementation (or modifying others, which oddly never seem to take and return
strings as arguments).
It works, but only if I create the component at design time, which is a bit of
a hassle with BCB2007 (no Indy tool palette).
If I create it dynamically, it fails to initialize the variable FCodingTable,
which causes an assertion failure on line 390 of TIdCoder3to4.pas.
I can't see why this would happen, but it does in both BCB6 and BCB2007. It
sets FFillChar to "=", and, near as I can tell, it should be setting both
variables in the overridden InitComponent function.
The CodingTable property is read-only, so the component can't be used as is if
it's dynamically allocated.
So I did this, which results in a working dynamically-allocatable component:
class Base64 : public TIdEncoderMIME
{
public:
__fastcall Base64(TComponent *owner)
: TIdEncoderMIME(owner)
{
FCodingTable=GBase64CodeTable;
}
};
I have a solution, therefore, but I'd really like to know why it doesn't work
as is, when my limited understanding of Pascal says it should.
Re: IdEncoderMIME doesn't work when created dynamically
Author: Remy Lebeau (TeamB)
Date: Thu, 05 Jun 2008 17:15
Date: Thu, 05 Jun 2008 17:15
14 lines
1457 bytes
1457 bytes
"Mike Ruskai" <BUTthannydI@DONTearthlinkLIKE.netSPAM> wrote in message news:tmvf441gurbjvu0t4nsca89jrjif3oi4nk@4ax.com... > If I create it dynamically, it fails to initialize the variable > FCodingTable, > which causes an assertion failure on line 390 of TIdCoder3to4.pas. That is a known problem in C++. For whatever reason, the compiler is not invoking InitComponent() correctly in C++, but does so fine in Delphi. I do not know why, and do not have a fix yet. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads