[Po4a-commits] "po4a/lib/Locale/Po4a Sgml.pm,1.91,1.92"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Mon Nov 21 23:46:31 UTC 2005


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv12003/lib/Locale/Po4a

Modified Files:
	Sgml.pm 
Log Message:
Some fixes in the line reference counting.


Index: Sgml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- Sgml.pm	20 Nov 2005 20:44:21 -0000	1.91
+++ Sgml.pm	21 Nov 2005 23:46:29 -0000	1.92
@@ -470,9 +470,9 @@
 
     # Prepare the reference indirection stuff
     my @refs;
-    my @lines = split(/\n/, $origfile);
+    my $length = ($origfile =~ tr/\n/\n/);
     print "XX Prepare reference indirection stuff\n" if $debug{'refs'};
-    for (my $i=1; $i<=scalar @lines; $i++) {
+    for (my $i=1; $i<=$length; $i++) {
 	push @refs,"$mastername:$i";
 	print "$mastername:$i\n" if $debug{'refs'};
     }
@@ -618,8 +618,7 @@
 	local $/ = undef;
 	$entincl{$key}{'content'} = <IN>;
 	close IN;
-	@lines= split(/\n/,$entincl{$key}{'content'});
-	$entincl{$key}{'length'} = scalar @lines;
+	$entincl{$key}{'length'} = ($entincl{$key}{'content'} =~ tr/\n/\n/);
 	print STDERR "read $filename (content of \&$key;, $entincl{$key}{'length'} lines long)\n" 
 	  if ($debug{'entities'});
     }
@@ -652,7 +651,7 @@
 	    # Add the references of the added lines
 	    my $i;
 	    for ($i=0; $i<$len; $i++) {
-		$refs[$i+$pre] = "$main $entincl{$key}{'filename'}:".($i+1);
+		$refs[$i+$pre] = "$main $entincl{$key}{'filename'}:".($i);
 	    }
 
 	    if ($begin !~ m/\n[ \t]*$/s) {




More information about the Po4a-commits mailing list