Article View: borland.public.cppbuilder.internet.socket
Article #212IdEncoderMIME doesn't work when created dynamically
From: 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.
Technical Details
Message-ID:
<tmvf441gurbjvu0t4nsca89jrjif3oi4nk@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,796b5a221ccde30,start X-Google-Attributes: gid11508e,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Mike Ruskai <BUTthannydI@DONTearthlinkLIKE.netSPAM> Newsgroups: borland.public.cppbuilder.internet.socket Subject: IdEncoderMIME doesn't work when created dynamically Date: Thu, 05 Jun 2008 11:18:53 -0400 Message-ID: <tmvf441gurbjvu0t4nsca89jrjif3oi4nk@4ax.com> X-Newsreader: Forte Agent 4.2/32.1118 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 65.41.92.56 X-Trace: newsgroups.borland.com 1212679132 65.41.92.56 (5 Jun 2008 08:18:52 -0700) Lines: 32 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail