Article View: borland.public.cppbuilder.internet.web
Article #1330Re: Active Server Object PART 2
From: Remy Lebeau (TeamB)
Date: Fri, 25 Mar 2005 18:32
Date: Fri, 25 Mar 2005 18:32
49 lines
2330 bytes
2330 bytes
"melk" <NOSPAMi_melk@libero.it> wrote in message
news:42443927@newsgroups.borland.com...
> Hi Thanks for your replay, I tried to use but it seems doesn't work!!!
Just saying it doesn't work says nothing about the actual problem you are
having.
> the first time I tried to use it, it gave me a memory write
> error so I only add a line to malloc "data" before memcpy...
That was not the correct thing to do.
> I olso tried to write to file the "data" buffer whitout pass from the
> "SafeArrayAccessData(v.parray, &data)" function and it write
> the picture file well!!!
You allocated memory for the buffer yourself instead of letting
SafeArrayAccessData() do it for you.
> Graphics::TBitmap *bmp = new Graphics::TBitmap();
> TJPEGImage *jpg = new TJPEGImage();
Wrap those in try...catch or try..finally blocks, or use an std::auto_ptr,
to ensure the memory is freed correctly in case an exception occurs.
> SAFEARRAYBOUND bounds = {0, MemStream->Size-1};
Change that to this instead:
SAFEARRAYBOUND bounds;
bounds.lLbound = 0;
bounds.cElements = MemStream->Size;
> data = malloc(sizeof(byte)*MemStream->Size);
Get rid of that.
> Response->End();
You don't need to call that since Flush() is called later.
> free(data);
Get rid of that.
Gambit
Technical Details
Message-ID:
<424458ef$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4242c7fd@newsgroups.borland.com> <42431956$1@newsgroups.borland.com> <42443927@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,1b87c7406bae033 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.web References: <4242c7fd@newsgroups.borland.com> <42431956$1@newsgroups.borland.com> <42443927@newsgroups.borland.com> Subject: Re: Active Server Object PART 2 Date: Fri, 25 Mar 2005 10:32:24 -0800 Lines: 51 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <424458ef$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1111775471 68.69.17.41 (25 Mar 2005 10:31:11 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail