Re: patchfs, audio update
- From: "Andrew V. Samoilov" <sav bcs zp ua>
- To: "Adam Byrtek 'alpha'" <alpha irc pl>
- Cc: GNU Midnight Commander Development team <mc-devel gnome org>
- Subject: Re: patchfs, audio update
- Date: Wed, 18 Dec 2002 21:26:05 +0200
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]