Thread: [cvs] SF.net SVN: bogofilter:[6835] trunk/bogofilter/src/qp.c
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <m-...@us...> - 2009-05-28 12:44:57
|
Revision: 6835 http://bogofilter.svn.sourceforge.net/bogofilter/?rev=6835&view=rev Author: m-a Date: 2009-05-28 12:44:44 +0000 (Thu, 28 May 2009) Log Message: ----------- Revise qp EOL check to not detect trailing CR as line end. Our input code is not going to detect such lines, so no need to introduce inconsistencies here that might later turn out to break other parts of the code. Modified Paths: -------------- trunk/bogofilter/src/qp.c Modified: trunk/bogofilter/src/qp.c =================================================================== --- trunk/bogofilter/src/qp.c 2009-05-28 12:06:02 UTC (rev 6834) +++ trunk/bogofilter/src/qp.c 2009-05-28 12:44:44 UTC (rev 6835) @@ -43,7 +43,7 @@ /* Function Prototypes */ -static int qp_eol_check( byte *s, byte *e ); +static int qp_eol_check(byte *s, byte *e); /* Function Definitions */ @@ -61,7 +61,7 @@ switch (ch) { case '=': if (mode == RFC2045) { - int c = qp_eol_check( s, e ); + int c = qp_eol_check(s, e); if (c != 0) { /* continuation line, trailing = */ s += c; @@ -137,24 +137,20 @@ return true; } -static int qp_eol_check( byte *s, byte *e ) +static int qp_eol_check(byte *s, byte *e) { - /* test for LF */ - if (s + 1 <= e && s[0] == '\n') - { - /* only LF */ - return 1; - } + if (s + 1 <= e) { + /* test for LF */ + if (s[0] == '\n') + { + /* only LF */ + return 1; + } - /* test for CR */ - if (s + 1 <= e && s[0] == '\r') - { - if (s + 2 <= e && s[1] == '\n') + if (s[0] == '\r' + && s + 2 <= e && s[1] == '\n') /* CR LF */ return 2; - else - /* only CR */ - return 1; } return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |