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

Modified Files:
        Trailer.cpp 
Log Message:
only detect sufficiently long lines as trailer separators

Index: Trailer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/Trailer.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -b -u -2 -r1.15 -r1.16
--- Trailer.cpp 12 Jul 2004 20:53:23 -0000      1.15
+++ Trailer.cpp 13 Jul 2004 10:04:31 -0000      1.16
@@ -82,31 +82,23 @@
       // does this seem to be a separator line?
       char chDel = *pc;
-      if ( chDel != '-' && chDel != '_' )
+      if ( chDel == '-' || chDel == '_' )
       {
-         // no
-         chDel = '\0';
-      }
-
-      // look for the start of this line:
-      //
-      // (a) checking that it consists solely of delimiter characters
-      //     if there is a chance that this is a delimiter line
-      while ( chDel != '\0' && *pc != '\n' && pc > start )
+         // look for the start of this line checking if it has only delimiter
+         // characters:
+         size_t lenDel = 0;
+         while ( *pc != '\n' && pc > start )
       {
          if ( *pc-- != chDel )
          {
             // it's not a delimiter line, finally
-            chDel = '\0';
-         }
+               lenDel = 0;
+               break;
       }
 
-      // (b) simply (and faster) if it's not a delimiter line anyhow
-      while ( *pc != '\n' && pc > start )
-      {
-         pc--;
+            lenDel++;
       }
 
       // did we find a delimiter line?
-      if ( chDel )
+         if ( lenDel >= 60 )
       {
          // yes, but it may start either at pc or at pc + 1
@@ -136,5 +128,13 @@
          return;
       }
-      //else: no
+      }
+      else // not a delimiter line
+      {
+         // rewind to its beginning
+         while ( *pc != '\n' && pc > start )
+         {
+            pc--;
+         }
+      }
 
       if ( pc <= start )



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to