Re: patchfs, audio update




BTW, new incarnation reports wrong patch sizes for gzipped patches.


I'll examine this when I have more time.
Regards


You can use ideas from attached file. I eliminated all tell() call and calculate position itself by adding current line length to some variable. Patched patchfs list works more well, but file size are bit smaller than truth. Copyout is ok.

--
Regards,
Andrew V. Samoilov
--- patchfs	Wed Dec 18 19:46:57 2002
+++ patchfs-	Wed Dec 18 20:24:13 2002
@@ -4,9 +4,7 @@
 # 
 # extfs to handle patches in unified diff format
 
-use bytes;
 use strict;
-use POSIX;
 
 # standard binaries
 my $bzip = "bzip2";
@@ -56,12 +56,14 @@
     import Date::Parse if ($parsedates);
     
     # state==1 means diff contents, state==0 means comments
-    $state=1; $f="";
+    $state = 1; $f = '';
+    my $cpos = 0;
     while (<I>) {
-	if (/^-{3} /) {
+	$cpos += length;
+	if (/^--- /) {
 	    # parse diff header
 	    if ($state==1) {
-		$npos=tell(I)-length;
+		$npos = $cpos - length;
 		printf "-rw-r--r-- 1 %s %s %d %s %s%s\n", $uid, $gid, $npos-$pos, datetime($time), $prefix, $f
 		  if $f;
 		$pos=$npos;
@@ -110,14 +112,14 @@
 
 	} elsif ($state==1 && !/^([+\- ]|@@)/) {
 	    # start of comments, end of diff contents
-	    $npos=tell(I)-length;
+	    $npos = $cpos - length;
 	    printf "-rw-r--r-- 1 %s %s %d %s %s%s\n", $uid, $gid, $npos-$pos, datetime($time), $prefix, $f
 	      if $f;
 	    $pos=$npos;
 	    $state=0;
 	}
     }
-    $npos=tell(I);
+    $npos = $cpos;
     printf "-rw-r--r-- 1 %s %s %d %s %s%s\n", $uid, $gid, $npos-$pos, datetime($time), $prefix, $f
       if $f;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]