On Jun 11, 2005, at 09:11, Francois PIETTE wrote:

1. Change the boundary detection to look for "#10#13--<boundary>#10#13" instead of just "--<boundary>#10#13". But this might be hard, because as far as I understood MimeDec, it already has the stream split into lines before testing for boundaries, and so it is not looking for "--<boundary>#10#13", but for "--<boundary>" in the next string, which happens to be a line; in this case, it would need to combine with #2 below.

InternalDecodeStream read the input stream and find line end (using only LF because so much messages are mal formed and use only LF instead of CR/LF pair). Of course if CR is there, it is processed transparently. Lines are processed by the magic of FNext variable which is a pointer to the next procedure to handle data pointed by FCurrentData. FNext is changed according to the state or stage of decoding. FNext point to procedures like ProcessHeaderLine, ProcessMessageLine, ProcessWaitBoundary, ... So there is a finite state machine whose state variable is FNext.


Thanx Francois. Would you think its better to implement a look-ahead, so that every time that a blank line is found, we check if the next line is a boundary before adding it to the output stream; or remove it from the output stream after a boundary is found? By the way, is the output stream a buffer, or a file stream? If its a file stream, then its probably written to disk already.

        dZ.

--
Trying to teach good programming habits in VB6 is like trying to teach proper hygiene in a sewer.


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to