View Issue Details

IDProjectCategoryView StatusLast Update
0030877FPCPackagespublic2016-11-10 12:58
ReporterLuiz AmericoAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionProduct Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0030877: Add const to string and array of const params in fpjson
DescriptionAttached patch
TagsNo tags attached.
Fixed in Revision34859
FPCOldBugId0
FPCTarget
Attached Files
  • addconst-json.diff (2,481 bytes)
    diff --git packages/fcl-json/src/fpjson.pp packages/fcl-json/src/fpjson.pp
    index 8f86698..0f76870 100644
    --- packages/fcl-json/src/fpjson.pp
    +++ packages/fcl-json/src/fpjson.pp
    @@ -601,10 +601,10 @@ Function CreateJSON(Data : Integer) : TJSONIntegerNumber;
     Function CreateJSON(Data : Int64) : TJSONInt64Number;
     Function CreateJSON(Data : QWord) : TJSONQWordNumber;
     Function CreateJSON(Data : TJSONFloat) : TJSONFloatNumber;
    -Function CreateJSON(Data : TJSONStringType) : TJSONString;
    -Function CreateJSON(Data : TJSONUnicodeStringType) : TJSONString;
    -Function CreateJSONArray(Data : Array of const) : TJSONArray;
    -Function CreateJSONObject(Data : Array of const) : TJSONObject;
    +Function CreateJSON(const Data : TJSONStringType) : TJSONString;
    +Function CreateJSON(const Data : TJSONUnicodeStringType) : TJSONString;
    +Function CreateJSONArray(const Data : Array of const) : TJSONArray;
    +Function CreateJSONObject(const Data : Array of const) : TJSONObject;
     
     // These functions rely on a callback. If the callback is not set, they will raise an error.
     // When the jsonparser unit is included in the project, the callback is automatically set.
    @@ -787,31 +787,30 @@ begin
       Result:=TJSONFloatNumberCLass(DefaultJSONInstanceTypes[jitNumberFloat]).Create(Data);
     end;
     
    -function CreateJSON(Data: TJSONStringType): TJSONString;
    +function CreateJSON(const Data: TJSONStringType): TJSONString;
     begin
       Result:=TJSONStringCLass(DefaultJSONInstanceTypes[jitString]).Create(Data);
     end;
     
    -function CreateJSON(Data: TJSONUnicodeStringType): TJSONString;
    +function CreateJSON(const Data: TJSONUnicodeStringType): TJSONString;
     begin
       Result:=TJSONStringCLass(DefaultJSONInstanceTypes[jitString]).Create(Data);
     end;
     
    -function CreateJSONArray(Data: array of const): TJSONArray;
    +function CreateJSONArray(const Data: array of const): TJSONArray;
     begin
       Result:=TJSONArrayCLass(DefaultJSONInstanceTypes[jitArray]).Create(Data);
     end;
     
    -function CreateJSONObject(Data: array of const): TJSONObject;
    +function CreateJSONObject(const Data: array of const): TJSONObject;
     begin
    -  Result:=TJSONObjectCLass(DefaultJSONInstanceTypes[jitObject]).Create(Data);
    +  Result:=TJSONObjectClass(DefaultJSONInstanceTypes[jitObject]).Create(Data);
     end;
     
     Var
       JPH : TJSONParserHandler;
     
    -function GetJSON(const JSON: TJSONStringType; const UseUTF8: Boolean
    -  ): TJSONData;
    +function GetJSON(const JSON: TJSONStringType; const UseUTF8: Boolean): TJSONData;
     
     Var
       SS : TStringStream;
    
    addconst-json.diff (2,481 bytes)

Activities

Luiz Americo

2016-11-07 00:47

developer  

addconst-json.diff (2,481 bytes)
diff --git packages/fcl-json/src/fpjson.pp packages/fcl-json/src/fpjson.pp
index 8f86698..0f76870 100644
--- packages/fcl-json/src/fpjson.pp
+++ packages/fcl-json/src/fpjson.pp
@@ -601,10 +601,10 @@ Function CreateJSON(Data : Integer) : TJSONIntegerNumber;
 Function CreateJSON(Data : Int64) : TJSONInt64Number;
 Function CreateJSON(Data : QWord) : TJSONQWordNumber;
 Function CreateJSON(Data : TJSONFloat) : TJSONFloatNumber;
-Function CreateJSON(Data : TJSONStringType) : TJSONString;
-Function CreateJSON(Data : TJSONUnicodeStringType) : TJSONString;
-Function CreateJSONArray(Data : Array of const) : TJSONArray;
-Function CreateJSONObject(Data : Array of const) : TJSONObject;
+Function CreateJSON(const Data : TJSONStringType) : TJSONString;
+Function CreateJSON(const Data : TJSONUnicodeStringType) : TJSONString;
+Function CreateJSONArray(const Data : Array of const) : TJSONArray;
+Function CreateJSONObject(const Data : Array of const) : TJSONObject;
 
 // These functions rely on a callback. If the callback is not set, they will raise an error.
 // When the jsonparser unit is included in the project, the callback is automatically set.
@@ -787,31 +787,30 @@ begin
   Result:=TJSONFloatNumberCLass(DefaultJSONInstanceTypes[jitNumberFloat]).Create(Data);
 end;
 
-function CreateJSON(Data: TJSONStringType): TJSONString;
+function CreateJSON(const Data: TJSONStringType): TJSONString;
 begin
   Result:=TJSONStringCLass(DefaultJSONInstanceTypes[jitString]).Create(Data);
 end;
 
-function CreateJSON(Data: TJSONUnicodeStringType): TJSONString;
+function CreateJSON(const Data: TJSONUnicodeStringType): TJSONString;
 begin
   Result:=TJSONStringCLass(DefaultJSONInstanceTypes[jitString]).Create(Data);
 end;
 
-function CreateJSONArray(Data: array of const): TJSONArray;
+function CreateJSONArray(const Data: array of const): TJSONArray;
 begin
   Result:=TJSONArrayCLass(DefaultJSONInstanceTypes[jitArray]).Create(Data);
 end;
 
-function CreateJSONObject(Data: array of const): TJSONObject;
+function CreateJSONObject(const Data: array of const): TJSONObject;
 begin
-  Result:=TJSONObjectCLass(DefaultJSONInstanceTypes[jitObject]).Create(Data);
+  Result:=TJSONObjectClass(DefaultJSONInstanceTypes[jitObject]).Create(Data);
 end;
 
 Var
   JPH : TJSONParserHandler;
 
-function GetJSON(const JSON: TJSONStringType; const UseUTF8: Boolean
-  ): TJSONData;
+function GetJSON(const JSON: TJSONStringType; const UseUTF8: Boolean): TJSONData;
 
 Var
   SS : TStringStream;
addconst-json.diff (2,481 bytes)

Michael Van Canneyt

2016-11-09 22:18

administrator   ~0095725

Applied, thank you very much!

Issue History

Date Modified Username Field Change
2016-11-07 00:47 Luiz Americo New Issue
2016-11-07 00:47 Luiz Americo File Added: addconst-json.diff
2016-11-07 15:34 Michael Van Canneyt Assigned To => Michael Van Canneyt
2016-11-07 15:34 Michael Van Canneyt Status new => assigned
2016-11-09 22:18 Michael Van Canneyt Fixed in Revision => 34859
2016-11-09 22:18 Michael Van Canneyt Note Added: 0095725
2016-11-09 22:18 Michael Van Canneyt Status assigned => resolved
2016-11-09 22:18 Michael Van Canneyt Fixed in Version => 3.1.1
2016-11-09 22:18 Michael Van Canneyt Resolution open => fixed
2016-11-09 22:18 Michael Van Canneyt Target Version => 3.2.0
2016-11-10 12:58 Luiz Americo Status resolved => closed