Browse Source

* Use Align function to align fields in record-buffer

git-svn-id: trunk@11164 -
joost 17 years ago
parent
commit
f92e594e56
1 changed files with 2 additions and 4 deletions
  1. 2 4
      packages/fcl-db/src/base/bufdataset.pas

+ 2 - 4
packages/fcl-db/src/base/bufdataset.pas

@@ -1808,8 +1808,7 @@ var x : longint;
 begin
 begin
   FNullmaskSize := 1+((FieldDefs.count-1) div 8);
   FNullmaskSize := 1+((FieldDefs.count-1) div 8);
 {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
 {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
-  if (FNullmaskSize and 3 <> 0) then
-    FNullmaskSize := (FNullmaskSize and not 3)+4;
+  FNullmaskSize:=Align(FNullmaskSize,4);
 {$ENDIF}
 {$ENDIF}
   FRecordSize := FNullmaskSize;
   FRecordSize := FNullmaskSize;
   SetLength(FFieldBufPositions,FieldDefs.count);
   SetLength(FFieldBufPositions,FieldDefs.count);
@@ -1818,8 +1817,7 @@ begin
     FFieldBufPositions[x] := FRecordSize;
     FFieldBufPositions[x] := FRecordSize;
     inc(FRecordSize, GetFieldSize(FieldDefs[x]));
     inc(FRecordSize, GetFieldSize(FieldDefs[x]));
 {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
 {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
-  if (FRecordSize and 3 <> 0) then
-    FRecordSize := (FRecordSize and not 3)+4;
+    FRecordSize:=Align(FRecordSize,4);
 {$ENDIF}
 {$ENDIF}
     end;
     end;
 end;
 end;