* boolean for decodestringbase64 to select strict mode.

git-svn-id: trunk@22713 -
This commit is contained in:
marco 2012-10-18 08:01:15 +00:00
parent 65c657006c
commit 7263b3c5a4

View File

@ -87,7 +87,7 @@ type
end;
function EncodeStringBase64(const s:string):String;
function DecodeStringBase64(const s:string):String;
function DecodeStringBase64(const s:string;strict:boolean=false):String;
implementation
@ -417,7 +417,7 @@ begin
raise EStreamError.Create('Invalid stream operation');
end;
function DecodeStringBase64(const s:string):String;
function DecodeStringBase64(const s:string;strict:boolean=false):String;
var
Instream,
@ -428,7 +428,10 @@ begin
try
Outstream:=TStringStream.Create('');
try
Decoder:=TBase64DecodingStream.Create(Instream,bdmMIME);
if strict then
Decoder:=TBase64DecodingStream.Create(Instream,bdmStrict)
else
Decoder:=TBase64DecodingStream.Create(Instream,bdmMIME);
try
Outstream.CopyFrom(Decoder,Decoder.Size);
Result:=Outstream.DataString;