1
0
mirror of synced 2024-12-22 09:13:07 +01:00

Mime encode using AnsiStrings

This commit is contained in:
Mark van Renswoude 2013-12-08 09:25:53 +00:00
parent 857be7f9bb
commit 9469351a54

View File

@ -399,13 +399,13 @@ end;
function Base64Encode(AValue: String): String; function Base64Encode(AValue: String): String;
begin begin
Result := MimeEncodeString(AValue); Result := string(MimeEncodeString(AnsiString(AValue)));
end; end;
function Base64Decode(AValue: String): String; function Base64Decode(AValue: String): String;
begin begin
Result := MimeDecodeString(AValue); Result := string(MimeDecodeString(AnsiString(AValue)));
end; end;
@ -675,7 +675,7 @@ begin
if L > 0 then if L > 0 then
begin begin
SetLength(Result, MimeEncodedSize(L)); SetLength(Result, MimeEncodedSize(L));
MimeEncode(PChar(S)^, L, PChar(Result)^); MimeEncode(PAnsiChar(S)^, L, PAnsiChar(Result)^);
end end
else else
Result := ''; Result := '';
@ -694,8 +694,8 @@ begin
SetLength(Result, MimeDecodedSize(L)); SetLength(Result, MimeDecodedSize(L));
ByteBuffer := 0; ByteBuffer := 0;
ByteBufferSpace := 4; ByteBufferSpace := 4;
L := MimeDecodePartial(PChar(S)^, L, PChar(Result)^, ByteBuffer, ByteBufferSpace); L := MimeDecodePartial(PAnsiChar(S)^, L, PAnsiChar(Result)^, ByteBuffer, ByteBufferSpace);
Inc(L, MimeDecodePartialEnd(PChar(Cardinal(Result) + L)^, ByteBuffer, ByteBufferSpace)); Inc(L, MimeDecodePartialEnd(PAnsiChar(Cardinal(Result) + L)^, ByteBuffer, ByteBufferSpace));
SetLength(Result, L); SetLength(Result, L);
end; end;
end; end;
@ -830,7 +830,7 @@ begin
ByteBuffer := 0; ByteBuffer := 0;
ByteBufferSpace := 4; ByteBufferSpace := 4;
Result := MimeDecodePartial(InputBuffer, InputBytesCount, OutputBuffer, ByteBuffer, ByteBufferSpace); Result := MimeDecodePartial(InputBuffer, InputBytesCount, OutputBuffer, ByteBuffer, ByteBufferSpace);
Inc(Result, MimeDecodePartialEnd(PChar(Cardinal(OutputBuffer) + Result)^, ByteBuffer, ByteBufferSpace)); Inc(Result, MimeDecodePartialEnd(PAnsiChar(Cardinal(OutputBuffer) + Result)^, ByteBuffer, ByteBufferSpace));
end; end;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------