mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 08:29:20 +02:00
* boolean for decodestringbase64 to select strict mode.
git-svn-id: trunk@22713 -
This commit is contained in:
parent
65c657006c
commit
7263b3c5a4
@ -87,7 +87,7 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function EncodeStringBase64(const s:string):String;
|
function EncodeStringBase64(const s:string):String;
|
||||||
function DecodeStringBase64(const s:string):String;
|
function DecodeStringBase64(const s:string;strict:boolean=false):String;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ begin
|
|||||||
raise EStreamError.Create('Invalid stream operation');
|
raise EStreamError.Create('Invalid stream operation');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function DecodeStringBase64(const s:string):String;
|
function DecodeStringBase64(const s:string;strict:boolean=false):String;
|
||||||
|
|
||||||
var
|
var
|
||||||
Instream,
|
Instream,
|
||||||
@ -428,7 +428,10 @@ begin
|
|||||||
try
|
try
|
||||||
Outstream:=TStringStream.Create('');
|
Outstream:=TStringStream.Create('');
|
||||||
try
|
try
|
||||||
Decoder:=TBase64DecodingStream.Create(Instream,bdmMIME);
|
if strict then
|
||||||
|
Decoder:=TBase64DecodingStream.Create(Instream,bdmStrict)
|
||||||
|
else
|
||||||
|
Decoder:=TBase64DecodingStream.Create(Instream,bdmMIME);
|
||||||
try
|
try
|
||||||
Outstream.CopyFrom(Decoder,Decoder.Size);
|
Outstream.CopyFrom(Decoder,Decoder.Size);
|
||||||
Result:=Outstream.DataString;
|
Result:=Outstream.DataString;
|
||||||
|
Loading…
Reference in New Issue
Block a user