On Mon, 6 Mar 2006, Reimar Döffinger wrote:
Hi, It's late so excuse any thinking-errors...
} else { - // Terminate with Mime style '=' - *out = '='; - outLen++; - - return outLen; + // Pad with 0 to 2 '=' chars as needed + if (outLen & 3) + memset(out, '=', 4 - (outLen & 3) ); + return (outLen + 3) & ~3;
Actually, IMHO memset is actually not a good idea in this case, I prefer your old patch in this regard. The real reason I posted my patch is because you do not check the maxlen value here and might be writing beyond the buffer.
Ahh I see it now. I was relying on the while( outLen<outMax ) loop to keep things in check as that would run after the last encode set. Rounding outLen down to be divisible by 4 should cover that.
So I think the best solution would be your original patch + my maxlen &= ~3; line.
Ok, how's this attached patch look? I added a couple speed ups to my original. -- Jeff
Greetings, Reimar Döffinger
_______________________________________________ MPlayer-dev-eng mailing list MPlayer-dev-eng@mplayerhq.hu http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng