View Issue Details

IDProjectCategoryView StatusLast Update
0035106FPCFCLpublic2019-07-12 20:40
ReporterSerge AnvarovAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0035106: TRegistry. Patch 7. WriteBinaryData
DescriptionParameter Buffer marked as a const, not a var. Reason:
1. Both implementations (registry and xml) use it as const.
2. Compatible with Delphi
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files
  • registry7.diff (1,105 bytes)
    Index: packages/fcl-registry/src/registry.pp
    ===================================================================
    --- packages/fcl-registry/src/registry.pp	(revision 41343)
    +++ packages/fcl-registry/src/registry.pp	(working copy)
    @@ -113,7 +113,7 @@
         procedure MoveKey(const OldName, NewName: string; Delete: Boolean);
         procedure RenameValue(const OldName, NewName: string);
         procedure WriteCurrency(const Name: string; Value: Currency);
    -    procedure WriteBinaryData(const Name: string; var Buffer; BufSize: Integer);
    +    procedure WriteBinaryData(const Name: string; const Buffer; BufSize: Integer);
         procedure WriteBool(const Name: string; Value: Boolean);
         procedure WriteDate(const Name: string; Value: TDateTime);
         procedure WriteDateTime(const Name: string; Value: TDateTime);
    @@ -468,7 +468,7 @@
       Result:=Frac(Result);
     end;
     
    -procedure TRegistry.WriteBinaryData(const Name: string; var Buffer; BufSize: Integer);
    +procedure TRegistry.WriteBinaryData(const Name: string; const Buffer; BufSize: Integer);
     begin
       PutData(Name, @Buffer, BufSize, rdBinary);
     end;
    
    registry7.diff (1,105 bytes)
  • registry7.1.diff (1,559 bytes)
    Index: packages/fcl-registry/src/registry.pp
    ===================================================================
    --- packages/fcl-registry/src/registry.pp	(revision 42351)
    +++ packages/fcl-registry/src/registry.pp	(working copy)
    @@ -159,8 +159,8 @@
         procedure RenameValue(const OldName, NewName: String);
         procedure WriteCurrency(const Name: UnicodeString; Value: Currency);
         procedure WriteCurrency(const Name: String; Value: Currency);
    -    procedure WriteBinaryData(const Name: UnicodeString; var Buffer; BufSize: Integer);
    -    procedure WriteBinaryData(const Name: String; var Buffer; BufSize: Integer);
    +    procedure WriteBinaryData(const Name: UnicodeString; const Buffer; BufSize: Integer);
    +    procedure WriteBinaryData(const Name: String; const Buffer; BufSize: Integer);
         procedure WriteBool(const Name: UnicodeString; Value: Boolean);
         procedure WriteBool(const Name: String; Value: Boolean);
         procedure WriteDate(const Name: UnicodeString; Value: TDateTime);
    @@ -780,12 +780,12 @@
       Result:=ValueExists(UnicodeString(Name));
     end;
     
    -procedure TRegistry.WriteBinaryData(const Name: UnicodeString; var Buffer; BufSize: Integer);
    +procedure TRegistry.WriteBinaryData(const Name: UnicodeString; const Buffer; BufSize: Integer);
     begin
       PutData(Name, @Buffer, BufSize, rdBinary);
     end;
     
    -procedure TRegistry.WriteBinaryData(const Name: String; var Buffer;
    +procedure TRegistry.WriteBinaryData(const Name: String; const Buffer;
       BufSize: Integer);
     begin
       WriteBinaryData(UnicodeString(Name), Buffer, BufSize);
    
    registry7.1.diff (1,559 bytes)

Activities

Serge Anvarov

2019-02-16 21:49

reporter  

registry7.diff (1,105 bytes)
Index: packages/fcl-registry/src/registry.pp
===================================================================
--- packages/fcl-registry/src/registry.pp	(revision 41343)
+++ packages/fcl-registry/src/registry.pp	(working copy)
@@ -113,7 +113,7 @@
     procedure MoveKey(const OldName, NewName: string; Delete: Boolean);
     procedure RenameValue(const OldName, NewName: string);
     procedure WriteCurrency(const Name: string; Value: Currency);
-    procedure WriteBinaryData(const Name: string; var Buffer; BufSize: Integer);
+    procedure WriteBinaryData(const Name: string; const Buffer; BufSize: Integer);
     procedure WriteBool(const Name: string; Value: Boolean);
     procedure WriteDate(const Name: string; Value: TDateTime);
     procedure WriteDateTime(const Name: string; Value: TDateTime);
@@ -468,7 +468,7 @@
   Result:=Frac(Result);
 end;
 
-procedure TRegistry.WriteBinaryData(const Name: string; var Buffer; BufSize: Integer);
+procedure TRegistry.WriteBinaryData(const Name: string; const Buffer; BufSize: Integer);
 begin
   PutData(Name, @Buffer, BufSize, rdBinary);
 end;
registry7.diff (1,105 bytes)

Serge Anvarov

2019-04-10 07:16

reporter   ~0115373

Revision 60900. The patch is still actual.

Bart Broersma

2019-07-12 11:58

reporter   ~0117214

@Serge: you should probably also alter signature of the version with UnicodeString parameter.

Serge Anvarov

2019-07-12 20:40

reporter   ~0117229

Here you are

registry7.1.diff (1,559 bytes)
Index: packages/fcl-registry/src/registry.pp
===================================================================
--- packages/fcl-registry/src/registry.pp	(revision 42351)
+++ packages/fcl-registry/src/registry.pp	(working copy)
@@ -159,8 +159,8 @@
     procedure RenameValue(const OldName, NewName: String);
     procedure WriteCurrency(const Name: UnicodeString; Value: Currency);
     procedure WriteCurrency(const Name: String; Value: Currency);
-    procedure WriteBinaryData(const Name: UnicodeString; var Buffer; BufSize: Integer);
-    procedure WriteBinaryData(const Name: String; var Buffer; BufSize: Integer);
+    procedure WriteBinaryData(const Name: UnicodeString; const Buffer; BufSize: Integer);
+    procedure WriteBinaryData(const Name: String; const Buffer; BufSize: Integer);
     procedure WriteBool(const Name: UnicodeString; Value: Boolean);
     procedure WriteBool(const Name: String; Value: Boolean);
     procedure WriteDate(const Name: UnicodeString; Value: TDateTime);
@@ -780,12 +780,12 @@
   Result:=ValueExists(UnicodeString(Name));
 end;
 
-procedure TRegistry.WriteBinaryData(const Name: UnicodeString; var Buffer; BufSize: Integer);
+procedure TRegistry.WriteBinaryData(const Name: UnicodeString; const Buffer; BufSize: Integer);
 begin
   PutData(Name, @Buffer, BufSize, rdBinary);
 end;
 
-procedure TRegistry.WriteBinaryData(const Name: String; var Buffer;
+procedure TRegistry.WriteBinaryData(const Name: String; const Buffer;
   BufSize: Integer);
 begin
   WriteBinaryData(UnicodeString(Name), Buffer, BufSize);
registry7.1.diff (1,559 bytes)

Issue History

Date Modified Username Field Change
2019-02-16 21:49 Serge Anvarov New Issue
2019-02-16 21:49 Serge Anvarov File Added: registry7.diff
2019-04-10 07:16 Serge Anvarov Note Added: 0115373
2019-07-12 11:58 Bart Broersma Note Added: 0117214
2019-07-12 20:40 Serge Anvarov File Added: registry7.1.diff
2019-07-12 20:40 Serge Anvarov Note Added: 0117229