View Issue Details

IDProjectCategoryView StatusLast Update
0035274FPCPatchpublic2019-03-26 12:21
ReporterInoussa OUEDRAOGOAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
PlatformOSWindowsOS Version
Product Version3.3.1Product Build 
Target Version3.2.0Fixed in Version3.3.1 
Summary0035274: fpReport TFPReportJSONStreamer fix for stream content reading
DescriptionThe patch fixes TFPReportJSONStreamer to be able to read back stream content (such as images) in report's definition files.
TagsfpReport
Fixed in Revision41794
FPCOldBugId
FPCTarget
Attached Files
  • fpreport-streamer-patch.patch (1,250 bytes)
    --- C:/Users/inoussa/AppData/Local/Temp/fpreportstreamer.pp-revBASE.svn003.tmp.pp	dim. mai  6 09:14:26 2018
    +++ C:/fpc_dev/packages/fcl-report/src/fpreportstreamer.pp	lun. mars 25 15:18:07 2019
    @@ -135,0 +136 @@ type
    +    function    HexToMemoryStream(S: String): TMemoryStream;
    @@ -450 +451 @@ var
    -  SS: TStringStream;
    +  MS : TMemoryStream;
    @@ -456 +457 @@ begin
    -    SS := HexToStringStream(S);
    +    MS := HexToMemoryStream(S);
    @@ -458 +459 @@ begin
    -      AValue.CopyFrom(SS, 0);
    +      AValue.CopyFrom(MS, 0);
    @@ -460 +461 @@ begin
    -      SS.Free;
    +      MS.Free();
    @@ -700,0 +702,33 @@ end;
    +function TFPReportJSONStreamer.HexToMemoryStream(S: String): TMemoryStream;
    +var
    +  T: array of Byte;
    +  I, J: integer;
    +  B: byte;
    +  P: PByte;
    +  H: string[3];
    +begin
    +  Result := nil;
    +  SetLength(H, 3);
    +  H[1] := '$';
    +  if (S <> '') then
    +  begin
    +    SetLength(T, Length(S) div 2);
    +    P := @T[0];
    +    I := 1;
    +    while I < Length(S) do
    +    begin
    +      H[2] := S[i];
    +      Inc(I);
    +      H[3] := S[i];
    +      Inc(I);
    +      Val(H, B, J);
    +      if (J = 0) then
    +        P^ := B
    +      else
    +        P^ := 0;
    +      Inc(P);
    +    end;
    +    Result := TBytesStream.Create(T);
    +  end;
    +end;
    +
    

Activities

Inoussa OUEDRAOGO

2019-03-25 18:29

reporter  

fpreport-streamer-patch.patch (1,250 bytes)
--- C:/Users/inoussa/AppData/Local/Temp/fpreportstreamer.pp-revBASE.svn003.tmp.pp	dim. mai  6 09:14:26 2018
+++ C:/fpc_dev/packages/fcl-report/src/fpreportstreamer.pp	lun. mars 25 15:18:07 2019
@@ -135,0 +136 @@ type
+    function    HexToMemoryStream(S: String): TMemoryStream;
@@ -450 +451 @@ var
-  SS: TStringStream;
+  MS : TMemoryStream;
@@ -456 +457 @@ begin
-    SS := HexToStringStream(S);
+    MS := HexToMemoryStream(S);
@@ -458 +459 @@ begin
-      AValue.CopyFrom(SS, 0);
+      AValue.CopyFrom(MS, 0);
@@ -460 +461 @@ begin
-      SS.Free;
+      MS.Free();
@@ -700,0 +702,33 @@ end;
+function TFPReportJSONStreamer.HexToMemoryStream(S: String): TMemoryStream;
+var
+  T: array of Byte;
+  I, J: integer;
+  B: byte;
+  P: PByte;
+  H: string[3];
+begin
+  Result := nil;
+  SetLength(H, 3);
+  H[1] := '$';
+  if (S <> '') then
+  begin
+    SetLength(T, Length(S) div 2);
+    P := @T[0];
+    I := 1;
+    while I < Length(S) do
+    begin
+      H[2] := S[i];
+      Inc(I);
+      H[3] := S[i];
+      Inc(I);
+      Val(H, B, J);
+      if (J = 0) then
+        P^ := B
+      else
+        P^ := 0;
+      Inc(P);
+    end;
+    Result := TBytesStream.Create(T);
+  end;
+end;
+

Michael Van Canneyt

2019-03-26 07:43

administrator   ~0115046

Applied, thank you very much !

Issue History

Date Modified Username Field Change
2019-03-25 18:29 Inoussa OUEDRAOGO New Issue
2019-03-25 18:29 Inoussa OUEDRAOGO File Added: fpreport-streamer-patch.patch
2019-03-25 19:41 Inoussa OUEDRAOGO Tag Attached: fpReport
2019-03-25 23:25 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-03-25 23:25 Michael Van Canneyt Status new => assigned
2019-03-26 07:43 Michael Van Canneyt Fixed in Revision => 41794
2019-03-26 07:43 Michael Van Canneyt Note Added: 0115046
2019-03-26 07:43 Michael Van Canneyt Status assigned => resolved
2019-03-26 07:43 Michael Van Canneyt Fixed in Version => 3.3.1
2019-03-26 07:43 Michael Van Canneyt Resolution open => fixed
2019-03-26 07:43 Michael Van Canneyt Target Version => 3.2.0
2019-03-26 12:21 Inoussa OUEDRAOGO Status resolved => closed