aboutsummaryrefslogtreecommitdiff
path: root/pdf/pdf.go
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-02-04 05:03:09 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-02-04 05:16:28 +0100
commitff7de4b141c1d8c52d64a573e85d65852a91f76a (patch)
tree7876563045e6715e283db45cdb18e7907dbc6bd9 /pdf/pdf.go
parent0b837b3a0eb0934a0c1543218238944b1bd857b8 (diff)
downloadpdf-simple-sign-ff7de4b141c1d8c52d64a573e85d65852a91f76a.tar.gz
pdf-simple-sign-ff7de4b141c1d8c52d64a573e85d65852a91f76a.tar.xz
pdf-simple-sign-ff7de4b141c1d8c52d64a573e85d65852a91f76a.zip
Go: cleanup
Diffstat (limited to 'pdf/pdf.go')
-rw-r--r--pdf/pdf.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/pdf/pdf.go b/pdf/pdf.go
index 1e8cfdc..f6dda31 100644
--- a/pdf/pdf.go
+++ b/pdf/pdf.go
@@ -809,8 +809,8 @@ func (u *Updater) loadXrefStream(
r.compressed = &f2
r.nonfree = true
default:
- // TODO: It should be treated as a reference to the null object.
- // We can't currently represent that.
+ // TODO(p): It should be treated as a reference to
+ // the null object. We can't currently represent that.
return newError("unsupported cross-reference stream contents")
}
@@ -924,7 +924,7 @@ func NewUpdater(document []byte) (*Updater, error) {
}
loadedXrefs[xrefOffset] = struct{}{}
- // TODO: Descend into XRefStm here first, if present,
+ // TODO(p): Descend into XRefStm here first, if present,
// which is also a linked list.
// We allow for mixed cross-reference tables and streams
@@ -1213,7 +1213,7 @@ func (u *Updater) flushXRefStm(updated []uint, buf *bytes.Buffer) {
fmt.Fprintf(buf, "\n%d 0 obj\n%s\nendobj", n, stream.Serialize())
}
-func (u *Updater) flushXRef(updated []uint, buf *bytes.Buffer) {
+func (u *Updater) flushXRefTable(updated []uint, buf *bytes.Buffer) {
buf.WriteString("\nxref\n")
for i := 0; i < len(updated); {
start, stop := updated[i], updated[i]+1
@@ -1245,7 +1245,7 @@ func (u *Updater) flushXRef(updated []uint, buf *bytes.Buffer) {
fmt.Fprintf(buf, "trailer\n%s", trailer.Serialize())
}
-// FlushUpdates writes an updated cross-reference table and trailer.
+// FlushUpdates writes an updated cross-reference table and trailer, or stream.
func (u *Updater) FlushUpdates() {
updated := make([]uint, 0, len(u.updated))
for n := range u.updated {
@@ -1266,7 +1266,7 @@ func (u *Updater) FlushUpdates() {
if typ, _ := u.Trailer["Type"]; typ.Kind == Name && typ.String == "XRef" {
u.flushXRefStm(updated, buf)
} else {
- u.flushXRef(updated, buf)
+ u.flushXRefTable(updated, buf)
}
fmt.Fprintf(buf, "\nstartxref\n%d\n%%%%EOF\n", startXref)
@@ -1302,7 +1302,7 @@ func (u *Updater) GetStreamData(stream Object) ([]byte, error) {
return nil, errors.New("unsupported stream Filter")
}
- // TODO: Support << /Columns N /Predictor 12 >>
+ // TODO(p): Support << /Columns N /Predictor 12 >>
// which usually appears in files with cross-reference streams.
if parms, ok := stream.Dict["DecodeParms"]; ok && parms.Kind != Nil {
return nil, errors.New("DecodeParms are not supported")