diff --git a/fv/dialogs.pas b/fv/dialogs.pas index b6642af36a..9721d879a4 100644 --- a/fv/dialogs.pas +++ b/fv/dialogs.pas @@ -1287,14 +1287,15 @@ END; {---------------------------------------------------------------------------} CONSTRUCTOR TInputLine.Load (Var S: TStream); VAR B: Byte; + W: Word; BEGIN Inherited Load(S); { Call ancestor } - S.Read(MaxLen, 2); { Read max length } - S.Read(CurPos, 2); { Read cursor position } - S.Read(FirstPos, 2); { Read first position } - S.Read(SelStart, 2); { Read selected start } - S.Read(SelEnd, 2); { Read selected end } - S.Read(B, 1); { Read string length } + S.Read(W, sizeof(w)); MaxLen:=W; { Read max length } + S.Read(W, sizeof(w)); CurPos:=w; { Read cursor position } + S.Read(W, sizeof(w)); FirstPos:=w; { Read first position } + S.Read(W, sizeof(w)); SelStart:=w; { Read selected start } + S.Read(W, sizeof(w)); SelEnd:=w; { Read selected end } + S.Read(B, SizeOf(B)); { Read string length } If (MaxAvail > MaxLen+1) Then Begin { Check enough memory } GetMem(Data, MaxLen + 1); { Allocate memory } S.Read(Data^[1], Length(Data^)); { Read string data } @@ -1513,13 +1514,14 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB } {---------------------------------------------------------------------------} PROCEDURE TInputLine.Store (Var S: TStream); +VAR w: Word; BEGIN TView.Store(S); { Implict TView.Store } - S.Write(MaxLen, 2); { Read max length } - S.Write(CurPos, 2); { Read cursor position } - S.Write(FirstPos, 2); { Read first position } - S.Write(SelStart, 2); { Read selected start } - S.Write(SelEnd, 2); { Read selected end } + w:=MaxLen;S.Write(w, SizeOf(w)); { Read max length } + w:=CurPos;S.Write(w, SizeOf(w)); { Read cursor position } + w:=FirstPos;S.Write(w, SizeOf(w)); { Read first position } + w:=SelStart;S.Write(w, SizeOf(w)); { Read selected start } + w:=SelEnd;S.Write(w, SizeOf(w)); { Read selected end } S.WriteStr(Data); { Write the data } S.Put(Validator); { Write any validator } END; @@ -1808,9 +1810,9 @@ CONSTRUCTOR TButton.Load (Var S: TStream); BEGIN Inherited Load(S); { Call ancestor } Title := S.ReadStr; { Read title } - S.Read(Command, 2); { Read command } - S.Read(Flags, 1); { Read flags } - S.Read(AmDefault, 1); { Read if default } + S.Read(Command, SizeOf(Command)); { Read command } + S.Read(Flags, SizeOf(Flags)); { Read flags } + S.Read(AmDefault, SizeOf(AmDefault)); { Read if default } If NOT CommandEnabled(Command) Then { Check command state } State := State OR sfDisabled Else { Command disabled } State := State AND NOT sfDisabled; { Command enabled } @@ -1978,9 +1980,9 @@ PROCEDURE TButton.Store (Var S: TStream); BEGIN TView.Store(S); { Implict TView.Store } S.WriteStr(Title); { Store title string } - S.Write(Command, 2); { Store command } - S.Write(Flags, 1); { Store flags } - S.Write(AmDefault, 1); { Store default flag } + S.Write(Command, SizeOf(Command)); { Store command } + S.Write(Flags, SizeOf(Flags)); { Store flags } + S.Write(AmDefault, SizeOf(AmDefault)); { Store default flag } END; {--TButton------------------------------------------------------------------} @@ -2097,17 +2099,25 @@ END; { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Oct99 LdB } {---------------------------------------------------------------------------} CONSTRUCTOR TCluster.Load (Var S: TStream); +VAR w: word; BEGIN Inherited Load(S); { Call ancestor } - S.Read(Value, 4); { Read value } - S.Read(Sel, 2); { Read select item } - If ((Options AND ofVersion) >= ofVersion20) { Version 2 TV view } - Then S.Read(EnableMask, 4) Else Begin { Read enable masks } + If ((Options AND ofVersion) >= ofVersion20) Then { Version 2 TV view } + Begin + S.Read(Value, SizeOf(Value)); { Read value } + S.Read(Sel, Sizeof(Sel)); { Read select item } + S.Read(EnableMask, SizeOf(EnableMask)) { Read enable masks } + End + Else + Begin + w:=Value; + S.Read(w, SizeOf(w)); Value:=w; { Read value } + S.Read(Sel, SizeOf(Sel)); { Read select item } EnableMask := $FFFFFFFF; { Enable all masks } Options := Options OR ofVersion20; { Set version 2 mask } End; If (Options AND ofGFVModeView <> 0) Then { GFV mode view check } - S.Read(Id, 2); { Read view id } + S.Read(Id, Sizeof(Id)); { Read view id } Strings.Load(S); { Load string data } SetButtonState(0, True); { Set button state } END; @@ -2312,15 +2322,18 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB } {---------------------------------------------------------------------------} PROCEDURE TCluster.Store (Var S: TStream); +var + w : word; BEGIN TView.Store(S); { TView.Store called } If ((Options AND ofVersion) >= ofVersion20) { Version 2 TV view } Then Begin - S.Write(Value, SizeOf(LongInt)); { Write value } + S.Write(Value, SizeOf(Value)); { Write value } S.Write(Sel, SizeOf(Sel)); { Write select item } S.Write(EnableMask, SizeOf(EnableMask)); { Write enable masks } End Else Begin - S.Write(Value, SizeOf(Word)); { Write value } + w:=Value; + S.Write(w, SizeOf(Word)); { Write value } S.Write(Sel, SizeOf(Sel)); { Write select item } End; If (Options AND ofGFVModeView <> 0) Then { GFV mode view check } @@ -2985,9 +2998,10 @@ END; { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB } {---------------------------------------------------------------------------} CONSTRUCTOR TParamText.Load (Var S: TStream); +VAR w: Word; BEGIN Inherited Load(S); { Call ancestor } - S.Read(ParamCount, 2); { Read parameter count } + S.Read(w, SizeOf(w)); ParamCount:=w; { Read parameter count } END; {--TParamText---------------------------------------------------------------} @@ -3019,9 +3033,10 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB } {---------------------------------------------------------------------------} PROCEDURE TParamText.Store (Var S: TStream); +VAR w: Word; BEGIN TStaticText.Store(S); { Statictext store } - S.Write(ParamCount, 2); { Store param count } + w:=ParamCount;S.Write(w, SizeOf(w)); { Store param count } END; {--TParamText---------------------------------------------------------------} @@ -3272,7 +3287,7 @@ CONSTRUCTOR THistory.Load (Var S: TStream); BEGIN Inherited Load(S); { Call ancestor } GetPeerViewPtr(S, Link); { Load link view } - S.Read(HistoryId, 2); { Read history id } + S.Read(HistoryId, SizeOf(HistoryId)); { Read history id } END; {--THistory-----------------------------------------------------------------} @@ -3318,7 +3333,7 @@ PROCEDURE THistory.Store (Var S: TStream); BEGIN TView.Store(S); { TView.Store called } PutPeerViewPtr(S, Link); { Store link view } - S.Write(HistoryId, 2); { Store history id } + S.Write(HistoryId, SizeOf(HistoryId)); { Store history id } END; {--THistory-----------------------------------------------------------------} @@ -4021,7 +4036,8 @@ constructor TListDlg.Load (var S : TStream); begin if not TDialog.Load(S) then Fail; - S.Read(NewCommand,SizeOf(NewCommand) + SizeOf(EditCommand)); + S.Read(NewCommand,SizeOf(NewCommand)); + S.Read(EditCommand,SizeOf(EditCommand)); GetSubViewPtr(S,ListBox); end; @@ -4075,7 +4091,8 @@ end; procedure TListDlg.Store (var S : TStream); begin TDialog.Store(S); - S.Write(NewCommand,SizeOf(NewCommand) + SizeOf(EditCommand)); + S.Write(NewCommand,SizeOf(NewCommand)); + S.Write(EditCommand,SizeOf(EditCommand)); PutSubViewPtr(S,ListBox); end; @@ -4208,7 +4225,10 @@ END; END. { $Log$ - Revision 1.20 2002-09-22 19:42:23 hajny + Revision 1.21 2002-10-17 11:24:16 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.20 2002/09/22 19:42:23 hajny + FPC/2 support added Revision 1.19 2002/09/09 08:14:47 pierre diff --git a/fv/editors.pas b/fv/editors.pas index a2e78610a9..1fe6a4bd9d 100644 --- a/fv/editors.pas +++ b/fv/editors.pas @@ -1306,8 +1306,8 @@ begin GetPeerViewPtr (S, HScrollBar); GetPeerViewPtr (S, VScrollBar); GetPeerViewPtr (S, Indicator); - S.Read (BufSize, SizeOf (Sw_Word)); - S.Read (CanUndo, SizeOf (Boolean)); + S.Read (BufSize, SizeOf (BufSize)); + S.Read (CanUndo, SizeOf (CanUndo)); S.Read (AutoIndent, SizeOf (AutoIndent)); S.Read (Line_Number, SizeOf (Line_Number)); S.Read (Place_Marker, SizeOf (Place_Marker)); @@ -3117,8 +3117,8 @@ begin PutPeerViewPtr (S, HScrollBar); PutPeerViewPtr (S, VScrollBar); PutPeerViewPtr (S, Indicator); - S.Write (BufSize, SizeOf (Sw_Word)); - S.Write (Canundo, SizeOf (Boolean)); + S.Write (BufSize, SizeOf (BufSize)); + S.Write (Canundo, SizeOf (Canundo)); S.Write (AutoIndent, SizeOf (AutoIndent)); S.Write (Line_Number, SizeOf (Line_Number)); S.Write (Place_Marker, SizeOf (Place_Marker)); @@ -3315,7 +3315,7 @@ VAR Length : Sw_Word; begin Inherited Load (S); - S.Read (Length, SizeOf (Sw_Word)); + S.Read (Length, SizeOf (Length)); if IsValid then begin S.Read (Buffer^[BufSize - Length], Length); @@ -3370,7 +3370,7 @@ end; { TMemo.SetData } procedure TMemo.Store (var S : Objects.TStream); begin Inherited Store (S); - S.Write (BufLen, SizeOf (Sw_Word)); + S.Write (BufLen, SizeOf (BufLen)); S.Write (Buffer^, CurPtr); S.Write (Buffer^[CurPtr + GapLen], BufLen - CurPtr); end; { TMemo.Store } @@ -3402,13 +3402,13 @@ VAR begin Inherited Load (S); BufSize := 0; - S.Read (FileName[0], SizeOf (Char)); + S.Read (FileName[0], SizeOf (Byte)); S.Read (Filename[1], Length (FileName)); if IsValid then IsValid := LoadFile; - S.Read (SStart, SizeOf (Sw_Word)); - S.Read (SEnd, SizeOf (Sw_Word)); - S.Read (Curs, SizeOf (Sw_Word)); + S.Read (SStart, SizeOf (SStart)); + S.Read (SEnd, SizeOf (SEnd)); + S.Read (Curs, SizeOf (Curs)); if IsValid and (SEnd <= BufLen) then begin SetSelect (SStart, SEnd, Curs = SStart); @@ -3580,7 +3580,9 @@ procedure TFileEditor.Store (var S : Objects.TStream); begin Inherited Store (S); S.Write (FileName, Length (FileName) + 1); - S.Write (SelStart, SizeOf (Sw_Word) * 3); + S.Write (SelStart, SizeOf (SelStart)); + S.Write (SelEnd, SizeOf (SelEnd)); + S.Write (CurPtr, SizeOf (CurPtr)); end; { TFileEditor.Store } diff --git a/fv/histlist.pas b/fv/histlist.pas index 810dbc5cfc..2bb1a033a6 100644 --- a/fv/histlist.pas +++ b/fv/histlist.pas @@ -395,7 +395,7 @@ end; PROCEDURE LoadHistory (Var S: TStream); VAR Size: sw_Word; BEGIN - S.Read(Size, sizeof(sw_Word)); { Read history size } + S.Read(Size, sizeof(Size)); { Read history size } If (HistoryBlock <> Nil) Then Begin { History initialized } If (Size <= HistorySize) Then Begin S.Read(HistoryBlock^, Size); { Read the history } @@ -412,7 +412,7 @@ VAR Size: sw_Word; BEGIN If (HistoryBlock = Nil) Then Size := 0 Else { No history data } Size := HistoryUsed; { Size of history data } - S.Write(Size, sizeof(sw_Word)); { Write history size } + S.Write(Size, sizeof(Size)); { Write history size } If (Size > 0) Then S.Write(HistoryBlock^, Size); { Write history data } END; @@ -420,7 +420,10 @@ END. { $Log$ - Revision 1.9 2002-09-07 15:06:37 peter + Revision 1.10 2002-10-17 11:24:16 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.9 2002/09/07 15:06:37 peter * old logs removed and tabs fixed Revision 1.8 2002/06/10 11:51:08 pierre diff --git a/fv/inplong.pas b/fv/inplong.pas index 54a0b0eaeb..fbf312ce84 100644 --- a/fv/inplong.pas +++ b/fv/inplong.pas @@ -129,14 +129,18 @@ end; constructor TInputLong.Load(var S : TStream); begin TInputLine.Load(S); -S.Read(ILOptions, Sizeof(ILOptions)+Sizeof(LLim)+Sizeof(ULim)); +S.Read(ILOptions, Sizeof(ILOptions)); +S.Read(LLim, Sizeof(LLim)); +S.Read(ULim, Sizeof(ULim)); end; {-------------------TInputLong.Store} procedure TInputLong.Store(var S : TStream); begin TInputLine.Store(S); -S.Write(ILOptions, Sizeof(ILOptions)+Sizeof(LLim)+Sizeof(ULim)); +S.Write(ILOptions, Sizeof(ILOptions)); +S.Write(LLim, Sizeof(LLim)); +S.Write(ULim, Sizeof(ULim)); end; {-------------------TInputLong.DataSize} diff --git a/fv/menus.pas b/fv/menus.pas index 137fb581f0..eaa4bf1cfc 100644 --- a/fv/menus.pas +++ b/fv/menus.pas @@ -451,7 +451,7 @@ CONSTRUCTOR TMenuView.Load (Var S: TStream); New(Menu); { Create new menu } Last := @Menu^.Items; { Start on first item } Item := Nil; { Clear pointer } - S.Read(Tok, 1); { Read token } + S.Read(Tok, SizeOf(Tok)); { Read token } While (Tok <> 0) Do Begin New(Item); { Create new item } Last^ := Item; { First part of chain } @@ -459,10 +459,10 @@ CONSTRUCTOR TMenuView.Load (Var S: TStream); Last := @Item^.Next; { Complete chain } With Item^ Do Begin Name := S.ReadStr; { Read menu name } - S.Read(Command, 2); { Menu item command } - S.Read(Disabled, 1); { Menu item state } - S.Read(KeyCode, 2); { Menu item keycode } - S.Read(HelpCtx, 2); { Menu item help ctx } + S.Read(Command, SizeOf(Command)); { Menu item command } + S.Read(Disabled, SizeOf(Disabled)); { Menu item state } + S.Read(KeyCode, SizeOf(KeyCode)); { Menu item keycode } + S.Read(HelpCtx, SizeOf(HelpCtx)); { Menu item help ctx } If (Name <> Nil) Then If Command = 0 Then {$ifdef PPC_FPC} @@ -473,7 +473,7 @@ CONSTRUCTOR TMenuView.Load (Var S: TStream); Else Param := S.ReadStr; { Read param string } End; End; - S.Read(Tok, 1); { Read token } + S.Read(Tok, SizeOf(Tok)); { Read token } End; Last^ := Nil; { List complete } Menu^.Default := Menu^.Items; { Set menu default } @@ -796,12 +796,12 @@ PROCEDURE TMenuView.Store (Var S: TStream); Item := Menu^.Items; { Start first item } While (Item <> Nil) Do Begin With Item^ Do Begin - S.Write(Tok, 1); { Write tok value } + S.Write(Tok, SizeOf(Tok)); { Write tok value } S.WriteStr(Name); { Write item name } - S.Write(Command, 2); { Menu item command } - S.Write(Disabled, 1); { Menu item state } - S.Write(KeyCode, 2); { Menu item keycode } - S.Write(HelpCtx, 2); { Menu item help ctx } + S.Write(Command, SizeOf(Command)); { Menu item command } + S.Write(Disabled, SizeOf(Disabled)); { Menu item state } + S.Write(KeyCode, SizeOf(KeyCode)); { Menu item keycode } + S.Write(HelpCtx, SizeOf(HelpCtx)); { Menu item help ctx } If (Name <> Nil) Then If Command = 0 Then DoStoreMenu(SubMenu) Else S.WriteStr(Param); { Write parameter } @@ -809,7 +809,7 @@ PROCEDURE TMenuView.Store (Var S: TStream); Item := Item^.Next; { Next item } End; Tok := 0; { Clear tok count } - S.Write(Tok, 1); { Write tok value } + S.Write(Tok, SizeOf(Tok)); { Write tok value } END; BEGIN @@ -1296,15 +1296,15 @@ CONSTRUCTOR TStatusLine.Load (Var S: TStream); BEGIN Cur := Nil; { Preset nil } Last := @First; { Start on first item } - S.Read(Count, 2); { Read count } + S.Read(Count, SizeOf(Count)); { Read count } While (Count > 0) Do Begin New(Cur); { New status item } Last^ := Cur; { First chain part } If (Cur <> Nil) Then Begin { Check pointer valid } Last := @Cur^.Next; { Chain complete } Cur^.Text := S.ReadStr; { Read item text } - S.Read(Cur^.KeyCode, 2); { Keycode of item } - S.Read(Cur^.Command, 2); { Command of item } + S.Read(Cur^.KeyCode, SizeOf(Cur^.KeyCode)); { Keycode of item } + S.Read(Cur^.Command, SizeOf(Cur^.Command)); { Command of item } End; Dec(Count); { One item loaded } End; @@ -1316,14 +1316,14 @@ CONSTRUCTOR TStatusLine.Load (Var S: TStream); VAR Count: Integer; Cur, First: PStatusDef; Last: ^PStatusDef; BEGIN Last := @First; { Start on first } - S.Read(Count, 2); { Read item count } + S.Read(Count, SizeOf(Count)); { Read item count } While (Count > 0) Do Begin New(Cur); { New status def } Last^ := Cur; { First part of chain } If (Cur <> Nil) Then Begin { Check pointer valid } Last := @Cur^.Next; { Chain complete } - S.Read(Cur^.Min, 2); { Read min data } - S.Read(Cur^.Max, 2); { Read max data } + S.Read(Cur^.Min, SizeOf(Cur^.Min)); { Read min data } + S.Read(Cur^.Max, SizeOf(Cur^.Max)); { Read max data } Cur^.Items := DoLoadStatusItems; { Set pointer } End; Dec(Count); { One item loaded } @@ -1425,11 +1425,11 @@ PROCEDURE TStatusLine.Store (Var S: TStream); Inc(Count); { Count items } T := T^.Next; { Next item } End; - S.Write(Count, 2); { Write item count } + S.Write(Count, SizeOf(Count)); { Write item count } While (Cur <> Nil) Do Begin S.WriteStr(Cur^.Text); { Store item text } - S.Write(Cur^.KeyCode, 2); { Keycode of item } - S.Write(Cur^.Command, 2); { Command of item } + S.Write(Cur^.KeyCode, SizeOf(Cur^.KeyCode)); { Keycode of item } + S.Write(Cur^.Command, SizeOf(Cur^.Command)); { Command of item } Cur := Cur^.Next; { Move to next item } End; END; @@ -1759,7 +1759,10 @@ END; END. { $Log$ - Revision 1.15 2002-09-07 15:06:37 peter + Revision 1.16 2002-10-17 11:24:17 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.15 2002/09/07 15:06:37 peter * old logs removed and tabs fixed Revision 1.14 2002/06/10 18:41:26 pierre diff --git a/fv/stddlg.pas b/fv/stddlg.pas index 727aa0a8c5..8defc5e55a 100644 --- a/fv/stddlg.pas +++ b/fv/stddlg.pas @@ -1378,7 +1378,7 @@ constructor TFileDialog.Load(var S: TStream); begin if not TDialog.Load(S) then Fail; - S.Read(WildCard, SizeOf(TWildStr)); + S.Read(WildCard, SizeOf(WildCard)); if (S.Status <> stOk) then begin TDialog.Done; @@ -1501,7 +1501,7 @@ end; procedure TFileDialog.Store(var S: TStream); begin TDialog.Store(S); - S.Write(WildCard, SizeOf(TWildStr)); + S.Write(WildCard, SizeOf(WildCard)); PutSubViewPtr(S, FileName); PutSubViewPtr(S, FileList); PutSubViewPtr(S, FileHistory); diff --git a/fv/validate.pas b/fv/validate.pas index 01eb34f921..5d398a760f 100644 --- a/fv/validate.pas +++ b/fv/validate.pas @@ -377,7 +377,7 @@ END; CONSTRUCTOR TValidator.Load (Var S:TStream); BEGIN Inherited Init; { Call ancestor } - S.Read(Options, 2); { Read option masks } + S.Read(Options, SizeOf(Options)); { Read option masks } END; {--TValidator---------------------------------------------------------------} @@ -427,7 +427,7 @@ END; {---------------------------------------------------------------------------} PROCEDURE TValidator.Store (Var S: TStream); BEGIN - S.Write(Options, 2); { Write options } + S.Write(Options, SizeOf(Options)); { Write options } END; {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} @@ -821,7 +821,7 @@ END; CONSTRUCTOR TFilterValidator.Load (Var S: TStream); BEGIN Inherited Load(S); { Call ancestor } - S.Read(ValidChars, SizeOf(TCharSet)); { Read valid char set } + S.Read(ValidChars, SizeOf(ValidChars)); { Read valid char set } END; {--TFilterValidator---------------------------------------------------------} @@ -863,7 +863,7 @@ END; PROCEDURE TFilterValidator.Store (Var S: TStream); BEGIN TValidator.Store(S); { TValidator.Store call } - S.Write(ValidChars, SizeOf(TCharSet)); { Write valid char set } + S.Write(ValidChars, SizeOf(ValidChars)); { Write valid char set } END; {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} @@ -888,8 +888,8 @@ END; CONSTRUCTOR TRangeValidator.Load (Var S: TStream); BEGIN Inherited Load(S); { Call ancestor } - S.Read(Min, 4); { Read min value } - S.Read(Max, 4); { Read max value } + S.Read(Min, SizeOf(Min)); { Read min value } + S.Read(Max, SizeOf(Max)); { Read max value } END; {--TRangeValidator----------------------------------------------------------} @@ -943,8 +943,8 @@ END; PROCEDURE TRangeValidator.Store (Var S: TStream); BEGIN TFilterValidator.Store(S); { TFilterValidator.Store } - S.Write(Min, 4); { Write min value } - S.Write(Max, 4); { Write max value } + S.Write(Min, SizeOf(Min)); { Write min value } + S.Write(Max, SizeOf(Max)); { Write max value } END; {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} @@ -1059,7 +1059,10 @@ END. { $Log$ - Revision 1.7 2002-09-09 08:14:48 pierre + Revision 1.8 2002-10-17 11:24:17 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.7 2002/09/09 08:14:48 pierre * remove virtual modifer from store methods Revision 1.6 2002/09/07 15:06:38 peter diff --git a/fv/views.pas b/fv/views.pas index 3606e85d14..750754efec 100644 --- a/fv/views.pas +++ b/fv/views.pas @@ -981,28 +981,29 @@ END; { supported but it should work as per original TV code. } {---------------------------------------------------------------------------} CONSTRUCTOR TView.Load (Var S: TStream); +VAR i: Integer; BEGIN Inherited Init; { Call ancestor } - S.Read(Origin.X, 2); { Read origin x value } - S.Read(Origin.Y, 2); { Read origin y value } - S.Read(Size.X, 2); { Read view x size } - S.Read(Size.Y, 2); { Read view y size } - S.Read(Cursor.X, 2); { Read cursor x size } - S.Read(Cursor.Y, 2); { Read cursor y size } - S.Read(GrowMode, 1); { Read growmode flags } - S.Read(DragMode, 1); { Read dragmode flags } - S.Read(HelpCtx, 2); { Read help context } - S.Read(State, 2); { Read state masks } - S.Read(Options, 2); { Read options masks } - S.Read(Eventmask, 2); { Read event masks } + S.Read(i, SizeOf(i)); Origin.X:=i; { Read origin x value } + S.Read(i, SizeOf(i)); Origin.Y:=i; { Read origin y value } + S.Read(i, SizeOf(i)); Size.X:=i; { Read view x size } + S.Read(i, SizeOf(i)); Size.Y:=i; { Read view y size } + S.Read(i, SizeOf(i)); Cursor.X:=i; { Read cursor x size } + S.Read(i, SizeOf(i)); Cursor.Y:=i; { Read cursor y size } + S.Read(GrowMode, SizeOf(GrowMode)); { Read growmode flags } + S.Read(DragMode, SizeOf(DragMode)); { Read dragmode flags } + S.Read(HelpCtx, SizeOf(HelpCtx)); { Read help context } + S.Read(State, SizeOf(State)); { Read state masks } + S.Read(Options, SizeOf(Options)); { Read options masks } + S.Read(Eventmask, SizeOf(Eventmask)); { Read event masks } If (Options AND ofGFVModeView <> 0) Then Begin { STREAM HAS GFV TVIEW } - S.Read(GOptions, 2); { Read new option masks } - S.Read(TabMask, 1); { Read new tab masks } - S.Read(RawOrigin.X, 2); { Read raw x origin point } - S.Read(RawOrigin.Y, 2); { Read raw y origin point } - S.Read(RawSize.X, 2); { Read raw x size } - S.Read(RawSize.Y, 2); { Read raw y size } - S.Read(ColourOfs, 2); { Read palette offset } + S.Read(GOptions, SizeOf(GOptions)); { Read new option masks } + S.Read(TabMask, SizeOf(TabMask)); { Read new tab masks } + S.Read(i, SizeOf(i)); RawOrigin.X:=i; { Read raw x origin point } + S.Read(i, SizeOf(i)); RawOrigin.Y:=i; { Read raw y origin point } + S.Read(i, SizeOf(i)); RawSize.X:=i; { Read raw x size } + S.Read(i, SizeOf(i)); RawSize.Y:=i; { Read raw y size } + S.Read(i, SizeOf(i)); ColourOfs:=i; { Read palette offset } End Else Begin { STREAM HAS OLD TView } RawOrigin.X := Origin.X * FontWidth; { Set x origin pt } RawOrigin.Y := Origin.Y * FontHeight; { Set y origin pt } @@ -2035,30 +2036,31 @@ END; {---------------------------------------------------------------------------} PROCEDURE TView.Store (Var S: TStream); VAR SaveState: Word; + i: integer; BEGIN SaveState := State; { Hold current state } State := State AND NOT (sfActive OR sfSelected OR sfFocused OR sfExposed); { Clear flags } - S.Write(Origin.X, 2); { Write view x origin } - S.Write(Origin.Y, 2); { Write view y origin } - S.Write(Size.X, 2); { Write view x size } - S.Write(Size.Y, 2); { Write view y size } - S.Write(Cursor.X, 2); { Write cursor x size } - S.Write(Cursor.Y, 2); { Write cursor y size } - S.Write(GrowMode, 1); { Write growmode flags } - S.Write(DragMode, 1); { Write dragmode flags } - S.Write(HelpCtx, 2); { Write help context } - S.Write(State, 2); { Write state masks } - S.Write(Options, 2); { Write options masks } - S.Write(Eventmask, 2); { Write event masks } + i:=Origin.X;S.Write(i, SizeOf(i)); { Write view x origin } + i:=Origin.Y;S.Write(i, SizeOf(i)); { Write view y origin } + i:=Size.X;S.Write(i, SizeOf(i)); { Write view x size } + i:=Size.Y;S.Write(i, SizeOf(i)); { Write view y size } + i:=Cursor.X;S.Write(i, SizeOf(i)); { Write cursor x size } + i:=Cursor.Y;S.Write(i, SizeOf(i)); { Write cursor y size } + S.Write(GrowMode, SizeOf(GrowMode)); { Write growmode flags } + S.Write(DragMode, SizeOf(DragMode)); { Write dragmode flags } + S.Write(HelpCtx, SizeOf(HelpCtx)); { Write help context } + S.Write(State, SizeOf(State)); { Write state masks } + S.Write(Options, SizeOf(Options)); { Write options masks } + S.Write(Eventmask, SizeOf(Eventmask)); { Write event masks } If (Options AND ofGFVModeView <> 0) Then Begin { GFV GRAPHICAL TVIEW } - S.Write(GOptions, 2); { Write new option masks } - S.Write(TabMask, 1); { Write new tab masks } - S.Write(RawOrigin.X, 2); { Write raw origin x point } - S.Write(RawOrigin.Y, 2); { Write raw origin y point } - S.Write(RawSize.X, 2); { Write raw x size } - S.Write(RawSize.Y, 2); { Write raw y size } - S.Write(ColourOfs, 2); { Write Palette offset } + S.Write(GOptions, SizeOf(GOptions)); { Write new option masks } + S.Write(TabMask, SizeOf(TabMask)); { Write new tab masks } + i:=RawOrigin.X;S.Write(i, SizeOf(i)); { Write raw origin x point } + i:=RawOrigin.Y;S.Write(i, SizeOf(i)); { Write raw origin y point } + i:=RawSize.X;S.Write(i, SizeOf(i)); { Write raw x size } + i:=RawSize.Y;S.Write(i, SizeOf(i)); { Write raw y size } + i:=ColourOfs;S.Write(i, SizeOf(i)); { Write Palette offset } End; State := SaveState; { Reset state masks } END; @@ -2292,10 +2294,10 @@ END; { GetPeerViewPtr -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB } {---------------------------------------------------------------------------} PROCEDURE TView.GetPeerViewPtr (Var S: TStream; Var P); -VAR Index: Sw_Integer; +VAR Index: Integer; BEGIN Index := 0; { Zero index value } - S.Read(Index, 2); { Read view index } + S.Read(Index, SizeOf(Index)); { Read view index } If (Index = 0) OR (OwnerGroup = Nil) Then { Check for peer views } Pointer(P) := Nil Else Begin { Return nil } Pointer(P) := FixupList^[Index]; { New view ptr } @@ -2307,11 +2309,11 @@ END; { PutPeerViewPtr -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB } {---------------------------------------------------------------------------} PROCEDURE TView.PutPeerViewPtr (Var S: TStream; P: PView); -VAR Index: Sw_Integer; +VAR Index: Integer; BEGIN If (P = Nil) OR (OwnerGroup = Nil) Then Index := 0 { Return zero index } Else Index := OwnerGroup^.IndexOf(P); { Return view index } - S.Write(Index, 2); { Write the index } + S.Write(Index, SizeOf(Index)); { Write the index } END; {--TView--------------------------------------------------------------------} @@ -2381,7 +2383,9 @@ END; { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 15Sep97 LdB } {---------------------------------------------------------------------------} CONSTRUCTOR TGroup.Load (Var S: TStream); -VAR I, Count: Sw_Word; P, Q: ^Pointer; V: PView; OwnerSave: PGroup; +VAR I: Sw_Word; + Count: Word; + P, Q: ^Pointer; V: PView; OwnerSave: PGroup; FixupSave: PFixupList; BEGIN Inherited Load(S); { Call ancestor } @@ -2390,7 +2394,7 @@ BEGIN OwnerGroup := @Self; { We are current group } FixupSave := FixupList; { Save current list } Count := 0; { Zero count value } - S.Read(Count, 2); { Read entry count } + S.Read(Count, SizeOf(Count)); { Read entry count } If (MaxAvail >= Count*SizeOf(Pointer)) Then Begin { Memory available } GetMem(FixupList, Count*SizeOf(Pointer)); { List size needed } FillChar(FixUpList^, Count*SizeOf(Pointer), #0); { Zero all entries } @@ -2970,7 +2974,7 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Mar98 LdB } {---------------------------------------------------------------------------} PROCEDURE TGroup.Store (Var S: TStream); -VAR Count: Sw_Integer; OwnerSave: PGroup; +VAR Count: Word; OwnerSave: PGroup; PROCEDURE DoPut (P: PView); {$IFNDEF PPC_FPC}FAR;{$ENDIF} BEGIN @@ -2982,7 +2986,7 @@ BEGIN OwnerSave := OwnerGroup; { Save ownergroup } OwnerGroup := @Self; { Set as owner group } Count := IndexOf(Last); { Subview count } - S.Write(Count, 2); { Write the count } + S.Write(Count, SizeOf(Count)); { Write the count } ForEach(@DoPut); { Put each in stream } PutSubViewPtr(S, Current); { Current on stream } OwnerGroup := OwnerSave; { Restore ownergroup } @@ -3072,10 +3076,10 @@ END; { GetSubViewPtr -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 20May98 LdB } {---------------------------------------------------------------------------} PROCEDURE TGroup.GetSubViewPtr (Var S: TStream; Var P); -VAR Index, I: Sw_Word; Q: PView; +VAR Index, I: Word; Q: PView; BEGIN Index := 0; { Zero index value } - S.Read(Index, 2); { Read view index } + S.Read(Index, SizeOf(Index)); { Read view index } If (Index > 0) Then Begin { Valid index } Q := Last; { Start on last } For I := 1 To Index Do Q := Q^.Next; { Loop for count } @@ -3091,7 +3095,7 @@ VAR Index: Sw_Word; BEGIN If (P = Nil) Then Index := 0 Else { Nil view, Index = 0 } Index := IndexOf(P); { Calc view index } - S.Write(Index, 2); { Write the index } + S.Write(Index, SizeOf(Index)); { Write the index } END; @@ -3287,16 +3291,19 @@ END; { scrollbar id set to zero. } {---------------------------------------------------------------------------} CONSTRUCTOR TScrollBar.Load (Var S: TStream); +VAR i: Integer; BEGIN Inherited Load(S); { Call ancestor } - S.Read(Value, 2); { Read current value } - S.Read(Min , 2); { Read min value } - S.Read(Max, 2); { Read max value } - S.Read(PgStep, 2); { Read page step size } - S.Read(ArStep, 2); { Read arrow step size } + S.Read(i, SizeOf(i)); Value:=i; { Read current value } + S.Read(i, SizeOf(i)); Min:=i; { Read min value } + S.Read(i, SizeOf(i)); Max:=i; { Read max value } + S.Read(i, SizeOf(i)); PgStep:=i; { Read page step size } + S.Read(i, SizeOf(i)); ArStep:=i; { Read arrow step size } S.Read(Chars, SizeOf(Chars)); { Read scroll chars } If (Options AND ofGFVModeView <> 0) Then { GFV mode view check } - S.Read(Id, 2); { Read id } + begin + S.Read(i, SizeOf(i)); Id:=i; { Read id } + end; END; {--TScrollBar---------------------------------------------------------------} @@ -3452,16 +3459,19 @@ END; { routine and resetting the ofGrafVersion flag after the call. } {---------------------------------------------------------------------------} PROCEDURE TScrollBar.Store (Var S: TStream); +VAR i: Integer; BEGIN TView.Store(S); { TView.Store called } - S.Write(Value, 2); { Write current value } - S.Write(Min, 2); { Write min value } - S.Write(Max, 2); { Write max value } - S.Write(PgStep, 2); { Write page step size } - S.Write(ArStep, 2); { Write arrow step size } + i:=Value;S.Write(i, SizeOf(i)); { Write current value } + i:=Min;S.Write(i, SizeOf(i)); { Write min value } + i:=Max;S.Write(i, SizeOf(i)); { Write max value } + i:=PgStep;S.Write(i, SizeOf(i)); { Write page step size } + i:=ArStep;S.Write(i, SizeOf(i)); { Write arrow step size } S.Write(Chars, SizeOf(Chars)); { Write scroll chars } If (Options AND ofGFVModeView <> 0) Then { GFV mode view check } - S.Write(Id, 2); { Write scrollbar id } + begin + i:=Id;S.Write(i, SizeOf(i)); { Write scrollbar id } + end; END; {--TScrollBar---------------------------------------------------------------} @@ -3731,14 +3741,15 @@ END; { as the new graphical scroller views. } {---------------------------------------------------------------------------} CONSTRUCTOR TScroller.Load (Var S: TStream); +VAR i: Integer; BEGIN Inherited Load(S); { Call ancestor } GetPeerViewPtr(S, HScrollBar); { Load horz scrollbar } GetPeerViewPtr(S, VScrollBar); { Load vert scrollbar } - S.Read(Delta.X, 2); { Read delta x value } - S.Read(Delta.Y, 2); { Read delta y value } - S.Read(Limit.X, 2); { Read limit x value } - S.Read(Limit.Y, 2); { Read limit y value } + S.Read(i, SizeOf(i)); Delta.X:=i; { Read delta x value } + S.Read(i, SizeOf(i)); Delta.Y:=i; { Read delta y value } + S.Read(i, SizeOf(i)); Limit.X:=i; { Read limit x value } + S.Read(i, SizeOf(i)); Limit.Y:=i; { Read limit y value } END; {--TScroller----------------------------------------------------------------} @@ -3789,14 +3800,15 @@ END; { The scroller is saved to the stream compatable with the old TV object. } {---------------------------------------------------------------------------} PROCEDURE TScroller.Store (Var S: TStream); +VAR i: Integer; BEGIN TView.Store(S); { Call TView explicitly } PutPeerViewPtr(S, HScrollBar); { Store horz bar } PutPeerViewPtr(S, VScrollBar); { Store vert bar } - S.Write(Delta.X, 2); { Write delta x value } - S.Write(Delta.Y, 2); { Write delta y value } - S.Write(Limit.X, 2); { Write limit x value } - S.Write(Limit.Y, 2); { Write limit y value } + i:=Delta.X;S.Write(i, SizeOf(i)); { Write delta x value } + i:=Delta.Y;S.Write(i, SizeOf(i)); { Write delta y value } + i:=Limit.X;S.Write(i, SizeOf(i)); { Write limit x value } + i:=Limit.Y;S.Write(i, SizeOf(i)); { Write limit y value } END; {--TScroller----------------------------------------------------------------} @@ -3862,14 +3874,15 @@ END; { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28May98 LdB } {---------------------------------------------------------------------------} CONSTRUCTOR TListViewer.Load (Var S: TStream); +VAR w: Word; BEGIN Inherited Load(S); { Call ancestor } GetPeerViewPtr(S, HScrollBar); { Get horz scrollbar } GetPeerViewPtr(S, VScrollBar); { Get vert scrollbar } - S.Read(NumCols, 2); { Read column number } - S.Read(TopItem, 2); { Read top most item } - S.Read(Focused, 2); { Read focused item } - S.Read(Range, 2); { Read listview range } + S.Read(w, SizeOf(w)); NumCols:=w; { Read column number } + S.Read(w, SizeOf(w)); TopItem:=w; { Read top most item } + S.Read(w, SizeOf(w)); Focused:=w; { Read focused item } + S.Read(w, SizeOf(w)); Range:=w; { Read listview range } END; {--TListViewer--------------------------------------------------------------} @@ -4131,14 +4144,15 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Jul99 LdB } {---------------------------------------------------------------------------} PROCEDURE TListViewer.Store (Var S: TStream); +VAR w: Word; BEGIN TView.Store(S); { Call TView explicitly } PutPeerViewPtr(S, HScrollBar); { Put horz scrollbar } PutPeerViewPtr(S, VScrollBar); { Put vert scrollbar } - S.Write(NumCols, 2); { Write column number } - S.Write(TopItem, 2); { Write top most item } - S.Write(Focused, 2); { Write focused item } - S.Write(Range, 2); { Write listview range } + w:=NumCols;S.Write(w, SizeOf(w)); { Write column number } + w:=TopItem;S.Write(w, SizeOf(w)); { Write top most item } + w:=Focused;S.Write(w, SizeOf(w)); { Write focused item } + w:=Range;S.Write(w, SizeOf(w)); { Write listview range } END; {--TListViewer--------------------------------------------------------------} @@ -4315,15 +4329,16 @@ END; { although a frame view is read for compatability it is disposed of. } {---------------------------------------------------------------------------} CONSTRUCTOR TWindow.Load (Var S: TStream); +VAR I: Integer; BEGIN Inherited Load(S); { Call ancestor } - S.Read(Flags, 1); { Read window flags } - S.Read(Number, 2); { Read window number } - S.Read(Palette, 2); { Read window palette } - S.Read(ZoomRect.A.X, 2); { Read zoom area x1 } - S.Read(ZoomRect.A.Y, 2); { Read zoom area y1 } - S.Read(ZoomRect.B.X, 2); { Read zoom area x2 } - S.Read(ZoomRect.B.Y, 2); { Read zoom area y2 } + S.Read(Flags, SizeOf(Flags)); { Read window flags } + S.Read(i, SizeOf(i)); Number:=i; { Read window number } + S.Read(i, SizeOf(i)); Palette:=i; { Read window palette } + S.Read(i, SizeOf(i)); ZoomRect.A.X:=i; { Read zoom area x1 } + S.Read(i, SizeOf(i)); ZoomRect.A.Y:=i; { Read zoom area y1 } + S.Read(i, SizeOf(i)); ZoomRect.B.X:=i; { Read zoom area x2 } + S.Read(i, SizeOf(i)); ZoomRect.B.Y:=i; { Read zoom area y2 } GetSubViewPtr(S, Frame); { Now read frame object } If (Frame <> Nil) Then Begin Dispose(Frame, Done); { Kill we don't use it } @@ -4446,15 +4461,16 @@ END; { routine and resetting the ofGrafVersion flag after the call. } {---------------------------------------------------------------------------} PROCEDURE TWindow.Store (Var S: TStream); +VAR i: Integer; BEGIN TGroup.Store(S); { Call group store } - S.Write(Flags, 1); { Write window flags } - S.Write(Number, 2); { Write window number } - S.Write(Palette, 2); { Write window palette } - S.Write(ZoomRect.A.X, 2); { Write zoom area x1 } - S.Write(ZoomRect.A.Y, 2); { Write zoom area y1 } - S.Write(ZoomRect.B.X, 2); { Write zoom area x2 } - S.Write(ZoomRect.B.Y, 2); { Write zoom area y2 } + S.Write(Flags, SizeOf(Flags)); { Write window flags } + i:=Number;S.Write(i, SizeOf(i)); { Write window number } + i:=Palette;S.Write(i, SizeOf(i)); { Write window palette } + i:=ZoomRect.A.X;S.Write(i, SizeOf(i)); { Write zoom area x1 } + i:=ZoomRect.A.Y;S.Write(i, SizeOf(i)); { Write zoom area y1 } + i:=ZoomRect.B.X;S.Write(i, SizeOf(i)); { Write zoom area x2 } + i:=ZoomRect.B.Y;S.Write(i, SizeOf(i)); { Write zoom area y2 } PutSubViewPtr(S, Frame); { Write any frame } S.WriteStr(Title); { Write title string } END; @@ -5804,7 +5820,10 @@ END. { $Log$ - Revision 1.39 2002-09-22 19:42:21 hajny + Revision 1.40 2002-10-17 11:24:17 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.39 2002/09/22 19:42:21 hajny + FPC/2 support added Revision 1.38 2002/09/12 12:03:13 pierre diff --git a/fvision/dialogs.pas b/fvision/dialogs.pas index b6642af36a..9721d879a4 100644 --- a/fvision/dialogs.pas +++ b/fvision/dialogs.pas @@ -1287,14 +1287,15 @@ END; {---------------------------------------------------------------------------} CONSTRUCTOR TInputLine.Load (Var S: TStream); VAR B: Byte; + W: Word; BEGIN Inherited Load(S); { Call ancestor } - S.Read(MaxLen, 2); { Read max length } - S.Read(CurPos, 2); { Read cursor position } - S.Read(FirstPos, 2); { Read first position } - S.Read(SelStart, 2); { Read selected start } - S.Read(SelEnd, 2); { Read selected end } - S.Read(B, 1); { Read string length } + S.Read(W, sizeof(w)); MaxLen:=W; { Read max length } + S.Read(W, sizeof(w)); CurPos:=w; { Read cursor position } + S.Read(W, sizeof(w)); FirstPos:=w; { Read first position } + S.Read(W, sizeof(w)); SelStart:=w; { Read selected start } + S.Read(W, sizeof(w)); SelEnd:=w; { Read selected end } + S.Read(B, SizeOf(B)); { Read string length } If (MaxAvail > MaxLen+1) Then Begin { Check enough memory } GetMem(Data, MaxLen + 1); { Allocate memory } S.Read(Data^[1], Length(Data^)); { Read string data } @@ -1513,13 +1514,14 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 04Oct99 LdB } {---------------------------------------------------------------------------} PROCEDURE TInputLine.Store (Var S: TStream); +VAR w: Word; BEGIN TView.Store(S); { Implict TView.Store } - S.Write(MaxLen, 2); { Read max length } - S.Write(CurPos, 2); { Read cursor position } - S.Write(FirstPos, 2); { Read first position } - S.Write(SelStart, 2); { Read selected start } - S.Write(SelEnd, 2); { Read selected end } + w:=MaxLen;S.Write(w, SizeOf(w)); { Read max length } + w:=CurPos;S.Write(w, SizeOf(w)); { Read cursor position } + w:=FirstPos;S.Write(w, SizeOf(w)); { Read first position } + w:=SelStart;S.Write(w, SizeOf(w)); { Read selected start } + w:=SelEnd;S.Write(w, SizeOf(w)); { Read selected end } S.WriteStr(Data); { Write the data } S.Put(Validator); { Write any validator } END; @@ -1808,9 +1810,9 @@ CONSTRUCTOR TButton.Load (Var S: TStream); BEGIN Inherited Load(S); { Call ancestor } Title := S.ReadStr; { Read title } - S.Read(Command, 2); { Read command } - S.Read(Flags, 1); { Read flags } - S.Read(AmDefault, 1); { Read if default } + S.Read(Command, SizeOf(Command)); { Read command } + S.Read(Flags, SizeOf(Flags)); { Read flags } + S.Read(AmDefault, SizeOf(AmDefault)); { Read if default } If NOT CommandEnabled(Command) Then { Check command state } State := State OR sfDisabled Else { Command disabled } State := State AND NOT sfDisabled; { Command enabled } @@ -1978,9 +1980,9 @@ PROCEDURE TButton.Store (Var S: TStream); BEGIN TView.Store(S); { Implict TView.Store } S.WriteStr(Title); { Store title string } - S.Write(Command, 2); { Store command } - S.Write(Flags, 1); { Store flags } - S.Write(AmDefault, 1); { Store default flag } + S.Write(Command, SizeOf(Command)); { Store command } + S.Write(Flags, SizeOf(Flags)); { Store flags } + S.Write(AmDefault, SizeOf(AmDefault)); { Store default flag } END; {--TButton------------------------------------------------------------------} @@ -2097,17 +2099,25 @@ END; { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 06Oct99 LdB } {---------------------------------------------------------------------------} CONSTRUCTOR TCluster.Load (Var S: TStream); +VAR w: word; BEGIN Inherited Load(S); { Call ancestor } - S.Read(Value, 4); { Read value } - S.Read(Sel, 2); { Read select item } - If ((Options AND ofVersion) >= ofVersion20) { Version 2 TV view } - Then S.Read(EnableMask, 4) Else Begin { Read enable masks } + If ((Options AND ofVersion) >= ofVersion20) Then { Version 2 TV view } + Begin + S.Read(Value, SizeOf(Value)); { Read value } + S.Read(Sel, Sizeof(Sel)); { Read select item } + S.Read(EnableMask, SizeOf(EnableMask)) { Read enable masks } + End + Else + Begin + w:=Value; + S.Read(w, SizeOf(w)); Value:=w; { Read value } + S.Read(Sel, SizeOf(Sel)); { Read select item } EnableMask := $FFFFFFFF; { Enable all masks } Options := Options OR ofVersion20; { Set version 2 mask } End; If (Options AND ofGFVModeView <> 0) Then { GFV mode view check } - S.Read(Id, 2); { Read view id } + S.Read(Id, Sizeof(Id)); { Read view id } Strings.Load(S); { Load string data } SetButtonState(0, True); { Set button state } END; @@ -2312,15 +2322,18 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 03Jun98 LdB } {---------------------------------------------------------------------------} PROCEDURE TCluster.Store (Var S: TStream); +var + w : word; BEGIN TView.Store(S); { TView.Store called } If ((Options AND ofVersion) >= ofVersion20) { Version 2 TV view } Then Begin - S.Write(Value, SizeOf(LongInt)); { Write value } + S.Write(Value, SizeOf(Value)); { Write value } S.Write(Sel, SizeOf(Sel)); { Write select item } S.Write(EnableMask, SizeOf(EnableMask)); { Write enable masks } End Else Begin - S.Write(Value, SizeOf(Word)); { Write value } + w:=Value; + S.Write(w, SizeOf(Word)); { Write value } S.Write(Sel, SizeOf(Sel)); { Write select item } End; If (Options AND ofGFVModeView <> 0) Then { GFV mode view check } @@ -2985,9 +2998,10 @@ END; { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB } {---------------------------------------------------------------------------} CONSTRUCTOR TParamText.Load (Var S: TStream); +VAR w: Word; BEGIN Inherited Load(S); { Call ancestor } - S.Read(ParamCount, 2); { Read parameter count } + S.Read(w, SizeOf(w)); ParamCount:=w; { Read parameter count } END; {--TParamText---------------------------------------------------------------} @@ -3019,9 +3033,10 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28Apr98 LdB } {---------------------------------------------------------------------------} PROCEDURE TParamText.Store (Var S: TStream); +VAR w: Word; BEGIN TStaticText.Store(S); { Statictext store } - S.Write(ParamCount, 2); { Store param count } + w:=ParamCount;S.Write(w, SizeOf(w)); { Store param count } END; {--TParamText---------------------------------------------------------------} @@ -3272,7 +3287,7 @@ CONSTRUCTOR THistory.Load (Var S: TStream); BEGIN Inherited Load(S); { Call ancestor } GetPeerViewPtr(S, Link); { Load link view } - S.Read(HistoryId, 2); { Read history id } + S.Read(HistoryId, SizeOf(HistoryId)); { Read history id } END; {--THistory-----------------------------------------------------------------} @@ -3318,7 +3333,7 @@ PROCEDURE THistory.Store (Var S: TStream); BEGIN TView.Store(S); { TView.Store called } PutPeerViewPtr(S, Link); { Store link view } - S.Write(HistoryId, 2); { Store history id } + S.Write(HistoryId, SizeOf(HistoryId)); { Store history id } END; {--THistory-----------------------------------------------------------------} @@ -4021,7 +4036,8 @@ constructor TListDlg.Load (var S : TStream); begin if not TDialog.Load(S) then Fail; - S.Read(NewCommand,SizeOf(NewCommand) + SizeOf(EditCommand)); + S.Read(NewCommand,SizeOf(NewCommand)); + S.Read(EditCommand,SizeOf(EditCommand)); GetSubViewPtr(S,ListBox); end; @@ -4075,7 +4091,8 @@ end; procedure TListDlg.Store (var S : TStream); begin TDialog.Store(S); - S.Write(NewCommand,SizeOf(NewCommand) + SizeOf(EditCommand)); + S.Write(NewCommand,SizeOf(NewCommand)); + S.Write(EditCommand,SizeOf(EditCommand)); PutSubViewPtr(S,ListBox); end; @@ -4208,7 +4225,10 @@ END; END. { $Log$ - Revision 1.20 2002-09-22 19:42:23 hajny + Revision 1.21 2002-10-17 11:24:16 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.20 2002/09/22 19:42:23 hajny + FPC/2 support added Revision 1.19 2002/09/09 08:14:47 pierre diff --git a/fvision/editors.pas b/fvision/editors.pas index a2e78610a9..1fe6a4bd9d 100644 --- a/fvision/editors.pas +++ b/fvision/editors.pas @@ -1306,8 +1306,8 @@ begin GetPeerViewPtr (S, HScrollBar); GetPeerViewPtr (S, VScrollBar); GetPeerViewPtr (S, Indicator); - S.Read (BufSize, SizeOf (Sw_Word)); - S.Read (CanUndo, SizeOf (Boolean)); + S.Read (BufSize, SizeOf (BufSize)); + S.Read (CanUndo, SizeOf (CanUndo)); S.Read (AutoIndent, SizeOf (AutoIndent)); S.Read (Line_Number, SizeOf (Line_Number)); S.Read (Place_Marker, SizeOf (Place_Marker)); @@ -3117,8 +3117,8 @@ begin PutPeerViewPtr (S, HScrollBar); PutPeerViewPtr (S, VScrollBar); PutPeerViewPtr (S, Indicator); - S.Write (BufSize, SizeOf (Sw_Word)); - S.Write (Canundo, SizeOf (Boolean)); + S.Write (BufSize, SizeOf (BufSize)); + S.Write (Canundo, SizeOf (Canundo)); S.Write (AutoIndent, SizeOf (AutoIndent)); S.Write (Line_Number, SizeOf (Line_Number)); S.Write (Place_Marker, SizeOf (Place_Marker)); @@ -3315,7 +3315,7 @@ VAR Length : Sw_Word; begin Inherited Load (S); - S.Read (Length, SizeOf (Sw_Word)); + S.Read (Length, SizeOf (Length)); if IsValid then begin S.Read (Buffer^[BufSize - Length], Length); @@ -3370,7 +3370,7 @@ end; { TMemo.SetData } procedure TMemo.Store (var S : Objects.TStream); begin Inherited Store (S); - S.Write (BufLen, SizeOf (Sw_Word)); + S.Write (BufLen, SizeOf (BufLen)); S.Write (Buffer^, CurPtr); S.Write (Buffer^[CurPtr + GapLen], BufLen - CurPtr); end; { TMemo.Store } @@ -3402,13 +3402,13 @@ VAR begin Inherited Load (S); BufSize := 0; - S.Read (FileName[0], SizeOf (Char)); + S.Read (FileName[0], SizeOf (Byte)); S.Read (Filename[1], Length (FileName)); if IsValid then IsValid := LoadFile; - S.Read (SStart, SizeOf (Sw_Word)); - S.Read (SEnd, SizeOf (Sw_Word)); - S.Read (Curs, SizeOf (Sw_Word)); + S.Read (SStart, SizeOf (SStart)); + S.Read (SEnd, SizeOf (SEnd)); + S.Read (Curs, SizeOf (Curs)); if IsValid and (SEnd <= BufLen) then begin SetSelect (SStart, SEnd, Curs = SStart); @@ -3580,7 +3580,9 @@ procedure TFileEditor.Store (var S : Objects.TStream); begin Inherited Store (S); S.Write (FileName, Length (FileName) + 1); - S.Write (SelStart, SizeOf (Sw_Word) * 3); + S.Write (SelStart, SizeOf (SelStart)); + S.Write (SelEnd, SizeOf (SelEnd)); + S.Write (CurPtr, SizeOf (CurPtr)); end; { TFileEditor.Store } diff --git a/fvision/histlist.pas b/fvision/histlist.pas index 810dbc5cfc..2bb1a033a6 100644 --- a/fvision/histlist.pas +++ b/fvision/histlist.pas @@ -395,7 +395,7 @@ end; PROCEDURE LoadHistory (Var S: TStream); VAR Size: sw_Word; BEGIN - S.Read(Size, sizeof(sw_Word)); { Read history size } + S.Read(Size, sizeof(Size)); { Read history size } If (HistoryBlock <> Nil) Then Begin { History initialized } If (Size <= HistorySize) Then Begin S.Read(HistoryBlock^, Size); { Read the history } @@ -412,7 +412,7 @@ VAR Size: sw_Word; BEGIN If (HistoryBlock = Nil) Then Size := 0 Else { No history data } Size := HistoryUsed; { Size of history data } - S.Write(Size, sizeof(sw_Word)); { Write history size } + S.Write(Size, sizeof(Size)); { Write history size } If (Size > 0) Then S.Write(HistoryBlock^, Size); { Write history data } END; @@ -420,7 +420,10 @@ END. { $Log$ - Revision 1.9 2002-09-07 15:06:37 peter + Revision 1.10 2002-10-17 11:24:16 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.9 2002/09/07 15:06:37 peter * old logs removed and tabs fixed Revision 1.8 2002/06/10 11:51:08 pierre diff --git a/fvision/inplong.pas b/fvision/inplong.pas index 54a0b0eaeb..fbf312ce84 100644 --- a/fvision/inplong.pas +++ b/fvision/inplong.pas @@ -129,14 +129,18 @@ end; constructor TInputLong.Load(var S : TStream); begin TInputLine.Load(S); -S.Read(ILOptions, Sizeof(ILOptions)+Sizeof(LLim)+Sizeof(ULim)); +S.Read(ILOptions, Sizeof(ILOptions)); +S.Read(LLim, Sizeof(LLim)); +S.Read(ULim, Sizeof(ULim)); end; {-------------------TInputLong.Store} procedure TInputLong.Store(var S : TStream); begin TInputLine.Store(S); -S.Write(ILOptions, Sizeof(ILOptions)+Sizeof(LLim)+Sizeof(ULim)); +S.Write(ILOptions, Sizeof(ILOptions)); +S.Write(LLim, Sizeof(LLim)); +S.Write(ULim, Sizeof(ULim)); end; {-------------------TInputLong.DataSize} diff --git a/fvision/menus.pas b/fvision/menus.pas index 137fb581f0..eaa4bf1cfc 100644 --- a/fvision/menus.pas +++ b/fvision/menus.pas @@ -451,7 +451,7 @@ CONSTRUCTOR TMenuView.Load (Var S: TStream); New(Menu); { Create new menu } Last := @Menu^.Items; { Start on first item } Item := Nil; { Clear pointer } - S.Read(Tok, 1); { Read token } + S.Read(Tok, SizeOf(Tok)); { Read token } While (Tok <> 0) Do Begin New(Item); { Create new item } Last^ := Item; { First part of chain } @@ -459,10 +459,10 @@ CONSTRUCTOR TMenuView.Load (Var S: TStream); Last := @Item^.Next; { Complete chain } With Item^ Do Begin Name := S.ReadStr; { Read menu name } - S.Read(Command, 2); { Menu item command } - S.Read(Disabled, 1); { Menu item state } - S.Read(KeyCode, 2); { Menu item keycode } - S.Read(HelpCtx, 2); { Menu item help ctx } + S.Read(Command, SizeOf(Command)); { Menu item command } + S.Read(Disabled, SizeOf(Disabled)); { Menu item state } + S.Read(KeyCode, SizeOf(KeyCode)); { Menu item keycode } + S.Read(HelpCtx, SizeOf(HelpCtx)); { Menu item help ctx } If (Name <> Nil) Then If Command = 0 Then {$ifdef PPC_FPC} @@ -473,7 +473,7 @@ CONSTRUCTOR TMenuView.Load (Var S: TStream); Else Param := S.ReadStr; { Read param string } End; End; - S.Read(Tok, 1); { Read token } + S.Read(Tok, SizeOf(Tok)); { Read token } End; Last^ := Nil; { List complete } Menu^.Default := Menu^.Items; { Set menu default } @@ -796,12 +796,12 @@ PROCEDURE TMenuView.Store (Var S: TStream); Item := Menu^.Items; { Start first item } While (Item <> Nil) Do Begin With Item^ Do Begin - S.Write(Tok, 1); { Write tok value } + S.Write(Tok, SizeOf(Tok)); { Write tok value } S.WriteStr(Name); { Write item name } - S.Write(Command, 2); { Menu item command } - S.Write(Disabled, 1); { Menu item state } - S.Write(KeyCode, 2); { Menu item keycode } - S.Write(HelpCtx, 2); { Menu item help ctx } + S.Write(Command, SizeOf(Command)); { Menu item command } + S.Write(Disabled, SizeOf(Disabled)); { Menu item state } + S.Write(KeyCode, SizeOf(KeyCode)); { Menu item keycode } + S.Write(HelpCtx, SizeOf(HelpCtx)); { Menu item help ctx } If (Name <> Nil) Then If Command = 0 Then DoStoreMenu(SubMenu) Else S.WriteStr(Param); { Write parameter } @@ -809,7 +809,7 @@ PROCEDURE TMenuView.Store (Var S: TStream); Item := Item^.Next; { Next item } End; Tok := 0; { Clear tok count } - S.Write(Tok, 1); { Write tok value } + S.Write(Tok, SizeOf(Tok)); { Write tok value } END; BEGIN @@ -1296,15 +1296,15 @@ CONSTRUCTOR TStatusLine.Load (Var S: TStream); BEGIN Cur := Nil; { Preset nil } Last := @First; { Start on first item } - S.Read(Count, 2); { Read count } + S.Read(Count, SizeOf(Count)); { Read count } While (Count > 0) Do Begin New(Cur); { New status item } Last^ := Cur; { First chain part } If (Cur <> Nil) Then Begin { Check pointer valid } Last := @Cur^.Next; { Chain complete } Cur^.Text := S.ReadStr; { Read item text } - S.Read(Cur^.KeyCode, 2); { Keycode of item } - S.Read(Cur^.Command, 2); { Command of item } + S.Read(Cur^.KeyCode, SizeOf(Cur^.KeyCode)); { Keycode of item } + S.Read(Cur^.Command, SizeOf(Cur^.Command)); { Command of item } End; Dec(Count); { One item loaded } End; @@ -1316,14 +1316,14 @@ CONSTRUCTOR TStatusLine.Load (Var S: TStream); VAR Count: Integer; Cur, First: PStatusDef; Last: ^PStatusDef; BEGIN Last := @First; { Start on first } - S.Read(Count, 2); { Read item count } + S.Read(Count, SizeOf(Count)); { Read item count } While (Count > 0) Do Begin New(Cur); { New status def } Last^ := Cur; { First part of chain } If (Cur <> Nil) Then Begin { Check pointer valid } Last := @Cur^.Next; { Chain complete } - S.Read(Cur^.Min, 2); { Read min data } - S.Read(Cur^.Max, 2); { Read max data } + S.Read(Cur^.Min, SizeOf(Cur^.Min)); { Read min data } + S.Read(Cur^.Max, SizeOf(Cur^.Max)); { Read max data } Cur^.Items := DoLoadStatusItems; { Set pointer } End; Dec(Count); { One item loaded } @@ -1425,11 +1425,11 @@ PROCEDURE TStatusLine.Store (Var S: TStream); Inc(Count); { Count items } T := T^.Next; { Next item } End; - S.Write(Count, 2); { Write item count } + S.Write(Count, SizeOf(Count)); { Write item count } While (Cur <> Nil) Do Begin S.WriteStr(Cur^.Text); { Store item text } - S.Write(Cur^.KeyCode, 2); { Keycode of item } - S.Write(Cur^.Command, 2); { Command of item } + S.Write(Cur^.KeyCode, SizeOf(Cur^.KeyCode)); { Keycode of item } + S.Write(Cur^.Command, SizeOf(Cur^.Command)); { Command of item } Cur := Cur^.Next; { Move to next item } End; END; @@ -1759,7 +1759,10 @@ END; END. { $Log$ - Revision 1.15 2002-09-07 15:06:37 peter + Revision 1.16 2002-10-17 11:24:17 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.15 2002/09/07 15:06:37 peter * old logs removed and tabs fixed Revision 1.14 2002/06/10 18:41:26 pierre diff --git a/fvision/stddlg.pas b/fvision/stddlg.pas index 727aa0a8c5..8defc5e55a 100644 --- a/fvision/stddlg.pas +++ b/fvision/stddlg.pas @@ -1378,7 +1378,7 @@ constructor TFileDialog.Load(var S: TStream); begin if not TDialog.Load(S) then Fail; - S.Read(WildCard, SizeOf(TWildStr)); + S.Read(WildCard, SizeOf(WildCard)); if (S.Status <> stOk) then begin TDialog.Done; @@ -1501,7 +1501,7 @@ end; procedure TFileDialog.Store(var S: TStream); begin TDialog.Store(S); - S.Write(WildCard, SizeOf(TWildStr)); + S.Write(WildCard, SizeOf(WildCard)); PutSubViewPtr(S, FileName); PutSubViewPtr(S, FileList); PutSubViewPtr(S, FileHistory); diff --git a/fvision/validate.pas b/fvision/validate.pas index 01eb34f921..5d398a760f 100644 --- a/fvision/validate.pas +++ b/fvision/validate.pas @@ -377,7 +377,7 @@ END; CONSTRUCTOR TValidator.Load (Var S:TStream); BEGIN Inherited Init; { Call ancestor } - S.Read(Options, 2); { Read option masks } + S.Read(Options, SizeOf(Options)); { Read option masks } END; {--TValidator---------------------------------------------------------------} @@ -427,7 +427,7 @@ END; {---------------------------------------------------------------------------} PROCEDURE TValidator.Store (Var S: TStream); BEGIN - S.Write(Options, 2); { Write options } + S.Write(Options, SizeOf(Options)); { Write options } END; {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} @@ -821,7 +821,7 @@ END; CONSTRUCTOR TFilterValidator.Load (Var S: TStream); BEGIN Inherited Load(S); { Call ancestor } - S.Read(ValidChars, SizeOf(TCharSet)); { Read valid char set } + S.Read(ValidChars, SizeOf(ValidChars)); { Read valid char set } END; {--TFilterValidator---------------------------------------------------------} @@ -863,7 +863,7 @@ END; PROCEDURE TFilterValidator.Store (Var S: TStream); BEGIN TValidator.Store(S); { TValidator.Store call } - S.Write(ValidChars, SizeOf(TCharSet)); { Write valid char set } + S.Write(ValidChars, SizeOf(ValidChars)); { Write valid char set } END; {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} @@ -888,8 +888,8 @@ END; CONSTRUCTOR TRangeValidator.Load (Var S: TStream); BEGIN Inherited Load(S); { Call ancestor } - S.Read(Min, 4); { Read min value } - S.Read(Max, 4); { Read max value } + S.Read(Min, SizeOf(Min)); { Read min value } + S.Read(Max, SizeOf(Max)); { Read max value } END; {--TRangeValidator----------------------------------------------------------} @@ -943,8 +943,8 @@ END; PROCEDURE TRangeValidator.Store (Var S: TStream); BEGIN TFilterValidator.Store(S); { TFilterValidator.Store } - S.Write(Min, 4); { Write min value } - S.Write(Max, 4); { Write max value } + S.Write(Min, SizeOf(Min)); { Write min value } + S.Write(Max, SizeOf(Max)); { Write max value } END; {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++} @@ -1059,7 +1059,10 @@ END. { $Log$ - Revision 1.7 2002-09-09 08:14:48 pierre + Revision 1.8 2002-10-17 11:24:17 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.7 2002/09/09 08:14:48 pierre * remove virtual modifer from store methods Revision 1.6 2002/09/07 15:06:38 peter diff --git a/fvision/views.pas b/fvision/views.pas index 3606e85d14..750754efec 100644 --- a/fvision/views.pas +++ b/fvision/views.pas @@ -981,28 +981,29 @@ END; { supported but it should work as per original TV code. } {---------------------------------------------------------------------------} CONSTRUCTOR TView.Load (Var S: TStream); +VAR i: Integer; BEGIN Inherited Init; { Call ancestor } - S.Read(Origin.X, 2); { Read origin x value } - S.Read(Origin.Y, 2); { Read origin y value } - S.Read(Size.X, 2); { Read view x size } - S.Read(Size.Y, 2); { Read view y size } - S.Read(Cursor.X, 2); { Read cursor x size } - S.Read(Cursor.Y, 2); { Read cursor y size } - S.Read(GrowMode, 1); { Read growmode flags } - S.Read(DragMode, 1); { Read dragmode flags } - S.Read(HelpCtx, 2); { Read help context } - S.Read(State, 2); { Read state masks } - S.Read(Options, 2); { Read options masks } - S.Read(Eventmask, 2); { Read event masks } + S.Read(i, SizeOf(i)); Origin.X:=i; { Read origin x value } + S.Read(i, SizeOf(i)); Origin.Y:=i; { Read origin y value } + S.Read(i, SizeOf(i)); Size.X:=i; { Read view x size } + S.Read(i, SizeOf(i)); Size.Y:=i; { Read view y size } + S.Read(i, SizeOf(i)); Cursor.X:=i; { Read cursor x size } + S.Read(i, SizeOf(i)); Cursor.Y:=i; { Read cursor y size } + S.Read(GrowMode, SizeOf(GrowMode)); { Read growmode flags } + S.Read(DragMode, SizeOf(DragMode)); { Read dragmode flags } + S.Read(HelpCtx, SizeOf(HelpCtx)); { Read help context } + S.Read(State, SizeOf(State)); { Read state masks } + S.Read(Options, SizeOf(Options)); { Read options masks } + S.Read(Eventmask, SizeOf(Eventmask)); { Read event masks } If (Options AND ofGFVModeView <> 0) Then Begin { STREAM HAS GFV TVIEW } - S.Read(GOptions, 2); { Read new option masks } - S.Read(TabMask, 1); { Read new tab masks } - S.Read(RawOrigin.X, 2); { Read raw x origin point } - S.Read(RawOrigin.Y, 2); { Read raw y origin point } - S.Read(RawSize.X, 2); { Read raw x size } - S.Read(RawSize.Y, 2); { Read raw y size } - S.Read(ColourOfs, 2); { Read palette offset } + S.Read(GOptions, SizeOf(GOptions)); { Read new option masks } + S.Read(TabMask, SizeOf(TabMask)); { Read new tab masks } + S.Read(i, SizeOf(i)); RawOrigin.X:=i; { Read raw x origin point } + S.Read(i, SizeOf(i)); RawOrigin.Y:=i; { Read raw y origin point } + S.Read(i, SizeOf(i)); RawSize.X:=i; { Read raw x size } + S.Read(i, SizeOf(i)); RawSize.Y:=i; { Read raw y size } + S.Read(i, SizeOf(i)); ColourOfs:=i; { Read palette offset } End Else Begin { STREAM HAS OLD TView } RawOrigin.X := Origin.X * FontWidth; { Set x origin pt } RawOrigin.Y := Origin.Y * FontHeight; { Set y origin pt } @@ -2035,30 +2036,31 @@ END; {---------------------------------------------------------------------------} PROCEDURE TView.Store (Var S: TStream); VAR SaveState: Word; + i: integer; BEGIN SaveState := State; { Hold current state } State := State AND NOT (sfActive OR sfSelected OR sfFocused OR sfExposed); { Clear flags } - S.Write(Origin.X, 2); { Write view x origin } - S.Write(Origin.Y, 2); { Write view y origin } - S.Write(Size.X, 2); { Write view x size } - S.Write(Size.Y, 2); { Write view y size } - S.Write(Cursor.X, 2); { Write cursor x size } - S.Write(Cursor.Y, 2); { Write cursor y size } - S.Write(GrowMode, 1); { Write growmode flags } - S.Write(DragMode, 1); { Write dragmode flags } - S.Write(HelpCtx, 2); { Write help context } - S.Write(State, 2); { Write state masks } - S.Write(Options, 2); { Write options masks } - S.Write(Eventmask, 2); { Write event masks } + i:=Origin.X;S.Write(i, SizeOf(i)); { Write view x origin } + i:=Origin.Y;S.Write(i, SizeOf(i)); { Write view y origin } + i:=Size.X;S.Write(i, SizeOf(i)); { Write view x size } + i:=Size.Y;S.Write(i, SizeOf(i)); { Write view y size } + i:=Cursor.X;S.Write(i, SizeOf(i)); { Write cursor x size } + i:=Cursor.Y;S.Write(i, SizeOf(i)); { Write cursor y size } + S.Write(GrowMode, SizeOf(GrowMode)); { Write growmode flags } + S.Write(DragMode, SizeOf(DragMode)); { Write dragmode flags } + S.Write(HelpCtx, SizeOf(HelpCtx)); { Write help context } + S.Write(State, SizeOf(State)); { Write state masks } + S.Write(Options, SizeOf(Options)); { Write options masks } + S.Write(Eventmask, SizeOf(Eventmask)); { Write event masks } If (Options AND ofGFVModeView <> 0) Then Begin { GFV GRAPHICAL TVIEW } - S.Write(GOptions, 2); { Write new option masks } - S.Write(TabMask, 1); { Write new tab masks } - S.Write(RawOrigin.X, 2); { Write raw origin x point } - S.Write(RawOrigin.Y, 2); { Write raw origin y point } - S.Write(RawSize.X, 2); { Write raw x size } - S.Write(RawSize.Y, 2); { Write raw y size } - S.Write(ColourOfs, 2); { Write Palette offset } + S.Write(GOptions, SizeOf(GOptions)); { Write new option masks } + S.Write(TabMask, SizeOf(TabMask)); { Write new tab masks } + i:=RawOrigin.X;S.Write(i, SizeOf(i)); { Write raw origin x point } + i:=RawOrigin.Y;S.Write(i, SizeOf(i)); { Write raw origin y point } + i:=RawSize.X;S.Write(i, SizeOf(i)); { Write raw x size } + i:=RawSize.Y;S.Write(i, SizeOf(i)); { Write raw y size } + i:=ColourOfs;S.Write(i, SizeOf(i)); { Write Palette offset } End; State := SaveState; { Reset state masks } END; @@ -2292,10 +2294,10 @@ END; { GetPeerViewPtr -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB } {---------------------------------------------------------------------------} PROCEDURE TView.GetPeerViewPtr (Var S: TStream; Var P); -VAR Index: Sw_Integer; +VAR Index: Integer; BEGIN Index := 0; { Zero index value } - S.Read(Index, 2); { Read view index } + S.Read(Index, SizeOf(Index)); { Read view index } If (Index = 0) OR (OwnerGroup = Nil) Then { Check for peer views } Pointer(P) := Nil Else Begin { Return nil } Pointer(P) := FixupList^[Index]; { New view ptr } @@ -2307,11 +2309,11 @@ END; { PutPeerViewPtr -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB } {---------------------------------------------------------------------------} PROCEDURE TView.PutPeerViewPtr (Var S: TStream; P: PView); -VAR Index: Sw_Integer; +VAR Index: Integer; BEGIN If (P = Nil) OR (OwnerGroup = Nil) Then Index := 0 { Return zero index } Else Index := OwnerGroup^.IndexOf(P); { Return view index } - S.Write(Index, 2); { Write the index } + S.Write(Index, SizeOf(Index)); { Write the index } END; {--TView--------------------------------------------------------------------} @@ -2381,7 +2383,9 @@ END; { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 15Sep97 LdB } {---------------------------------------------------------------------------} CONSTRUCTOR TGroup.Load (Var S: TStream); -VAR I, Count: Sw_Word; P, Q: ^Pointer; V: PView; OwnerSave: PGroup; +VAR I: Sw_Word; + Count: Word; + P, Q: ^Pointer; V: PView; OwnerSave: PGroup; FixupSave: PFixupList; BEGIN Inherited Load(S); { Call ancestor } @@ -2390,7 +2394,7 @@ BEGIN OwnerGroup := @Self; { We are current group } FixupSave := FixupList; { Save current list } Count := 0; { Zero count value } - S.Read(Count, 2); { Read entry count } + S.Read(Count, SizeOf(Count)); { Read entry count } If (MaxAvail >= Count*SizeOf(Pointer)) Then Begin { Memory available } GetMem(FixupList, Count*SizeOf(Pointer)); { List size needed } FillChar(FixUpList^, Count*SizeOf(Pointer), #0); { Zero all entries } @@ -2970,7 +2974,7 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 30Mar98 LdB } {---------------------------------------------------------------------------} PROCEDURE TGroup.Store (Var S: TStream); -VAR Count: Sw_Integer; OwnerSave: PGroup; +VAR Count: Word; OwnerSave: PGroup; PROCEDURE DoPut (P: PView); {$IFNDEF PPC_FPC}FAR;{$ENDIF} BEGIN @@ -2982,7 +2986,7 @@ BEGIN OwnerSave := OwnerGroup; { Save ownergroup } OwnerGroup := @Self; { Set as owner group } Count := IndexOf(Last); { Subview count } - S.Write(Count, 2); { Write the count } + S.Write(Count, SizeOf(Count)); { Write the count } ForEach(@DoPut); { Put each in stream } PutSubViewPtr(S, Current); { Current on stream } OwnerGroup := OwnerSave; { Restore ownergroup } @@ -3072,10 +3076,10 @@ END; { GetSubViewPtr -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 20May98 LdB } {---------------------------------------------------------------------------} PROCEDURE TGroup.GetSubViewPtr (Var S: TStream; Var P); -VAR Index, I: Sw_Word; Q: PView; +VAR Index, I: Word; Q: PView; BEGIN Index := 0; { Zero index value } - S.Read(Index, 2); { Read view index } + S.Read(Index, SizeOf(Index)); { Read view index } If (Index > 0) Then Begin { Valid index } Q := Last; { Start on last } For I := 1 To Index Do Q := Q^.Next; { Loop for count } @@ -3091,7 +3095,7 @@ VAR Index: Sw_Word; BEGIN If (P = Nil) Then Index := 0 Else { Nil view, Index = 0 } Index := IndexOf(P); { Calc view index } - S.Write(Index, 2); { Write the index } + S.Write(Index, SizeOf(Index)); { Write the index } END; @@ -3287,16 +3291,19 @@ END; { scrollbar id set to zero. } {---------------------------------------------------------------------------} CONSTRUCTOR TScrollBar.Load (Var S: TStream); +VAR i: Integer; BEGIN Inherited Load(S); { Call ancestor } - S.Read(Value, 2); { Read current value } - S.Read(Min , 2); { Read min value } - S.Read(Max, 2); { Read max value } - S.Read(PgStep, 2); { Read page step size } - S.Read(ArStep, 2); { Read arrow step size } + S.Read(i, SizeOf(i)); Value:=i; { Read current value } + S.Read(i, SizeOf(i)); Min:=i; { Read min value } + S.Read(i, SizeOf(i)); Max:=i; { Read max value } + S.Read(i, SizeOf(i)); PgStep:=i; { Read page step size } + S.Read(i, SizeOf(i)); ArStep:=i; { Read arrow step size } S.Read(Chars, SizeOf(Chars)); { Read scroll chars } If (Options AND ofGFVModeView <> 0) Then { GFV mode view check } - S.Read(Id, 2); { Read id } + begin + S.Read(i, SizeOf(i)); Id:=i; { Read id } + end; END; {--TScrollBar---------------------------------------------------------------} @@ -3452,16 +3459,19 @@ END; { routine and resetting the ofGrafVersion flag after the call. } {---------------------------------------------------------------------------} PROCEDURE TScrollBar.Store (Var S: TStream); +VAR i: Integer; BEGIN TView.Store(S); { TView.Store called } - S.Write(Value, 2); { Write current value } - S.Write(Min, 2); { Write min value } - S.Write(Max, 2); { Write max value } - S.Write(PgStep, 2); { Write page step size } - S.Write(ArStep, 2); { Write arrow step size } + i:=Value;S.Write(i, SizeOf(i)); { Write current value } + i:=Min;S.Write(i, SizeOf(i)); { Write min value } + i:=Max;S.Write(i, SizeOf(i)); { Write max value } + i:=PgStep;S.Write(i, SizeOf(i)); { Write page step size } + i:=ArStep;S.Write(i, SizeOf(i)); { Write arrow step size } S.Write(Chars, SizeOf(Chars)); { Write scroll chars } If (Options AND ofGFVModeView <> 0) Then { GFV mode view check } - S.Write(Id, 2); { Write scrollbar id } + begin + i:=Id;S.Write(i, SizeOf(i)); { Write scrollbar id } + end; END; {--TScrollBar---------------------------------------------------------------} @@ -3731,14 +3741,15 @@ END; { as the new graphical scroller views. } {---------------------------------------------------------------------------} CONSTRUCTOR TScroller.Load (Var S: TStream); +VAR i: Integer; BEGIN Inherited Load(S); { Call ancestor } GetPeerViewPtr(S, HScrollBar); { Load horz scrollbar } GetPeerViewPtr(S, VScrollBar); { Load vert scrollbar } - S.Read(Delta.X, 2); { Read delta x value } - S.Read(Delta.Y, 2); { Read delta y value } - S.Read(Limit.X, 2); { Read limit x value } - S.Read(Limit.Y, 2); { Read limit y value } + S.Read(i, SizeOf(i)); Delta.X:=i; { Read delta x value } + S.Read(i, SizeOf(i)); Delta.Y:=i; { Read delta y value } + S.Read(i, SizeOf(i)); Limit.X:=i; { Read limit x value } + S.Read(i, SizeOf(i)); Limit.Y:=i; { Read limit y value } END; {--TScroller----------------------------------------------------------------} @@ -3789,14 +3800,15 @@ END; { The scroller is saved to the stream compatable with the old TV object. } {---------------------------------------------------------------------------} PROCEDURE TScroller.Store (Var S: TStream); +VAR i: Integer; BEGIN TView.Store(S); { Call TView explicitly } PutPeerViewPtr(S, HScrollBar); { Store horz bar } PutPeerViewPtr(S, VScrollBar); { Store vert bar } - S.Write(Delta.X, 2); { Write delta x value } - S.Write(Delta.Y, 2); { Write delta y value } - S.Write(Limit.X, 2); { Write limit x value } - S.Write(Limit.Y, 2); { Write limit y value } + i:=Delta.X;S.Write(i, SizeOf(i)); { Write delta x value } + i:=Delta.Y;S.Write(i, SizeOf(i)); { Write delta y value } + i:=Limit.X;S.Write(i, SizeOf(i)); { Write limit x value } + i:=Limit.Y;S.Write(i, SizeOf(i)); { Write limit y value } END; {--TScroller----------------------------------------------------------------} @@ -3862,14 +3874,15 @@ END; { Load -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 28May98 LdB } {---------------------------------------------------------------------------} CONSTRUCTOR TListViewer.Load (Var S: TStream); +VAR w: Word; BEGIN Inherited Load(S); { Call ancestor } GetPeerViewPtr(S, HScrollBar); { Get horz scrollbar } GetPeerViewPtr(S, VScrollBar); { Get vert scrollbar } - S.Read(NumCols, 2); { Read column number } - S.Read(TopItem, 2); { Read top most item } - S.Read(Focused, 2); { Read focused item } - S.Read(Range, 2); { Read listview range } + S.Read(w, SizeOf(w)); NumCols:=w; { Read column number } + S.Read(w, SizeOf(w)); TopItem:=w; { Read top most item } + S.Read(w, SizeOf(w)); Focused:=w; { Read focused item } + S.Read(w, SizeOf(w)); Range:=w; { Read listview range } END; {--TListViewer--------------------------------------------------------------} @@ -4131,14 +4144,15 @@ END; { Store -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 26Jul99 LdB } {---------------------------------------------------------------------------} PROCEDURE TListViewer.Store (Var S: TStream); +VAR w: Word; BEGIN TView.Store(S); { Call TView explicitly } PutPeerViewPtr(S, HScrollBar); { Put horz scrollbar } PutPeerViewPtr(S, VScrollBar); { Put vert scrollbar } - S.Write(NumCols, 2); { Write column number } - S.Write(TopItem, 2); { Write top most item } - S.Write(Focused, 2); { Write focused item } - S.Write(Range, 2); { Write listview range } + w:=NumCols;S.Write(w, SizeOf(w)); { Write column number } + w:=TopItem;S.Write(w, SizeOf(w)); { Write top most item } + w:=Focused;S.Write(w, SizeOf(w)); { Write focused item } + w:=Range;S.Write(w, SizeOf(w)); { Write listview range } END; {--TListViewer--------------------------------------------------------------} @@ -4315,15 +4329,16 @@ END; { although a frame view is read for compatability it is disposed of. } {---------------------------------------------------------------------------} CONSTRUCTOR TWindow.Load (Var S: TStream); +VAR I: Integer; BEGIN Inherited Load(S); { Call ancestor } - S.Read(Flags, 1); { Read window flags } - S.Read(Number, 2); { Read window number } - S.Read(Palette, 2); { Read window palette } - S.Read(ZoomRect.A.X, 2); { Read zoom area x1 } - S.Read(ZoomRect.A.Y, 2); { Read zoom area y1 } - S.Read(ZoomRect.B.X, 2); { Read zoom area x2 } - S.Read(ZoomRect.B.Y, 2); { Read zoom area y2 } + S.Read(Flags, SizeOf(Flags)); { Read window flags } + S.Read(i, SizeOf(i)); Number:=i; { Read window number } + S.Read(i, SizeOf(i)); Palette:=i; { Read window palette } + S.Read(i, SizeOf(i)); ZoomRect.A.X:=i; { Read zoom area x1 } + S.Read(i, SizeOf(i)); ZoomRect.A.Y:=i; { Read zoom area y1 } + S.Read(i, SizeOf(i)); ZoomRect.B.X:=i; { Read zoom area x2 } + S.Read(i, SizeOf(i)); ZoomRect.B.Y:=i; { Read zoom area y2 } GetSubViewPtr(S, Frame); { Now read frame object } If (Frame <> Nil) Then Begin Dispose(Frame, Done); { Kill we don't use it } @@ -4446,15 +4461,16 @@ END; { routine and resetting the ofGrafVersion flag after the call. } {---------------------------------------------------------------------------} PROCEDURE TWindow.Store (Var S: TStream); +VAR i: Integer; BEGIN TGroup.Store(S); { Call group store } - S.Write(Flags, 1); { Write window flags } - S.Write(Number, 2); { Write window number } - S.Write(Palette, 2); { Write window palette } - S.Write(ZoomRect.A.X, 2); { Write zoom area x1 } - S.Write(ZoomRect.A.Y, 2); { Write zoom area y1 } - S.Write(ZoomRect.B.X, 2); { Write zoom area x2 } - S.Write(ZoomRect.B.Y, 2); { Write zoom area y2 } + S.Write(Flags, SizeOf(Flags)); { Write window flags } + i:=Number;S.Write(i, SizeOf(i)); { Write window number } + i:=Palette;S.Write(i, SizeOf(i)); { Write window palette } + i:=ZoomRect.A.X;S.Write(i, SizeOf(i)); { Write zoom area x1 } + i:=ZoomRect.A.Y;S.Write(i, SizeOf(i)); { Write zoom area y1 } + i:=ZoomRect.B.X;S.Write(i, SizeOf(i)); { Write zoom area x2 } + i:=ZoomRect.B.Y;S.Write(i, SizeOf(i)); { Write zoom area y2 } PutSubViewPtr(S, Frame); { Write any frame } S.WriteStr(Title); { Write title string } END; @@ -5804,7 +5820,10 @@ END. { $Log$ - Revision 1.39 2002-09-22 19:42:21 hajny + Revision 1.40 2002-10-17 11:24:17 pierre + * Clean up the Load/Store routines so they are endian independent + + Revision 1.39 2002/09/22 19:42:21 hajny + FPC/2 support added Revision 1.38 2002/09/12 12:03:13 pierre