This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Sorting bug in fo/pdf2index


Hello,

I've been using fo/pdf2index to clean up FO indexes.  The results are
good, with the exception that pdf2index seems to be sorting numbers
lexically rather than numerically.  The culprit is in 'sub rangesort',
and, in fact, the following tiny patch will fix it:


--- pdf2index.orig      Wed Mar 19 20:56:11 2003
+++ pdf2index   Wed Mar 19 20:56:25 2003
@@ -114,7 +114,7 @@
     # Make sure roman pages come before arabic ones, otherwise sort them in order
     return -1 if ($apno !~ /^\d+/ && $bpno =~ /^\d+/);
     return  1 if ($apno =~ /^\d+/ && $bpno !~ /^\d+/);
-    return $apno cmp $bpno;
+    return $apno <=> $bpno;
 }
 
 sub rangelen {


I will file this at SourceForge.


-- 
Paul.

mailto:paulh at logicsquad dot net
mailto:phoadley at maths dot adelaide dot edu dot au


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]