Update of /cvsroot/mahogany/M/src/modules/viewflt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23753/src/modules/viewflt

Modified Files:
        UUDecode.cpp 
Log Message:
fix BEGIN line detection: check that it is preceded by a blank line

Index: UUDecode.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/UUDecode.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -b -u -2 -r1.16 -r1.17
--- UUDecode.cpp        20 Jul 2004 14:02:00 -0000      1.16
+++ UUDecode.cpp        11 Nov 2004 21:45:48 -0000      1.17
@@ -202,7 +202,24 @@
          // check that we're either at the start of the text or after a blank
          // line
-         if ( start >= text.c_str() + 2 )
+         switch ( start - text.c_str() )
          {
-            hasBegin = start[-1] == _T('\n') && start[-2] == _T('\r');
+            case 0:
+               // leave hasBegin at true
+               break;
+
+            case 1:
+            case 3:
+               // some garbage before "begin": can't be one or 2 EOLs
+               hasBegin = false;
+               break;
+
+               // 2 or 4 and more characters after the start
+            default:
+               // only blank line allowed before
+               if ( start[-1] != _T('\n') || start[-2] != _T('\r') )
+                  hasBegin = false;
+               if ( start - text.c_str() > 2 &&
+                        (start[-3] != _T('\n') || start[-4] != _T('\r')) )
+                  hasBegin = false;
          }
       }



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to