diff --git a/src/pdf-merger/ASCIIHexDecode.cpp b/src/pdf-merger/ASCIIHexDecode.cpp index 93aa990e..b35ac297 100644 --- a/src/pdf-merger/ASCIIHexDecode.cpp +++ b/src/pdf-merger/ASCIIHexDecode.cpp @@ -57,7 +57,7 @@ bool ASCIIHexDecode::decode(std::string & encoded) for(int i = 0;i 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; diff --git a/src/pdf-merger/AnnotsHandler.cpp b/src/pdf-merger/AnnotsHandler.cpp index 0b05a98c..afc86ca0 100644 --- a/src/pdf-merger/AnnotsHandler.cpp +++ b/src/pdf-merger/AnnotsHandler.cpp @@ -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 diff --git a/src/pdf-merger/Filter.cpp b/src/pdf-merger/Filter.cpp index 8f67bb81..f7687837 100644 --- a/src/pdf-merger/Filter.cpp +++ b/src/pdf-merger/Filter.cpp @@ -63,12 +63,12 @@ std::vector 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::iterator foundDecoder = _allDecoders.find(streamHeader.substr(startOfDecoder, endOfDecoder - startOfDecoder)); diff --git a/src/pdf-merger/FilterPredictor.cpp b/src/pdf-merger/FilterPredictor.cpp index b828c515..5e21f74f 100644 --- a/src/pdf-merger/FilterPredictor.cpp +++ b/src/pdf-merger/FilterPredictor.cpp @@ -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); diff --git a/src/pdf-merger/FlateDecode.cpp b/src/pdf-merger/FlateDecode.cpp index 4b9fd9ca..8d128b4b 100644 --- a/src/pdf-merger/FlateDecode.cpp +++ b/src/pdf-merger/FlateDecode.cpp @@ -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); diff --git a/src/pdf-merger/LZWDecode.cpp b/src/pdf-merger/LZWDecode.cpp index 0669dd7b..3b2374ab 100644 --- a/src/pdf-merger/LZWDecode.cpp +++ b/src/pdf-merger/LZWDecode.cpp @@ -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); diff --git a/src/pdf-merger/MediaBoxElementHandler.h b/src/pdf-merger/MediaBoxElementHandler.h index b942d4a1..5157fe46 100644 --- a/src/pdf-merger/MediaBoxElementHandler.h +++ b/src/pdf-merger/MediaBoxElementHandler.h @@ -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; } }; } diff --git a/src/pdf-merger/Object.cpp b/src/pdf-merger/Object.cpp index b06d4361..b565ae23 100644 --- a/src/pdf-merger/Object.cpp +++ b/src/pdf-merger/Object.cpp @@ -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; diff --git a/src/pdf-merger/Page.cpp b/src/pdf-merger/Page.cpp index 3cb7c18b..f91e7615 100644 --- a/src/pdf-merger/Page.cpp +++ b/src/pdf-merger/Page.cpp @@ -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 ) diff --git a/src/pdf-merger/PageElementHandler.cpp b/src/pdf-merger/PageElementHandler.cpp index 462ea8b7..b14a1b2e 100644 --- a/src/pdf-merger/PageElementHandler.cpp +++ b/src/pdf-merger/PageElementHandler.cpp @@ -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; diff --git a/src/pdf-merger/PageElementHandler.h b/src/pdf-merger/PageElementHandler.h index c00cd93e..4bec9593 100644 --- a/src/pdf-merger/PageElementHandler.h +++ b/src/pdf-merger/PageElementHandler.h @@ -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(); diff --git a/src/pdf-merger/Parser.cpp b/src/pdf-merger/Parser.cpp index 18c08541..44c68b14 100644 --- a/src/pdf-merger/Parser.cpp +++ b/src/pdf-merger/Parser.cpp @@ -12,6 +12,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + +#include #include #include #include @@ -57,8 +59,8 @@ void Parser::_retrieveAllPages(Object * objectWithKids) unsigned int startOfKids = objectContent.find("/Kids"); unsigned int endOfKids = objectContent.find("]", startOfKids); if( - (startOfKids == -1) && - (objectContent.find("/Page") != -1) + ((int)startOfKids == -1) && + ((int)objectContent.find("/Page") != -1) ) { unsigned int numberOfPages = _document->_pages.size() + 1; @@ -77,11 +79,11 @@ void Parser::_retrieveAllPages(Object * objectWithKids) void Parser::_createDocument(const char * docName) { + Q_UNUSED(docName); _document->_root = _root; - Object * objectWithPages = 0; std::string & rootContent = _root->getObjectContent(); unsigned int startOfPages = rootContent.find("/Pages"); - if(startOfPages == -1) + if((int)startOfPages == -1) throw Exception("Some document is wrong"); unsigned int endOfPages = rootContent.find("R", startOfPages); std::vector objectWithKids = _root->getChildrenByBounds(startOfPages, endOfPages); @@ -187,19 +189,19 @@ const std::map & Parser::_get static std::map > searchResult; searchResult.clear(); unsigned int streamStart = objectContent.find("stream"); - if(streamStart == -1) + if((int)streamStart == -1) streamStart = objectContent.size(); while(startOfNextSearch < streamStart) { //try to find reference. reference example is 15 0 R startOfNextSearch = objectContent.find(" R", startOfNextSearch); currentPosition = startOfNextSearch; - if(currentPosition != -1) + if((int)currentPosition != -1) { //check that next character of " R" is WHITESPACE. - if((WHITESPACES.find(objectContent[currentPosition + 2]) == -1) && - (DELIMETERS.find(objectContent[currentPosition + 2]) == -1) + if(((int)WHITESPACES.find(objectContent[currentPosition + 2]) == -1) && + ((int)DELIMETERS.find(objectContent[currentPosition + 2]) == -1) ) { //this is not reference. this is something looks like "0 0 0 RG" @@ -257,7 +259,7 @@ const std::map & Parser::_get unsigned int Parser::_skipNumber(const std::string & str, unsigned int currentPosition) { unsigned int numberSearchCounter = currentPosition; - while((NUMBERS.find(str[numberSearchCounter]) != -1) && --numberSearchCounter) + while(((int)NUMBERS.find(str[numberSearchCounter]) != -1) && --numberSearchCounter) {} return numberSearchCounter; @@ -281,17 +283,16 @@ void Parser::_readXRefAndCreateObjects() //now we are reading the xref while(1) { - unsigned int firstObjectNumber = Utils::stringToInt(_getNextToken(currentPostion)); + Utils::stringToInt(_getNextToken(currentPostion)); unsigned int objectCount = Utils::stringToInt(_getNextToken(currentPostion)); for(unsigned int i(0); i < objectCount; i++) { unsigned long first; - unsigned long second; if(_countTokens(currentPostion, _getEndOfLineFromContent(currentPostion)) == 3) { first = Utils::stringToInt(_getNextToken(currentPostion)); - second = Utils::stringToInt(_getNextToken(currentPostion)); + Utils::stringToInt(_getNextToken(currentPostion)); const string & use = _getNextToken(currentPostion); if(!use.compare("n")) { @@ -367,10 +368,10 @@ const std::pair & Parser::_getLineBounds(const std:: { static std::pair bounds; bounds.first = str.rfind('\n', fromPosition); - if(bounds.first == -1) + if((int)bounds.first == -1) bounds.first = 0; bounds.second = str.find('\n', fromPosition); - if(bounds.second == -1) + if((int)bounds.second == -1) bounds.second = str.size(); return bounds; } @@ -405,7 +406,7 @@ unsigned int Parser::_countTokens(unsigned int leftBound, unsigned int rightBoun while (position < rightBount) { position = _fileContent.find_first_of(WHITESPACES, position); - if (position != -1) + if ((int)position != -1) ++tokensCount; //start search from next symbol ++position; @@ -416,7 +417,7 @@ unsigned int Parser::_countTokens(unsigned int leftBound, unsigned int rightBoun unsigned int Parser::_skipWhiteSpaces(const std::string & str, unsigned int fromPosition) { unsigned int position = fromPosition; - if(WHITESPACES.find(str[0]) != -1) + if((int)WHITESPACES.find(str[0]) != -1) position = str.find_first_not_of(WHITESPACES, position); return position; } @@ -424,7 +425,7 @@ unsigned int Parser::_skipWhiteSpaces(const std::string & str, unsigned int from unsigned int Parser::_skipWhiteSpacesFromContent(unsigned int fromPosition) { unsigned int position = fromPosition; - if(WHITESPACES.find(_fileContent[position]) != -1) + if((int)WHITESPACES.find(_fileContent[position]) != -1) position = _fileContent.find_first_not_of(WHITESPACES, position);// + 1; return position; @@ -453,7 +454,7 @@ const std::string & Parser::_getObjectContent(unsigned int objectPosition, unsig static std::string objectContent; size_t contentStart = _fileContent.find_first_not_of(Parser::WHITESPACES,currentPosition); - if( contentStart == -1 ) + if((int) contentStart == -1 ) { std::stringstream strOut; strOut<<"Wrong object "<< objectNumber<< "in PDF, cannot find content for it\n"; @@ -461,13 +462,13 @@ const std::string & Parser::_getObjectContent(unsigned int objectPosition, unsig } currentPosition = contentStart; unsigned int endOfContent = _fileContent.find("endobj", contentStart); - if( endOfContent == -1 ) + if((int) endOfContent == -1 ) { stringstream errorMessage("Corrupted PDF file, obj does not have matching endobj"); throw Exception(errorMessage); } unsigned int endOfStream = _fileContent.find("endstream", currentPosition); - if((endOfStream != -1) && (endOfStream < endOfContent)) + if(((int)endOfStream != -1) && (endOfStream < endOfContent)) { std::string stream("stream"); unsigned int beginOfStream = _fileContent.find(stream, currentPosition) + stream.size(); @@ -484,7 +485,7 @@ const std::string & Parser::_getObjectContent(unsigned int objectPosition, unsig // try to use Length field to determine end of stream. std::string lengthToken = "/Length"; size_t lengthBegin = Parser::findTokenName(_fileContent,lengthToken,contentStart); - if ( lengthBegin != -1 ) + if ((int) lengthBegin != -1 ) { std::string lengthStr; size_t lenPos = lengthBegin + lengthToken.size(); @@ -512,7 +513,7 @@ const std::string & Parser::_getObjectContent(unsigned int objectPosition, unsig strin>>streamEnd; streamEnd += beginOfStream; unsigned int streamEndBegin = _fileContent.find("endstream",streamEnd); - if( streamEndBegin != -1 ) + if((int) streamEndBegin != -1 ) { endOfStream = streamEndBegin; } @@ -537,18 +538,18 @@ unsigned int Parser::_readTrailerAndReturnRoot() unsigned int startOfTrailer = Parser::findToken(_fileContent,"trailer", _getStartOfXrefWithRoot()); std::string rootStr("/Root"); unsigned int startOfRoot = Parser::findToken(_fileContent,rootStr.data(), startOfTrailer); - if( startOfRoot == -1) + if((int) startOfRoot == -1) { throw Exception("Cannot find Root object !"); } std::string encryptStr("/Encrypt"); - if( Parser::findToken(_fileContent,encryptStr,startOfTrailer) != -1 ) + if((int) Parser::findToken(_fileContent,encryptStr,startOfTrailer) != -1 ) { throw Exception("Encrypted PDF is not supported!"); } startOfRoot += rootStr.size()+1; //"/Root + ' ' unsigned int endOfRoot = startOfRoot; - while(NUMBERS.find(_fileContent[endOfRoot++]) != -1) + while((int)NUMBERS.find(_fileContent[endOfRoot++]) != -1) {} --endOfRoot; return Utils::stringToInt(_fileContent.substr(startOfRoot, endOfRoot - startOfRoot)); @@ -557,21 +558,21 @@ unsigned int Parser::_readTrailerAndReturnRoot() unsigned int Parser::_readTrailerAndRterievePrev(const unsigned int startPositionForSearch, unsigned int & previosXref) { unsigned int startOfTrailer = Parser::findToken(_fileContent,"trailer", startPositionForSearch); - if( startOfTrailer == -1 ) + if((int) startOfTrailer == -1 ) { throw Exception("Cannot find trailer!"); } unsigned int startOfPrev = _fileContent.find("Prev ", startOfTrailer); unsigned int startxref = _fileContent.find("startxref", startOfTrailer); - if(startOfPrev == -1 || (startOfPrev > startxref)) + if((int)startOfPrev == -1 || (startOfPrev > startxref)) return false; //"Prev "s length = 5 else startOfPrev += 5; unsigned int endOfPrev = startOfPrev; - while(NUMBERS.find(_fileContent[endOfPrev++]) != -1) + while((int)NUMBERS.find(_fileContent[endOfPrev++]) != -1) {} --endOfPrev; previosXref = Utils::stringToInt(_fileContent.substr(startOfPrev, endOfPrev - startOfPrev)); @@ -589,13 +590,13 @@ std::string Parser::getNextToken(const std::string &str, unsigned int &position } //skip first spaces size_t beg_pos = str.find_first_not_of(Parser::WHITESPACES,position); - if ( beg_pos == -1 ) + if ((int) beg_pos == -1 ) { // it is empty string! return ""; } size_t end_pos = str.find_first_of(Parser::WHITESPACES_AND_DELIMETERS,beg_pos); - if ( end_pos == -1 ) + if ((int) end_pos == -1 ) { end_pos = str.size(); } @@ -623,7 +624,7 @@ bool Parser::getNextWord(std::string &out, const std::string &str, size_t &nextP } //skip first spaces size_t beg_pos = str.find_first_not_of(Parser::WHITESPACES,nextPosition); - if ( beg_pos == -1 ) + if ((int) beg_pos == -1 ) { // it is empty string! return false; @@ -634,7 +635,7 @@ bool Parser::getNextWord(std::string &out, const std::string &str, size_t &nextP } size_t end_pos = str.find_first_of(Parser::WHITESPACES,beg_pos); - if ( end_pos == -1 ) + if ((int) end_pos == -1 ) { end_pos = str.size(); } @@ -656,8 +657,8 @@ void Parser::trim(std::string &str) { std::string::size_type pos1 = str.find_first_not_of(WHITESPACES); std::string::size_type pos2 = str.find_last_not_of(WHITESPACES); - str = str.substr(pos1 == -1 ? 0 : pos1, - pos2 == -1 ? str.length() - 1 : pos2 - pos1 + 1); + str = str.substr((int)pos1 == -1 ? 0 : pos1, + (int)pos2 == -1 ? str.length() - 1 : pos2 - pos1 + 1); } // Method tries to find the PDF token from the content @@ -665,7 +666,7 @@ void Parser::trim(std::string &str) std::string Parser::findTokenStr(const std::string &content, const std::string &pattern, size_t start, size_t &foundStart, size_t &foundEnd) { size_t cur_pos = Parser::findToken(content,pattern,start); - if( cur_pos == -1 ) + if((int) cur_pos == -1 ) { return ""; } @@ -673,7 +674,7 @@ std::string Parser::findTokenStr(const std::string &content, const std::string & cur_pos += pattern.size(); // then lets parse the content of remaining part size_t end_pos = content.find_first_of(Parser::DELIMETERS,cur_pos); - if( end_pos == -1 ) + if((int) end_pos == -1 ) { end_pos = content.size(); } @@ -697,7 +698,7 @@ size_t Parser::findToken(const std::string &content, const std::string &keyword, while( 1 ) { cur_pos = content.find(keyword,cur_pos); - if( cur_pos == -1 ) + if((int) cur_pos == -1 ) { break; } @@ -705,8 +706,8 @@ size_t Parser::findToken(const std::string &content, const std::string &keyword, cur_pos += keyword.size(); if( cur_pos < content.size() ) { - if( Parser::WHITESPACES.find(content[cur_pos]) != -1 || - Parser::DELIMETERS.find(content[cur_pos]) != -1 ) + if((int) Parser::WHITESPACES.find(content[cur_pos]) != -1 || + (int)Parser::DELIMETERS.find(content[cur_pos]) != -1 ) { foundStart = savedPos; break; @@ -736,10 +737,10 @@ bool Parser::tokenIsAName(const std::string &content, size_t start ) size_t foundNonWhite = content.find_first_not_of(Parser::WHITESPACES,start); size_t foundDelim = content.find_first_of(Parser::DELIMETERS,start); - if( foundNonWhite != -1 && - foundDelim != -1 ) + if( (int)foundNonWhite != -1 && + (int)foundDelim != -1 ) { - if( (foundNonWhite < foundDelim ) || ( openBraces.find(content[foundDelim]) != -1) ) + if( (foundNonWhite < foundDelim ) || ( (int)openBraces.find(content[foundDelim]) != -1) ) { if( found ) { @@ -784,7 +785,7 @@ size_t Parser::findTokenName(const std::string &content, const std::string &keyw while( 1 ) { cur_pos = content.find(keyword,cur_pos); - if( cur_pos == -1 ) + if((int) cur_pos == -1 ) { break; } @@ -792,7 +793,7 @@ size_t Parser::findTokenName(const std::string &content, const std::string &keyw cur_pos += keyword.size(); if( cur_pos < content.size() ) { - if( Parser::WHITESPACES_AND_DELIMETERS.find(content[cur_pos]) != -1 ) + if((int) Parser::WHITESPACES_AND_DELIMETERS.find(content[cur_pos]) != -1 ) { if( tokenIsAName(content,cur_pos ) ) { @@ -832,7 +833,7 @@ unsigned int Parser::findEndOfElementContent(const std::string &content,unsigned unsigned int foundOpenBrace = content.find("[",curPos); unsigned int foundOpenDict = content.find("<",curPos); - if( foundDelimeter == -1 && foundOpenBrace == -1 && foundOpenDict == -1 ) + if((int) foundDelimeter == -1 && (int)foundOpenBrace == -1 && (int)foundOpenDict == -1 ) { if( !delimStack.empty() ) { @@ -882,7 +883,7 @@ unsigned int Parser::findEndOfElementContent(const std::string &content,unsigned if( delimStack.empty() ) { foundEnd = content.find_first_of(delimeter,curPos); - if( foundEnd == -1 ) + if((int) foundEnd == -1 ) { foundEnd = curPos; } diff --git a/src/pdf-merger/Rectangle.cpp b/src/pdf-merger/Rectangle.cpp index 7fe82696..91ee22d5 100644 --- a/src/pdf-merger/Rectangle.cpp +++ b/src/pdf-merger/Rectangle.cpp @@ -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 "<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; diff --git a/src/web/UBWebPage.cpp b/src/web/UBWebPage.cpp index 74dde74f..56488057 100644 --- a/src/web/UBWebPage.cpp +++ b/src/web/UBWebPage.cpp @@ -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") {