[delphizip] Re: TZipMaster 1.72 TFileExtraEvent need some help

  • From: "Russell Peters" <russellpeters@xxxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Fri, 10 Jan 2003 07:03:06 +1100

That looks correct - working in both has definitely stopped me thinking
cleanly in either.
I could have just cast FilenameOrMessage[504] to a byte pointer but wanted
the structure to be able to be seen (note that I left room for another after
it - once written into a distributed dll it cannot be moved).
Russell Peters
http://www.users.bigpond.com/russellpeters/delphizip.html
----- Original Message -----
From: "Roger Aelbrecht" <Roger.Aelbrecht@xxxxxxxxxx>
To: <delphizip@xxxxxxxxxxxxx>
Sent: Friday, January 10, 2003 4:22 AM
Subject: [delphizip] Re: TZipMaster 1.72 TFileExtraEvent need some help


>
> Russell Peters wrote:
> > It took me ages to work that one out (I am or was a C programmer)
> > try
> > union CallBackData{
> >     char FilenameOrMessage[512];
> >     struct{
> >         char FileName[504];
> >         byte *Data;
> >     }X;
> > };
> > I think that is about right anyway (that's what I visualised it as
> > then nearly tore my hair out trying to implement it in Delphi)
> >
> >>  Extra := CallBackData(ZRec^.FileNameOrMsg).Data;
> > Extra := CallBackData(ZRec->FileNameOrMsg).X.Data;    {cast to
> > CallBackData then get it's Data pointer}
> >
> > Trying to work in Delphi has made it difficult to think in either (it
> > normally ends up being a combination)
> > Russell Peters
> > http://www.users.bigpond.com/russellpeters/delphizip.html
> >
> Don't know if previous mail got through OE seems to behave strange
> The above solution does not work, getting compiler error
> saying cannot: "convert char* to CallBackData"
>
> After some more thinking I found a solution that I hope will work
>
> Changed in Callback.h
> added
> union CallBackData {
>   char FileNameOrMsg[512];
>   struct {
>     char FileName[504];
>     char *Data;
>   }Xtra;
> };
>
>
> in the struct ZCallBackStruct
> char   FileNameOrMsg[512];  into
> CallBackData CBData;
>
> then in ZipBuilder.cpp in all statements were we had
> cbr->FileNameOrMsg changed in
> cbr->CBData.FileNameOrMsg
>
> and finally in actioncode 14
>
> char* Extra = cbr->CBData.Xtra.Data;
>
> This is more or less what was in the Pascall version
>
> Thanks for the help
>
> Roger Aelbrecht
> http://web.wanadoo.be/driehoeksw
>
>



Other related posts: