Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Christian Persch
poppler
Commits
647a9813
Commit
647a9813
authored
Nov 16, 2018
by
Albert Astals Cid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save Object::copy on Page construction
parent
8f158da9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
poppler/Catalog.cc
poppler/Catalog.cc
+2
-2
poppler/PDFDoc.cc
poppler/PDFDoc.cc
+1
-1
poppler/Page.cc
poppler/Page.cc
+8
-8
poppler/Page.h
poppler/Page.h
+1
-1
No files found.
poppler/Catalog.cc
View file @
647a9813
...
...
@@ -293,7 +293,7 @@ bool Catalog::cachePageTree(int page)
Object
kid
=
kids
.
arrayGet
(
kidsIdx
);
if
(
kid
.
isDict
(
"Page"
)
||
(
kid
.
isDict
()
&&
!
kid
.
getDict
()
->
hasKey
(
"Kids"
)))
{
PageAttrs
*
attrs
=
new
PageAttrs
(
attrsList
->
back
(),
kid
.
getDict
());
auto
p
=
std
::
make_unique
<
Page
>
(
doc
,
pages
.
size
()
+
1
,
&
kid
,
auto
p
=
std
::
make_unique
<
Page
>
(
doc
,
pages
.
size
()
+
1
,
std
::
move
(
kid
)
,
kidRef
.
getRef
(),
attrs
,
form
);
if
(
!
p
->
isOk
())
{
error
(
errSyntaxError
,
-
1
,
"Failed to create page (page {0:uld})"
,
pages
.
size
()
+
1
);
...
...
@@ -739,7 +739,7 @@ int Catalog::getNumPages()
Dict
*
pageDict
=
pagesDict
.
getDict
();
if
(
pageRootRef
.
isRef
())
{
const
Ref
pageRef
=
pageRootRef
.
getRef
();
auto
p
=
std
::
make_unique
<
Page
>
(
doc
,
1
,
&
pagesDict
,
pageRef
,
new
PageAttrs
(
nullptr
,
pageDict
),
form
);
auto
p
=
std
::
make_unique
<
Page
>
(
doc
,
1
,
std
::
move
(
pagesDict
)
,
pageRef
,
new
PageAttrs
(
nullptr
,
pageDict
),
form
);
if
(
p
->
isOk
())
{
pages
.
emplace_back
(
std
::
move
(
p
),
pageRef
);
...
...
poppler/PDFDoc.cc
View file @
647a9813
...
...
@@ -2099,7 +2099,7 @@ Page *PDFDoc::parsePage(int page)
}
Dict
*
pageDict
=
obj
.
getDict
();
return
new
Page
(
this
,
page
,
&
obj
,
pageRef
,
return
new
Page
(
this
,
page
,
std
::
move
(
obj
)
,
pageRef
,
new
PageAttrs
(
nullptr
,
pageDict
),
catalog
->
getForm
());
}
...
...
poppler/Page.cc
View file @
647a9813
...
...
@@ -242,7 +242,7 @@ bool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) {
#define pageLocker() std::unique_lock<std::recursive_mutex> locker(mutex)
Page
::
Page
(
PDFDoc
*
docA
,
int
numA
,
Object
*
pageDict
,
Ref
pageRefA
,
PageAttrs
*
attrsA
,
Form
*
form
)
{
Page
::
Page
(
PDFDoc
*
docA
,
int
numA
,
Object
&&
pageDict
,
Ref
pageRefA
,
PageAttrs
*
attrsA
,
Form
*
form
)
{
ok
=
true
;
doc
=
docA
;
xref
=
doc
->
getXRef
();
...
...
@@ -250,7 +250,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at
duration
=
-
1
;
annots
=
nullptr
;
pageObj
=
pageDict
->
copy
(
);
pageObj
=
std
::
move
(
pageDict
);
pageRef
=
pageRefA
;
// get attributes
...
...
@@ -258,7 +258,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at
attrs
->
clipBoxes
();
// transtion
trans
=
page
Dict
->
dictLookupNF
(
"Trans"
);
trans
=
page
Obj
.
dictLookupNF
(
"Trans"
);
if
(
!
(
trans
.
isRef
()
||
trans
.
isDict
()
||
trans
.
isNull
()))
{
error
(
errSyntaxError
,
-
1
,
"Page transition object (page {0:d}) is wrong type ({1:s})"
,
num
,
trans
.
getTypeName
());
...
...
@@ -266,7 +266,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at
}
// duration
Object
tmp
=
page
Dict
->
dictLookupNF
(
"Dur"
);
Object
tmp
=
page
Obj
.
dictLookupNF
(
"Dur"
);
if
(
!
(
tmp
.
isNum
()
||
tmp
.
isNull
()))
{
error
(
errSyntaxError
,
-
1
,
"Page duration object (page {0:d}) is wrong type ({1:s})"
,
num
,
tmp
.
getTypeName
());
...
...
@@ -275,7 +275,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at
}
// annotations
annotsObj
=
page
Dict
->
dictLookupNF
(
"Annots"
);
annotsObj
=
page
Obj
.
dictLookupNF
(
"Annots"
);
if
(
!
(
annotsObj
.
isRef
()
||
annotsObj
.
isArray
()
||
annotsObj
.
isNull
()))
{
error
(
errSyntaxError
,
-
1
,
"Page annotations object (page {0:d}) is wrong type ({1:s})"
,
num
,
annotsObj
.
getTypeName
());
...
...
@@ -283,7 +283,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at
}
// contents
contents
=
page
Dict
->
dictLookupNF
(
"Contents"
);
contents
=
page
Obj
.
dictLookupNF
(
"Contents"
);
if
(
!
(
contents
.
isRef
()
||
contents
.
isArray
()
||
contents
.
isNull
()))
{
error
(
errSyntaxError
,
-
1
,
"Page contents object (page {0:d}) is wrong type ({1:s})"
,
...
...
@@ -292,7 +292,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at
}
// thumb
thumb
=
page
Dict
->
dictLookupNF
(
"Thumb"
);
thumb
=
page
Obj
.
dictLookupNF
(
"Thumb"
);
if
(
!
(
thumb
.
isStream
()
||
thumb
.
isNull
()
||
thumb
.
isRef
()))
{
error
(
errSyntaxError
,
-
1
,
"Page thumb object (page {0:d}) is wrong type ({1:s})"
,
num
,
thumb
.
getTypeName
());
...
...
@@ -300,7 +300,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at
}
// actions
actions
=
page
Dict
->
dictLookupNF
(
"AA"
);
actions
=
page
Obj
.
dictLookupNF
(
"AA"
);
if
(
!
(
actions
.
isDict
()
||
actions
.
isNull
()))
{
error
(
errSyntaxError
,
-
1
,
"Page additional action object (page {0:d}) is wrong type ({1:s})"
,
num
,
actions
.
getTypeName
());
...
...
poppler/Page.h
View file @
647a9813
...
...
@@ -141,7 +141,7 @@ class Page {
public:
// Constructor.
Page
(
PDFDoc
*
docA
,
int
numA
,
Object
*
pageDict
,
Ref
pageRefA
,
PageAttrs
*
attrsA
,
Form
*
form
);
Page
(
PDFDoc
*
docA
,
int
numA
,
Object
&&
pageDict
,
Ref
pageRefA
,
PageAttrs
*
attrsA
,
Form
*
form
);
// Destructor.
~
Page
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment