Hi Danijel,
RTC Version 6.29.
I've been experimenting with XML-RPC support in the RTC library today. I everything has been going well and I have my android tablet making XML requests to my RTC server. When I started returning datasets things started to go wrong. I began to get a pointer exception when a remote function was doing its clean up. I switched on MadExcept for my server project and included the memory overrun detection. When I did this the program would fail in MimeEncodeFullLines when executing the lines:
OutPtr^.b1 := 13;
OutPtr^.b2 := 10;
OutPtr := PByte4(RtcIntPtr(OutPtr)+2);
The first line was the point the memory error triggered. Looking further I have determined that this error occurs if the input to Mime_EncodeEx is exactly 57 bytes in length. I've been looking at the output buffer size calculation
aSize := (l + 2) div 3 * 4 + (l - 1) div MIME_DECODED_LINE_BREAK * 2
and I'm wondering if doing this as an integer division is the problem? If l is 57 then the formula gives an output buffer size of 76. The buffer needs to be 78 bytes to contain the two additional CR LF characters MimeEncodeFullLines wants to add. Using a calculator and keeping all of the decimal points though the calculation I get and 80 byte buffer if I round down at the end.
I'm not sure if the formula needs to be altered or if MimeEncodeFullLines needs a small modification to stop the CR LF characters being added if the buffer is 57 bytes long.
Many thanks for any advice.
Ryan
p.s. I'm not using Delphi XE5 as there are up and coming Android devices which are not currently supported by the Delphi complier.