From 5847afd8a205853a7effbf749b7a388ae325eb24 Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Sat, 10 Oct 2015 14:16:23 -0400 Subject: Introduce helper functions to set default catalog sort flag and creation date value. Remove regular expression scheme that effectively ignored the embedded creation date when comparing PDFs. --- compare.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'compare.go') diff --git a/compare.go b/compare.go index 6a79cba..3fd7eaf 100644 --- a/compare.go +++ b/compare.go @@ -21,15 +21,6 @@ import ( "fmt" "io" "io/ioutil" - "regexp" -) - -var ( - // 00000230 44 46 20 31 2e 37 29 0a 2f 43 72 65 61 74 69 6f |DF 1.7)./Creatio| - // 00000240 6e 44 61 74 65 20 28 44 3a 32 30 31 35 31 30 30 |nDate (D:2015100| - // 00000250 38 31 32 33 30 34 35 29 0a 3e 3e 0a 65 6e 64 6f |8123045).>>.endo| - creationDateRe = regexp.MustCompile("/CreationDate \\(D:\\d{14}\\)") - fixDate = []byte("/CreationDate (D:20000101000000)") ) func writeBytes(leadStr string, startPos int, sl []byte) { @@ -71,15 +62,11 @@ func checkBytes(pos int, sl1, sl2 []byte) (eq bool) { } // compareBytes compares the bytes referred to by sl1 with those referred to by -// sl2. The comparison is done byte-for-byte with the exception of the -// CreationDate fields which are effectively ignored. Nil is returned if the -// buffers are equal, otherwise an error. +// sl2. Nil is returned if the buffers are equal, otherwise an error. func compareBytes(sl1, sl2 []byte) (err error) { var posStart, posEnd, len1, len2, length int var diffs bool - sl1 = creationDateRe.ReplaceAll(sl1, fixDate) - sl2 = creationDateRe.ReplaceAll(sl2, fixDate) len1 = len(sl1) len2 = len(sl2) length = len1 -- cgit v1.2.1-24-ge1ad