summaryrefslogtreecommitdiff
path: root/compare.go
diff options
context:
space:
mode:
authorKurt Jung <kurt.w.jung@gmail.com>2015-10-10 14:16:23 -0400
committerKurt Jung <kurt.w.jung@gmail.com>2015-10-10 14:16:23 -0400
commit5847afd8a205853a7effbf749b7a388ae325eb24 (patch)
tree4842ab4870a4786a3d6d8218e24e71f1978e00dd /compare.go
parente924055b983321336e31f556f5235ea79fe72134 (diff)
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.
Diffstat (limited to 'compare.go')
-rw-r--r--compare.go15
1 files changed, 1 insertions, 14 deletions
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