On 4/28/09, Mattias Gaertner nc-gaert...@netcologne.de wrote:
Bart schrieb:
I'm not even sure that Extended has the same size on all platforms.
[...]
And on some machine extended can be a double.
Mattias
And so they probably do not have the same size ...?
Another thougth.
On Tue, 28 Apr 2009 12:47:20 +0200
Bart bartjun...@gmail.com wrote:
On 4/28/09, Mattias Gaertner nc-gaert...@netcologne.de wrote:
Bart schrieb:
I'm not even sure that Extended has the same size on all
platforms.
[...]
And on some machine extended can be a double.
On Tue, 28 Apr 2009 08:16:04 +0200
Vincent Snijders vsnijd...@vodafonevast.nl wrote:
Hans-Peter Diettrich schreef:
Bart schrieb:
I'm not even sure that Extended has the same size on all platforms.
What size might it have, other than the FPU defined size?
what FPU?
What if
27.4.2009 19:26 - Mattias Gaertner nc-gaert...@netcologne.de
MG Use packed records and add gap variables.
U, look at this:
TYPE TPackedGap =PACKED RECORD
VarInteger :INTEGER;
Dummy1 :INTEGER;
VarDouble :DOUBLE;
On Tue, 28 Apr 2009 15:23:42 +0200
Roland Turcan k...@rotursoft.sk wrote:
27.4.2009 19:26 - Mattias Gaertner nc-gaert...@netcologne.de
MG Use packed records and add gap variables.
U, look at this:
TYPE TPackedGap =PACKED RECORD
VarInteger :INTEGER;
Hello all,
I take back my previous mail, that the packed record doesn't use the
same order as it is definition. I am in time hurry and made on error,
that I was exporting the content of similar record to file to compare
and therefore I looked me as wrong one.
So it is solved.
TRoland;
use:
TYPE TMyOne = packed record
First:integer;
Second:extended;
END;
to be sure about 20 bytes boundary.
thanks,
dmitry
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
Roland Turcan wrote:
Hello All,
I have found some new information about this problem:
1.
TYPE TMyOne =record
First:integer;
Second:integer;
end;
... then the size of this object is 2*4 bytes.
2.
TYPE TMyOne =record
I'm not even sure that Extended has the same size on all platforms.
I might of course be horribly wrong about this ;-)
But if not, it might complicate things.
If you need to read those records, created with Delphi/Kylix now on
MacOS and you cannot solve how to declare your record, you could as a
On Mon, 27 Apr 2009 17:27:30 +0200
Roland Turcan k...@rotursoft.sk wrote:
Hello Dmitry,
Thanks for your reply, but I think, that you haven't understood me
what I am trying to explain.
I have binary contents which are copied from memory using by an
application which is written in Delphi.
Bart schrieb:
I'm not even sure that Extended has the same size on all platforms.
What size might it have, other than the FPU defined size?
If you need to read those records, created with Delphi/Kylix now on
MacOS and you cannot solve how to declare your record, you could as a
last resort
Hello Diettrich,
To tell the truth this code and style I got from previous developer
and I really don't know why he decided to get the size of header from
the binary instead of getting its size. The fact is, that this
optimistic variant of coding is on many places. :-|
TRoland;
24.4.2009 19:56
Hm?
TYPE TSomethingArr = ARRAY OF TSomeItem;
declares a dynamic arrays. Dynamic arrays are implicit pointers, so
should be used carefully in streaming operations.
this should fix your problem:
FUNCTION TMyObject.LoadFromStream (Stream:TStream):BOOLEAN;
...
SetLength (FItems, 0);
// make
Am Freitag, 24. April 2009 15:11 schrieb dmitry boyarintsev:
Hm?
TYPE TSomethingArr = ARRAY OF TSomeItem;
declares a dynamic arrays. Dynamic arrays are implicit pointers, so
should be used carefully in streaming operations.
this should fix your problem:
FUNCTION TMyObject.LoadFromStream
Roland Turcan pisze:
Hello Bart and others,
Thanks for your kindness to test my test case, which works fine in my
case too, but I have found something what maybe more explain my
problem.
TYPE TSomeItem = RECORD
First :single;
Second:Single;
Roland Turcan wrote:
Hello Bart and others,
Thanks for your kindness to test my test case, which works fine in my
case too, but I have found something what maybe more explain my
problem.
maybe? This does most certainly explain your problem, see below
TYPE TSomeItem = RECORD
24.4.2009 15:30 - Bogusław Brandys bran...@o2.pl
BB Roland Turcan pisze:
Hello Bart and others,
Thanks for your kindness to test my test case, which works fine in my
case too, but I have found something what maybe more explain my
problem.
TYPE TSomeItem = RECORD
Stream.Read (HeaderLen, SIZEOF (HeaderLen));
where information header's length is stored into binary.
HeaderLen is integer, right?
have you checked HeaderLen being large that sizeof(TSomeHeader)
it's possible, especiialy for Mac files, because of PowerPC and some
structures may use Big-endian
Hello Dmitry,
24.4.2009 16:17 - dmitry boyarintsev skalogryz.li...@gmail.com
Stream.Read (HeaderLen, SIZEOF (HeaderLen));
where information header's length is stored into binary.
db HeaderLen is integer, right?
db have you checked HeaderLen being large that sizeof(TSomeHeader)
Of course,
Roland Turcan pisze:
Hello Dmitry,
24.4.2009 16:17 - dmitry boyarintsev skalogryz.li...@gmail.com
Stream.Read (HeaderLen, SIZEOF (HeaderLen));
where information header's length is stored into binary.
db HeaderLen is integer, right?
db have you checked HeaderLen being large that
Roland Turcan schrieb:
BB How is HeaderLen declared ?
Stream.Read (HeaderLen, SIZEOF (HeaderLen));
where information header's length is stored into binary.
The you should verify that HeaderLen = SizeOf(FHeader), before
Stream.Read (FHeader, HeaderLen);
Otherwise this statement will
Roland Turcan schrieb:
TYPE TMyObject =class
private
FHeader:TSomeHeader;
FItems :TSomethingArr;
...
FUNCTION TMyObject.LoadFromStream (Stream:TStream):BOOLEAN;
...
SetLength (FItems, 0); //!! for testing only -- this line works
this code should work:
var
m : TMyObject;
...
m := TMyObject.Create; // has been called first?
SetLength(m.FItem, 1);
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
also, you don't need to write 'type' before every type declaration.
It's better to use pascal style:
type
TSomeItem = record
First :single;
Second:Single;
Third :integer;
end;
TSomethingArr = array of TSomeItem;
TMyObject =class
Roland Turcan schreef:
Hello Dmitry,
Thanks for your reply.
I call SetLength from public method of class TMyobject, what
means that object is created and accessible.
Why does calling from a public method mean that the object has been created?
Vincent
This code works perfectly fine (at least it does not crash) with fpc 2.2.2
constructor TMyObject.Create;
begin
DebugLn('Create');
FItem := nil;
DebugLn('nil');
SetLength(FItem,3);
DebugLn('SetLength');
FItem[0].First:= 1.0;
DebugLn('FItem[0].First = ',DbgS(FItem[0].First));
end;
26 matches
Mail list logo