Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
64a9c5c7
Commit
64a9c5c7
authored
Feb 07, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing warning act 4 not very proud of changes
parent
0e3b8447
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
91 additions
and
88 deletions
+91
-88
ASCIIHexDecode.cpp
src/pdf-merger/ASCIIHexDecode.cpp
+1
-1
AbstractBoxElementHandler.h
src/pdf-merger/AbstractBoxElementHandler.h
+2
-2
AnnotsHandler.cpp
src/pdf-merger/AnnotsHandler.cpp
+2
-2
Filter.cpp
src/pdf-merger/Filter.cpp
+2
-2
FilterPredictor.cpp
src/pdf-merger/FilterPredictor.cpp
+4
-4
FlateDecode.cpp
src/pdf-merger/FlateDecode.cpp
+1
-1
LZWDecode.cpp
src/pdf-merger/LZWDecode.cpp
+1
-1
MediaBoxElementHandler.h
src/pdf-merger/MediaBoxElementHandler.h
+1
-1
Object.cpp
src/pdf-merger/Object.cpp
+6
-6
Page.cpp
src/pdf-merger/Page.cpp
+15
-13
PageElementHandler.cpp
src/pdf-merger/PageElementHandler.cpp
+2
-2
PageElementHandler.h
src/pdf-merger/PageElementHandler.h
+2
-2
Parser.cpp
src/pdf-merger/Parser.cpp
+47
-46
Rectangle.cpp
src/pdf-merger/Rectangle.cpp
+3
-3
UBWebPage.cpp
src/web/UBWebPage.cpp
+2
-2
No files found.
src/pdf-merger/ASCIIHexDecode.cpp
View file @
64a9c5c7
...
...
@@ -57,7 +57,7 @@ bool ASCIIHexDecode::decode(std::string & encoded)
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
unsigned
char
ch
=
encoded
[
i
];
if
(
WHITESPACES
.
find
(
ch
)
!=
-
1
)
if
(
(
int
)
WHITESPACES
.
find
(
ch
)
!=
-
1
)
{
continue
;
}
...
...
src/pdf-merger/AbstractBoxElementHandler.h
View file @
64a9c5c7
...
...
@@ -42,7 +42,7 @@ namespace merge_lib
{
unsigned
int
startOfParent
=
content
.
find
(
"/Parent"
);
unsigned
int
endOfParent
=
content
.
find
(
" R"
,
startOfParent
);
if
(
startOfParent
==
-
1
)
if
(
(
int
)
startOfParent
==
-
1
)
break
;
std
::
vector
<
Object
*>
parents
=
parent
->
getChildrenByBounds
(
startOfParent
,
endOfParent
);
if
(
parents
.
size
()
!=
1
)
...
...
@@ -50,7 +50,7 @@ namespace merge_lib
parent
=
parents
[
0
];
std
::
string
parentContent
=
parent
->
getObjectContent
();
unsigned
int
startOfMediaBox
=
parentContent
.
find
(
_handlerName
);
if
(
startOfMediaBox
==
-
1
)
if
(
(
int
)
startOfMediaBox
==
-
1
)
{
content
=
parentContent
;
continue
;
...
...
src/pdf-merger/AnnotsHandler.cpp
View file @
64a9c5c7
...
...
@@ -36,8 +36,8 @@ void AnnotsHandler::_processObjectContent(unsigned int startOfPageElement)
{
Object
*
child
=
_annotations
[
0
];
std
::
string
childContent
=
child
->
getObjectContent
();
if
(
Parser
::
findToken
(
childContent
,
"/Rect"
)
==
-
1
&&
Parser
::
findToken
(
childContent
,
"/Subtype"
)
==
-
1
)
if
(
(
int
)
Parser
::
findToken
(
childContent
,
"/Rect"
)
==
-
1
&&
(
int
)
Parser
::
findToken
(
childContent
,
"/Subtype"
)
==
-
1
)
{
// this was not Annotation but reference to array
// of annotations
...
...
src/pdf-merger/Filter.cpp
View file @
64a9c5c7
...
...
@@ -63,12 +63,12 @@ std::vector <Decoder * > Filter::_getDecoders()
while
(
1
)
{
startOfDecoder
=
streamHeader
.
find
(
"/"
,
startOfDecoder
);
if
(
startOfDecoder
==
-
1
)
if
(
(
int
)
startOfDecoder
==
-
1
)
break
;
else
++
startOfDecoder
;
unsigned
int
endOfDecoder
=
streamHeader
.
find_first_of
(
whitespacesAndDelimeters
,
startOfDecoder
);
if
(
endOfDecoder
==
-
1
)
if
(
(
int
)
endOfDecoder
==
-
1
)
break
;
std
::
map
<
std
::
string
,
Decoder
*>::
iterator
foundDecoder
=
_allDecoders
.
find
(
streamHeader
.
substr
(
startOfDecoder
,
endOfDecoder
-
startOfDecoder
));
...
...
src/pdf-merger/FilterPredictor.cpp
View file @
64a9c5c7
...
...
@@ -59,14 +59,14 @@ FilterPredictor::~FilterPredictor()
std
::
string
FilterPredictor
::
getDictionaryContentStr
(
std
::
string
&
in
,
size_t
&
pos
)
{
size_t
beg
=
in
.
find
(
DICT_START_TOKEN
,
pos
);
if
(
beg
==
-
1
)
if
(
(
int
)
beg
==
-
1
)
{
return
""
;
}
beg
+=
DICT_START_TOKEN
.
size
();
size_t
end
=
in
.
find
(
DICT_END_TOKEN
,
beg
);
if
(
end
==
-
1
)
if
(
(
int
)
end
==
-
1
)
{
return
""
;
}
...
...
@@ -92,7 +92,7 @@ void FilterPredictor::obtainDecodeParams(Object *objectWithStream, std::string &
for
(;
it
!=
params
.
end
();
it
++
)
{
size_t
pos
=
dictStr
.
find
((
*
it
).
first
);
if
(
pos
!=
-
1
)
if
(
(
int
)
pos
!=
-
1
)
{
pos
+=
(
*
it
).
first
.
size
();
...
...
@@ -123,7 +123,7 @@ void FilterPredictor::initialize(Object *objectWithStream)
objectWithStream
->
getHeader
(
content
);
// we need to parse the header of file to obtain the decoder parameter
size_t
position
=
content
.
find
(
DECODE_PARAM_TOKEN
);
if
(
position
!=
-
1
)
if
(
(
int
)
position
!=
-
1
)
{
position
+=
DECODE_PARAM_TOKEN
.
size
();
std
::
string
dictStr
=
getDictionaryContentStr
(
content
,
position
);
...
...
src/pdf-merger/FlateDecode.cpp
View file @
64a9c5c7
...
...
@@ -47,7 +47,7 @@ void FlateDecode::initialize(Object * objectWithStream)
std
::
string
head
;
objectWithStream
->
getHeader
(
head
);
if
(
head
.
find
(
FilterPredictor
::
DECODE_PARAM_TOKEN
)
!=
-
1
)
if
(
(
int
)
head
.
find
(
FilterPredictor
::
DECODE_PARAM_TOKEN
)
!=
-
1
)
{
_predict
=
new
FilterPredictor
();
_predict
->
initialize
(
objectWithStream
);
...
...
src/pdf-merger/LZWDecode.cpp
View file @
64a9c5c7
...
...
@@ -59,7 +59,7 @@ void LZWDecode::initialize(Object * objectWithStream)
std
::
string
head
;
objectWithStream
->
getHeader
(
head
);
if
(
head
.
find
(
FilterPredictor
::
DECODE_PARAM_TOKEN
)
!=
-
1
)
if
(
(
int
)
head
.
find
(
FilterPredictor
::
DECODE_PARAM_TOKEN
)
!=
-
1
)
{
_predict
=
new
FilterPredictor
();
_predict
->
initialize
(
objectWithStream
);
...
...
src/pdf-merger/MediaBoxElementHandler.h
View file @
64a9c5c7
...
...
@@ -59,7 +59,7 @@ namespace merge_lib
}
bool
_wasCropBoxHandlerCalled
()
{
return
(
_page
->
getObjectContent
().
find
(
"/BBox"
)
!=
-
1
)
?
true
:
false
;
return
(
(
int
)
_page
->
getObjectContent
().
find
(
"/BBox"
)
!=
-
1
)
?
true
:
false
;
}
};
}
...
...
src/pdf-merger/Object.cpp
View file @
64a9c5c7
...
...
@@ -369,7 +369,7 @@ bool Object::_findObject(const std::string & token, Object* & foundObject, unsig
{
_isPassed
=
true
;
tokenPositionInContent
=
Parser
::
findToken
(
_content
,
token
);
if
(
tokenPositionInContent
!=
-
1
)
if
(
(
int
)
tokenPositionInContent
!=
-
1
)
{
foundObject
=
this
;
return
true
;
...
...
@@ -456,12 +456,12 @@ bool Object::getStream(std::string & stream)
bool
Object
::
_getStreamFromContent
(
std
::
string
&
stream
)
{
size_t
stream_begin
=
_content
.
find
(
"stream"
);
if
(
stream_begin
==
-
1
)
if
(
(
int
)
stream_begin
==
-
1
)
{
return
false
;
}
size_t
stream_end
=
_content
.
find
(
"endstream"
,
stream_begin
);
if
(
stream_end
==
-
1
)
if
(
(
int
)
stream_end
==
-
1
)
{
return
false
;
}
...
...
@@ -558,7 +558,7 @@ std::string Object::getNameSimpleValue(const std::string &content, const std::st
Object
*
Object
::
findPatternInObjOrParents
(
const
std
::
string
&
pattern
)
{
std
::
string
content
=
getObjectContent
();
if
(
Parser
::
findToken
(
content
,
pattern
,
0
)
!=
-
1
)
if
(
(
int
)
Parser
::
findToken
(
content
,
pattern
,
0
)
!=
-
1
)
{
return
this
;
}
...
...
@@ -569,7 +569,7 @@ Object* Object::findPatternInObjOrParents(const std::string &pattern)
{
unsigned
int
startOfParent
=
content
.
find
(
"/Parent"
);
unsigned
int
endOfParent
=
content
.
find
(
" R"
,
startOfParent
);
if
(
startOfParent
==
-
1
)
if
(
(
int
)
startOfParent
==
-
1
)
{
break
;
}
...
...
@@ -581,7 +581,7 @@ Object* Object::findPatternInObjOrParents(const std::string &pattern)
parent
=
parents
[
0
];
std
::
string
parentContent
=
parent
->
getObjectContent
();
unsigned
int
startOfPattern
=
parentContent
.
find
(
pattern
);
if
(
startOfPattern
==
-
1
)
if
(
(
int
)
startOfPattern
==
-
1
)
{
content
=
parentContent
;
continue
;
...
...
src/pdf-merger/Page.cpp
View file @
64a9c5c7
...
...
@@ -167,6 +167,8 @@ void _recalculateAnnotsCoordinates(Object * annotation,
const
Rectangle
&
outputPagesRectangle
,
const
MergePageDescription
&
description
)
{
Q_UNUSED
(
outputPagesRectangle
);
Q_UNUSED
(
basePagesRectangle
);
std
::
string
annotsRectangleName
(
"/Rect"
);
Object
*
objectWithRectangle
;
unsigned
int
fake
;
...
...
@@ -193,7 +195,7 @@ static void _updateAnnotParentPage(Object *annotation,Object *newParentPage)
std
::
string
&
annotContent
=
annotation
->
getObjectContent
();
size_t
startOfP
=
Parser
::
findTokenName
(
annotContent
,
strP
);
if
(
startOfP
==
-
1
)
if
(
(
int
)
startOfP
==
-
1
)
{
return
;
}
...
...
@@ -229,12 +231,12 @@ static void _updateAnnotParentPage(Object *annotation,Object *newParentPage)
static
void
_updateAnnotFormColor
(
Object
*
annotation
)
{
std
::
string
&
objectContent
=
annotation
->
getObjectContent
();
if
(
objectContent
.
find
(
"/Widget"
)
==
-
1
)
if
(
(
int
)
objectContent
.
find
(
"/Widget"
)
==
-
1
)
{
return
;
}
size_t
startOfAP
=
Parser
::
findTokenName
(
objectContent
,
"/AP"
);
if
(
startOfAP
==
-
1
)
if
(
(
int
)
startOfAP
==
-
1
)
{
return
;
}
...
...
@@ -262,7 +264,7 @@ static void _updateAnnotFormColor(Object *annotation )
{
if
(
token
==
"f"
||
token
==
"F"
)
{
if
(
found
!=
-
1
)
if
((
int
)
found
!=
-
1
)
{
decodedStream
[
found
]
=
' '
;
}
...
...
@@ -272,7 +274,7 @@ static void _updateAnnotFormColor(Object *annotation )
// Then we need to update Filter section (if any)
std
::
string
filterStr
=
"/Filter"
;
size_t
startOfFlate
=
Parser
::
findTokenName
(
content
,
filterStr
);
if
(
startOfFlate
!=
-
1
)
if
(
(
int
)
startOfFlate
!=
-
1
)
{
size_t
endOfFlate
=
Parser
::
findEndOfElementContent
(
content
,
startOfFlate
+
filterStr
.
size
());
childWithAP
->
eraseContent
(
startOfFlate
,
endOfFlate
-
startOfFlate
);
...
...
@@ -285,7 +287,7 @@ static void _updateAnnotFormColor(Object *annotation )
// update the length field
std
::
string
lengthStr
=
"/Length"
;
size_t
startOfLength
=
Parser
::
findTokenName
(
content
,
lengthStr
,
0
);
if
(
startOfLength
!=
-
1
)
if
(
(
int
)
startOfLength
!=
-
1
)
{
size_t
endOfLength
=
Parser
::
findEndOfElementContent
(
content
,
startOfLength
+
lengthStr
.
size
());
childWithAP
->
eraseContent
(
startOfLength
,
endOfLength
-
startOfLength
);
...
...
@@ -296,10 +298,10 @@ static void _updateAnnotFormColor(Object *annotation )
// update the stream of object with new content
std
::
string
stream
(
"stream"
);
size_t
leftBoundOfContentStream
=
content
.
find
(
stream
);
if
(
leftBoundOfContentStream
!=
-
1
)
if
(
(
int
)
leftBoundOfContentStream
!=
-
1
)
{
size_t
rightBoundOfContentStream
=
content
.
find
(
"endstream"
,
leftBoundOfContentStream
);
if
(
rightBoundOfContentStream
==
-
1
)
if
(
(
int
)
rightBoundOfContentStream
==
-
1
)
{
rightBoundOfContentStream
=
content
.
size
()
-
1
;
}
...
...
@@ -323,7 +325,7 @@ static void processBasePageResources(Object *basePage)
return
;
}
std
::
string
resourceToken
=
"/Resources"
;
if
(
Parser
::
findTokenName
(
basePage
->
getObjectContent
(),
resourceToken
)
==
-
1
)
if
(
(
int
)
Parser
::
findTokenName
(
basePage
->
getObjectContent
(),
resourceToken
)
==
-
1
)
{
// it seems base page does not have resources, they can be located in parent!
Object
*
resource
=
basePage
->
findPatternInObjOrParents
(
resourceToken
);
...
...
@@ -331,20 +333,20 @@ static void processBasePageResources(Object *basePage)
{
std
::
string
&
resContStr
=
resource
->
getObjectContent
();
size_t
startOfRes
=
Parser
::
findTokenName
(
resContStr
,
resourceToken
);
if
(
startOfRes
==
-
1
)
if
(
(
int
)
startOfRes
==
-
1
)
{
// no resources at all
return
;
}
size_t
endOfRes
=
Parser
::
findEndOfElementContent
(
resContStr
,
startOfRes
+
resourceToken
.
size
());
if
(
endOfRes
==
-
1
)
if
(
(
int
)
endOfRes
==
-
1
)
{
return
;
// broken resources
}
std
::
string
resourceContent
=
resContStr
.
substr
(
startOfRes
,
endOfRes
-
startOfRes
);
size_t
positionToInsert
=
basePage
->
getObjectContent
().
find
(
"<<"
);
if
(
positionToInsert
==
-
1
)
if
(
(
int
)
positionToInsert
==
-
1
)
{
positionToInsert
=
0
;
resourceContent
.
insert
(
0
,
"<<"
);
...
...
@@ -479,7 +481,7 @@ void Page::merge(Page * sourcePage, Document * parentDocument, MergePageDescript
rotationHandler
.
processObjectContent
();
description
.
basePageTransformation
.
addRotation
(
_rotation
);
if
(
sourcePage
->
_root
->
getObjectContent
().
find
(
"/Annots"
)
!=
-
1
)
if
(
(
int
)
sourcePage
->
_root
->
getObjectContent
().
find
(
"/Annots"
)
!=
-
1
)
{
Object
*
crop
=
sourcePage
->
_root
->
findPatternInObjOrParents
(
"/CropBox"
);
if
(
crop
)
...
...
src/pdf-merger/PageElementHandler.cpp
View file @
64a9c5c7
...
...
@@ -73,10 +73,10 @@ unsigned int PageElementHandler::_findEndOfElementContent(unsigned int startOfPa
static
std
::
string
whitespacesAndDelimeters
(
"
\t\f\v\n\r
<<[/"
);
unsigned
int
foundSlash
=
_pageContent
.
find
(
"/"
,
startOfPageElement
+
1
);
std
::
string
fieldType
;
while
(
foundSlash
!=
-
1
)
while
(
(
int
)
foundSlash
!=
-
1
)
{
unsigned
int
foundWhitespace
=
_pageContent
.
find_first_of
(
whitespacesAndDelimeters
,
foundSlash
+
1
);
if
(
foundWhitespace
!=
-
1
)
if
(
(
int
)
foundWhitespace
!=
-
1
)
fieldType
=
_pageContent
.
substr
(
foundSlash
+
1
,
foundWhitespace
-
foundSlash
-
1
);
else
break
;
...
...
src/pdf-merger/PageElementHandler.h
View file @
64a9c5c7
...
...
@@ -46,7 +46,7 @@ namespace merge_lib
void
processObjectContent
()
{
unsigned
int
startOfPageElement
=
_findStartOfPageElement
();
if
(
startOfPageElement
!=
-
1
)
if
(
(
int
)
startOfPageElement
!=
-
1
)
_processObjectContent
(
startOfPageElement
);
if
(
_nextHandler
)
_nextHandler
->
processObjectContent
();
...
...
@@ -55,7 +55,7 @@ namespace merge_lib
void
changeObjectContent
()
{
unsigned
int
startOfPageElement
=
_findStartOfPageElement
();
if
(
startOfPageElement
!=
-
1
)
if
(
(
int
)
startOfPageElement
!=
-
1
)
_changeObjectContent
(
startOfPageElement
);
else
_pageElementNotFound
();
...
...
src/pdf-merger/Parser.cpp
View file @
64a9c5c7
This diff is collapsed.
Click to expand it.
src/pdf-merger/Rectangle.cpp
View file @
64a9c5c7
...
...
@@ -42,14 +42,14 @@ _rectangleName(rectangleName)
{
unsigned
int
rectanglePosition
=
Parser
::
findToken
(
content
,
rectangleName
);
if
(
rectanglePosition
==
-
1
)
if
(
(
int
)
rectanglePosition
==
-
1
)
{
std
::
cerr
<<
"Unable to find rectangle name "
<<
rectangleName
<<
" in content
\n
"
;
}
size_t
beg
=
content
.
find
(
"["
,
rectanglePosition
);
size_t
end
=
content
.
find
(
"]"
,
rectanglePosition
);
if
(
beg
!=
-
1
&&
end
!=
-
1
)
if
(
(
int
)
beg
!=
-
1
&&
(
int
)
end
!=
-
1
)
{
std
::
string
arr
=
content
.
substr
(
beg
+
1
,
end
-
beg
-
1
);
std
::
stringstream
in
;
...
...
@@ -119,7 +119,7 @@ void Rectangle::updateRectangle(Object * objectWithRectangle, const char * delim
std
::
string
objectContent
=
objectWithMatrix
->
getObjectContent
();
unsigned
int
matrixPosition
=
Parser
::
findToken
(
objectContent
,
"/Matrix"
);
if
(
matrixPosition
==
-
1
)
if
(
(
int
)
matrixPosition
==
-
1
)
continue
;
unsigned
int
matrixValueLeftBound
=
objectContent
.
find
(
"["
,
matrixPosition
);
unsigned
int
matrixValueRightBound
=
objectContent
.
find
(
"]"
,
matrixValueLeftBound
)
+
1
;
...
...
src/web/UBWebPage.cpp
View file @
64a9c5c7
...
...
@@ -47,8 +47,8 @@ class UBWebPluginFactory : public QWebPluginFactory
QObject
*
create
(
const
QString
&
mimeType
,
const
QUrl
&
url
,
const
QStringList
&
argumentNames
,
const
QStringList
&
argumentValues
)
const
{
Q_UNUSED
(
url
);
Q_UNUSED
(
argumentNames
);
Q_UNUSED
(
argumentValues
);
Q_UNUSED
(
argumentNames
);
Q_UNUSED
(
argumentValues
);
if
(
mimeType
==
"application/x-ub-pdf"
)
{
...
...
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