diff --git a/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp b/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp index 51c83b3f654d42080672506a8606e3a8932e2797..21f99b1303a64d288f8f42d6b053ac5a5af6a338 100644 --- a/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp +++ b/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp @@ -131,17 +131,17 @@ const XMLCh* DOMCDATASectionImpl::getWholeText() const pWalker->setCurrentNode((DOMNode*)this); // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. - while(true) + DOMNode* prevNode; + while((prevNode=pWalker->previousNode())!=NULL) { - DOMNode* prevNode=pWalker->previousNode(); - if(prevNode==NULL || prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; } XMLBuffer buff(1023, GetDOMNodeMemoryManager); - while(true) + DOMNode* nextNode; + while((nextNode=pWalker->nextNode())!=NULL) { - DOMNode* nextNode=pWalker->nextNode(); - if(nextNode==NULL || nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; if(nextNode->getNodeType()==TEXT_NODE || nextNode->getNodeType()==CDATA_SECTION_NODE) buff.append(nextNode->getNodeValue()); @@ -160,19 +160,19 @@ DOMText* DOMCDATASectionImpl::replaceWholeText(const XMLCh* newText) // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. DOMNode* pFirstTextNode=this; - while(true) + DOMNode* prevNode; + while((prevNode=pWalker->previousNode())!=NULL) { - DOMNode* prevNode=pWalker->previousNode(); - if(prevNode==NULL || prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; pFirstTextNode=prevNode; } // before doing any change we need to check if we are going to remove an entity reference that doesn't contain just text DOMNode* pCurrentNode=pWalker->getCurrentNode(); - while(true) + DOMNode* nextNode; + while((nextNode=pWalker->nextNode())!=NULL) { - DOMNode* nextNode=pWalker->nextNode(); - if(nextNode==NULL || nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; if(nextNode->getNodeType()==ENTITY_REFERENCE_NODE) { @@ -206,10 +206,9 @@ DOMText* DOMCDATASectionImpl::replaceWholeText(const XMLCh* newText) } // now delete all the following text nodes pWalker->setCurrentNode(pCurrentNode); - while(true) + while((nextNode=pWalker->nextNode())!=NULL) { - DOMNode* nextNode=pWalker->nextNode(); - if(nextNode==NULL || nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; if(nextNode!=retVal) { diff --git a/src/xercesc/dom/impl/DOMConfigurationImpl.cpp b/src/xercesc/dom/impl/DOMConfigurationImpl.cpp index 5d2f27372a116865af164381bffbb811557fdfd5..67e7c6c109926f8fb945f430ef5aafb7b520a3fe 100644 --- a/src/xercesc/dom/impl/DOMConfigurationImpl.cpp +++ b/src/xercesc/dom/impl/DOMConfigurationImpl.cpp @@ -188,8 +188,8 @@ bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, bool booleanValue) case FEATURE_ELEMENT_CONTENT_WHITESPACE: if(booleanValue) return true; // required // else return false; // optional // - default: return false; // should never be here } + // should never be here return false; } diff --git a/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp b/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp index eb36bd51edc8a121a616e8e2410dc46692c06903..1709baa3e72c1978f6f0197314ca5324395b64a7 100644 --- a/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp +++ b/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp @@ -270,7 +270,7 @@ static int lastWhiteSpaceInTextNode = 0; // along its way going back to write(). So far we don't come up with a // "short-cut" to go "directly" back. // -#define TRY_CATCH_THROW(action, forceToRethrow) \ +#define TRY_CATCH_THROW(action) \ fFormatter->setUnRepFlags(XMLFormatter::UnRep_Fail); \ try \ { \ @@ -278,11 +278,8 @@ try \ } \ catch(TranscodingException const &e) \ { \ - if ( !reportError(nodeToWrite \ - , DOMError::DOM_SEVERITY_FATAL_ERROR \ - , e.getMessage()) || \ - forceToRethrow) \ - throw e; \ + reportError(nodeToWrite, DOMError::DOM_SEVERITY_FATAL_ERROR, e.getMessage()); \ + throw e; \ } DOMLSSerializerImpl::~DOMLSSerializerImpl() @@ -752,7 +749,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve *fFormatter << chSpace << nodeValue; } *fFormatter << gEndPI; - ,true ) break; } @@ -846,7 +842,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve // The name has to be representable without any escapes *fFormatter << XMLFormatter::NoEscapes << chOpenAngle << nodeName; - ,true ) // Output any attributes on this element @@ -1059,7 +1054,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve ( *fFormatter << XMLFormatter::NoEscapes << gEndElement << nodeName << chCloseAngle; - ,true ) } @@ -1077,7 +1071,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve TRY_CATCH_THROW ( *fFormatter << XMLFormatter::NoEscapes << chForwardSlash << chCloseAngle; - , true ) } } @@ -1149,7 +1142,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve ( *fFormatter << XMLFormatter::NoEscapes << chAmpersand << nodeName << chSemiColon; - , true ) } else @@ -1170,7 +1162,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve TRY_CATCH_THROW ( *fFormatter<<XMLFormatter::NoEscapes<<chAmpersand<<nodeName<<chSemiColon; - , true ) } } @@ -1212,7 +1203,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve ( // transcoder throws exception for unrep chars *fFormatter << XMLFormatter::NoEscapes << gStartCDATA << nodeValue << gEndCDATA; - , true ) } @@ -1234,7 +1224,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve ( *fFormatter << XMLFormatter::NoEscapes << gStartComment << nodeValue << gEndComment; - , true ) break; } @@ -1292,8 +1281,6 @@ void DOMLSSerializerImpl::processNode(const DOMNode* const nodeToWrite, int leve } *fFormatter << chCloseAngle; - , true - ) // end of TRY_CATCH_THROW break; @@ -1524,7 +1511,6 @@ void DOMLSSerializerImpl::procCdataSection(const XMLCh* const nodeValue TRY_CATCH_THROW ( *fFormatter << XMLFormatter::NoEscapes << gStartCDATA << gEndCDATA; - , true ) } else @@ -1580,9 +1566,8 @@ void DOMLSSerializerImpl::procUnrepCharInCdataSection(const XMLCh* const nodeV printNewLine(); printIndent(level); TRY_CATCH_THROW - ( + ( *fFormatter << XMLFormatter::NoEscapes << gStartCDATA; - , true ) // We got at least some chars that can be done normally @@ -1597,7 +1582,6 @@ void DOMLSSerializerImpl::procUnrepCharInCdataSection(const XMLCh* const nodeV TRY_CATCH_THROW ( *fFormatter << XMLFormatter::NoEscapes << gEndCDATA; - , true ) // Update the source pointer to our new spot diff --git a/src/xercesc/dom/impl/DOMNodeIDMap.cpp b/src/xercesc/dom/impl/DOMNodeIDMap.cpp index 736e717cac562bdf836d7fdd7b129b0ed3bd66c4..3d535b000ef6bd54cd3f3e5e38c9b83ac415bcf8 100644 --- a/src/xercesc/dom/impl/DOMNodeIDMap.cpp +++ b/src/xercesc/dom/impl/DOMNodeIDMap.cpp @@ -95,12 +95,8 @@ void DOMNodeIDMap::add(DOMAttr *attr) // the table is only filled by the parser from valid documents, which // can not have duplicates. Behavior of invalid docs is not defined. // - while (true) + while (fTable[currentHash]!=0 && fTable[currentHash]!=(DOMAttr *)-1) { - DOMAttr *tableSlot = fTable[currentHash]; - if (tableSlot == 0 || - tableSlot == (DOMAttr *)-1) - break; currentHash += initalHash; // rehash if (currentHash >= fSize) currentHash = currentHash % fSize; @@ -129,15 +125,9 @@ void DOMNodeIDMap::remove(DOMAttr *attr) // // Loop looking for a slot pointing to an attr with this id. // - while (true) + DOMAttr *tableSlot; + while ((tableSlot= fTable[currentHash])!=0) { - DOMAttr *tableSlot = fTable[currentHash]; - if (tableSlot == 0) - { - // There is no matching entry in the table - return; - } - if (tableSlot == attr) { // Found the attribute. Set the slot to -1 to indicate @@ -152,7 +142,7 @@ void DOMNodeIDMap::remove(DOMAttr *attr) if (currentHash >= fSize) currentHash = currentHash % fSize; } - + // There is no matching entry in the table } @@ -168,16 +158,9 @@ DOMAttr *DOMNodeIDMap::find(const XMLCh *id) // // Loop looking for a slot pointing to an attr with this id. // - while (true) + DOMAttr *tableSlot; + while ((tableSlot= fTable[currentHash])!=0) { - DOMAttr *tableSlot = fTable[currentHash]; - if (tableSlot == 0) - { - // There is no matching entry in the table - return 0; - } - - if ((tableSlot != (DOMAttr *)-1) && XMLString::equals(tableSlot->getValue(), id)) return tableSlot; @@ -185,7 +168,8 @@ DOMAttr *DOMNodeIDMap::find(const XMLCh *id) if (currentHash >= fSize) currentHash = currentHash % fSize; } - return 0; // Never gets here, but keeps some compilers happy. + // There is no matching entry in the table + return 0; } diff --git a/src/xercesc/dom/impl/DOMNodeImpl.cpp b/src/xercesc/dom/impl/DOMNodeImpl.cpp index e4cc82699a5b2c8258e1ea4c7cf9cb2f7ee68a04..c6acebec618361ef8ea6beddfaf5e064d06f3b81 100644 --- a/src/xercesc/dom/impl/DOMNodeImpl.cpp +++ b/src/xercesc/dom/impl/DOMNodeImpl.cpp @@ -720,7 +720,8 @@ short DOMNodeImpl::compareDocumentPosition(const DOMNode* other) cons } // We now have nodes at the same depth in the tree. Find a common ancestor. - const DOMNode *myNodeP, *hisNodeP; + const DOMNode *myNodeP=myRoot; + const DOMNode *hisNodeP=hisRoot; while(myRoot!=hisRoot) { myNodeP = myRoot; diff --git a/src/xercesc/dom/impl/DOMTextImpl.cpp b/src/xercesc/dom/impl/DOMTextImpl.cpp index 2465fa34c09bc98868aec43d053381bba2b1a8c3..634e398d6520432fb8ce2f4c4b496bf78bb52214 100644 --- a/src/xercesc/dom/impl/DOMTextImpl.cpp +++ b/src/xercesc/dom/impl/DOMTextImpl.cpp @@ -140,17 +140,17 @@ const XMLCh* DOMTextImpl::getWholeText() const pWalker->setCurrentNode((DOMNode*)this); // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. - while(true) + DOMNode* prevNode; + while((prevNode=pWalker->previousNode())!=NULL) { - DOMNode* prevNode=pWalker->previousNode(); - if(prevNode==NULL || prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; } XMLBuffer buff(1023, GetDOMNodeMemoryManager); - while(true) + DOMNode* nextNode; + while((nextNode=pWalker->nextNode())!=NULL) { - DOMNode* nextNode=pWalker->nextNode(); - if(nextNode==NULL || nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; if(nextNode->getNodeType()==TEXT_NODE || nextNode->getNodeType()==CDATA_SECTION_NODE) buff.append(nextNode->getNodeValue()); @@ -169,19 +169,19 @@ DOMText* DOMTextImpl::replaceWholeText(const XMLCh* newText) // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes. DOMNode* pFirstTextNode=this; - while(true) + DOMNode* prevNode; + while((prevNode=pWalker->previousNode())!=NULL) { - DOMNode* prevNode=pWalker->previousNode(); - if(prevNode==NULL || prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; pFirstTextNode=prevNode; } // before doing any change we need to check if we are going to remove an entity reference that doesn't contain just text DOMNode* pCurrentNode=pWalker->getCurrentNode(); - while(true) + DOMNode* nextNode; + while((nextNode=pWalker->nextNode())!=NULL) { - DOMNode* nextNode=pWalker->nextNode(); - if(nextNode==NULL || nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; if(nextNode->getNodeType()==ENTITY_REFERENCE_NODE) { @@ -215,10 +215,9 @@ DOMText* DOMTextImpl::replaceWholeText(const XMLCh* newText) } // now delete all the following text nodes pWalker->setCurrentNode(pCurrentNode); - while(true) + while((nextNode=pWalker->nextNode())!=NULL) { - DOMNode* nextNode=pWalker->nextNode(); - if(nextNode==NULL || nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) + if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE) break; if(nextNode!=retVal) { diff --git a/src/xercesc/framework/psvi/XSValue.cpp b/src/xercesc/framework/psvi/XSValue.cpp index 8edafb042f04319b09f8545acad283650c17200f..d08233f1cf4f5bbcf53b1c009f052b34eb686620 100644 --- a/src/xercesc/framework/psvi/XSValue.cpp +++ b/src/xercesc/framework/psvi/XSValue.cpp @@ -1156,20 +1156,17 @@ XMLCh* XSValue::getCanRepDateTimes(const XMLCh* const input_content break; } } - - catch (SchemaDateTimeException &e) - { - status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; - return 0; - } catch(const OutOfMemoryException&) { throw; } + catch (SchemaDateTimeException &e) + { + status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; + } catch (const NumberFormatException&) { status = st_FOCA0002; - return 0; } return 0; } @@ -1453,7 +1450,6 @@ XSValue::getActValNumerics(const XMLCh* const content catch (const NumberFormatException&) { status = st_FOCA0002; - return 0; } return 0; } @@ -1542,20 +1538,19 @@ XSValue::getActValDateTimes(const XMLCh* const input_content return retVal; } - catch (SchemaDateTimeException const &e) - { - status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; - return 0; - } catch(const OutOfMemoryException&) { throw; } + catch (SchemaDateTimeException const &e) + { + status = checkTimeZoneError(datatype, e)? XSValue::st_FODT0003 : st_FOCA0002; + } catch (const NumberFormatException&) { status = st_FOCA0002; - return 0; } + return 0; } diff --git a/src/xercesc/internal/ReaderMgr.cpp b/src/xercesc/internal/ReaderMgr.cpp index a46c46b164182d0d58644a06ba756cb8da6e9210..421bdc71186ec64914e5c5a324a8bde1740783db 100644 --- a/src/xercesc/internal/ReaderMgr.cpp +++ b/src/xercesc/internal/ReaderMgr.cpp @@ -117,16 +117,13 @@ void ReaderMgr::getSpaces(XMLBuffer& toFill) // Reset the buffer before we start toFill.reset(); - while (true) + // + // Get all the spaces from the current reader. If it returns true, + // it hit a non-space and we are done. Else we have to pop a reader + // and keep going. + // + while (!fCurReader->getSpaces(toFill)) { - // - // Get all the spaces from the current reader. If it returns true, - // it hit a non-space and we are done. Else we have to pop a reader - // and keep going. - // - if (fCurReader->getSpaces(toFill)) - break; - // We wore that one out, so lets pop a reader and try again if (!popReader()) break; @@ -145,11 +142,8 @@ void ReaderMgr::getUpToCharOrWS(XMLBuffer& toFill, const XMLCh toCheck) // up all of its data. Else it returned because something matched, and // we are done. // - while (true) + while (!fCurReader->getUpToCharOrWS(toFill, toCheck)) { - if (fCurReader->getUpToCharOrWS(toFill, toCheck)) - break; - // We ate that one up, lets try to pop another. If not, break out if (!popReader()) break; @@ -250,16 +244,13 @@ bool ReaderMgr::skipPastSpaces(bool inDecl) { bool skippedSomething = false; bool tmpFlag; - while (true) + // + // Skip all the spaces in the current reader. If it returned because + // it hit a non-space, break out. Else we have to pop another entity + // and keep going. + // + while (!fCurReader->skipSpaces(tmpFlag, inDecl)) { - // - // Skip all the spaces in the current reader. If it returned because - // it hit a non-space, break out. Else we have to pop another entity - // and keep going. - // - if (fCurReader->skipSpaces(tmpFlag, inDecl)) - break; - if (tmpFlag) skippedSomething = true; @@ -273,14 +264,9 @@ bool ReaderMgr::skipPastSpaces(bool inDecl) void ReaderMgr::skipQuotedString(const XMLCh quoteCh) { XMLCh nextCh; - while (true) + // If we get an end of file char, then return + while ((nextCh = getNextChar())!=0) { - nextCh = getNextChar(); - - // If we get an end of file char, then return - if (!nextCh) - break; - // If we get the quote char, then break out if (nextCh == quoteCh) break; @@ -291,13 +277,9 @@ void ReaderMgr::skipQuotedString(const XMLCh quoteCh) XMLCh ReaderMgr::skipUntilIn(const XMLCh* const listToSkip) { XMLCh nextCh; - while (true) + // If we get an end of file char, then return + while ((nextCh = peekNextChar())!=0) { - nextCh = peekNextChar(); - - if (!nextCh) - break; - if (XMLString::indexOf(listToSkip, nextCh) != -1) break; @@ -311,13 +293,9 @@ XMLCh ReaderMgr::skipUntilIn(const XMLCh* const listToSkip) XMLCh ReaderMgr::skipUntilInOrWS(const XMLCh* const listToSkip) { XMLCh nextCh; - while (true) + // If we get an end of file char, then return + while ((nextCh = peekNextChar())!=0) { - nextCh = peekNextChar(); - - if (!nextCh) - break; - if (fCurReader->isWhitespace(nextCh)) break; diff --git a/src/xercesc/internal/XMLScanner.cpp b/src/xercesc/internal/XMLScanner.cpp index 6a6ac4474d20544efe7f5659587be9a9f7c66129..9982c6f9ea3e12a8e387b3a5637a502fef830329 100644 --- a/src/xercesc/internal/XMLScanner.cpp +++ b/src/xercesc/internal/XMLScanner.cpp @@ -2032,15 +2032,10 @@ bool XMLScanner::getQuotedString(XMLBuffer& toFill) if (!fReaderMgr.skipIfQuote(quoteCh)) return false; - while (true) + XMLCh nextCh; + // Get another char and see if it matches the starting quote char + while ((nextCh=fReaderMgr.getNextChar())!=quoteCh) { - // Get another char - const XMLCh nextCh = fReaderMgr.getNextChar(); - - // See if it matches the starting quote char - if (nextCh == quoteCh) - break; - // We should never get either an end of file null char here. If we // do, just fail. It will be handled more gracefully in the higher // level code that called us. diff --git a/src/xercesc/internal/XSerializeEngine.cpp b/src/xercesc/internal/XSerializeEngine.cpp index 9bd3d828c14643528a4b01dd5cfb62c2e9e217d8..044083f3731a014ec0f2ca95c1fc1a638231da84 100644 --- a/src/xercesc/internal/XSerializeEngine.cpp +++ b/src/xercesc/internal/XSerializeEngine.cpp @@ -1128,14 +1128,16 @@ inline size_t XSerializeEngine::calBytesNeeded(size_t size) const return (alignAdjust(size) + size); } -void XSerializeEngine::trace(char* funcName) const +void XSerializeEngine::trace(char* /*funcName*/) const { return; - if (isStoring()) +/* + if (isStoring()) printf("\n funcName=<%s>, storing, count=<%lu>, postion=<%lu>\n", funcName, fBufCount, getBufCurAccumulated()); else printf("\n funcName=<%s>, loading, count=<%lu>, postion=<%lu>\n", funcName, fBufCount, getBufCurAccumulated()); +*/ } XERCES_CPP_NAMESPACE_END diff --git a/src/xercesc/util/PlatformUtils.cpp b/src/xercesc/util/PlatformUtils.cpp index c34247c70120202cf1b7914fd64c5214722646bf..e2da0c7c577a1ec2a273f0c6e2052ea131acaa99 100644 --- a/src/xercesc/util/PlatformUtils.cpp +++ b/src/xercesc/util/PlatformUtils.cpp @@ -436,7 +436,7 @@ XMLNetAccessor* XMLPlatformUtils::makeNetAccessor() XMLMsgLoader* XMLPlatformUtils::loadAMsgSet(const XMLCh* const msgDomain) { - XMLMsgLoader* ms; + XMLMsgLoader* ms=0; try { @@ -446,8 +446,10 @@ XMLMsgLoader* XMLPlatformUtils::loadAMsgSet(const XMLCh* const msgDomain) ms = new MsgCatalogLoader(msgDomain); #elif defined (XERCES_USE_WIN32_MSGLOADER) ms = new Win32MsgLoader(msgDomain); - #else // XERCES_USE_MSGLOADER_INMEMORY + #elif defined (XERCES_USE_MSGLOADER_INMEMORY) ms = new InMemMsgLoader(msgDomain); + #else + #error No MsgLoader configured for platform! You must configure it. #endif } catch(const OutOfMemoryException&) diff --git a/src/xercesc/util/XML256TableTranscoder.cpp b/src/xercesc/util/XML256TableTranscoder.cpp index bbb06d84cfe503020cf72f7ad4c6f04a78ea1c43..e834c3c6ad5c5485414dacc5fe82bebe7580fd1b 100644 --- a/src/xercesc/util/XML256TableTranscoder.cpp +++ b/src/xercesc/util/XML256TableTranscoder.cpp @@ -120,7 +120,7 @@ XML256TableTranscoder::transcodeTo( const XMLCh* const srcData // Get the next src char out to a temp, then do a binary search // of the 'to' table for this entry. // - if ((nextOut = xlatOneTo(*srcPtr))) + if ((nextOut = xlatOneTo(*srcPtr))!=0) { *outPtr++ = nextOut; srcPtr++; diff --git a/src/xercesc/util/XMLAbstractDoubleFloat.cpp b/src/xercesc/util/XMLAbstractDoubleFloat.cpp index 6f75a46c00486a7bfc9eafe9721dee3a6c165edd..e01b022f000c5e401113573b7de38b1781d589a2 100644 --- a/src/xercesc/util/XMLAbstractDoubleFloat.cpp +++ b/src/xercesc/util/XMLAbstractDoubleFloat.cpp @@ -112,7 +112,7 @@ void XMLAbstractDoubleFloat::init(const XMLCh* const strValue) // since the call to strtod may allow other values. For example, AIX // allows "infinity" and "+INF" XMLCh curChar; - while (curChar = tmpStrValue[lenTempStrValue]) { + while ((curChar = tmpStrValue[lenTempStrValue])!=0) { if (!((curChar >= chDigit_0 && curChar <= chDigit_9) || curChar == chPeriod || @@ -394,7 +394,7 @@ void XMLAbstractDoubleFloat::normalizeZero(XMLCh* const inData) bool dotSeen = false; bool isValidStr = true; XMLCh theChar; - while ((theChar=*srcStr++) && isValidStr) + while ((theChar=*srcStr++)!=0 && isValidStr) { if ( theChar != chPeriod && theChar != chDigit_0 ) isValidStr = false; // invalid char diff --git a/src/xercesc/util/regx/RegularExpression.cpp b/src/xercesc/util/regx/RegularExpression.cpp index 7d07e3ec35d46b8cc5ab1ecb8f52d30eb4c2792b..213ef459fe8ebb33e4418d4ef35031c1e6a54653 100644 --- a/src/xercesc/util/regx/RegularExpression.cpp +++ b/src/xercesc/util/regx/RegularExpression.cpp @@ -986,10 +986,7 @@ int RegularExpression::match(Context* const context, const Op* const operations const Op* tmpOp = operations; bool ignoreCase = isSet(fOptions, IGNORE_CASE); - while (true) { - - if (tmpOp == 0) - break; + while (tmpOp != 0) { if (offset > context->fLimit || offset < context->fStart) return -1; diff --git a/src/xercesc/util/regx/Token.cpp b/src/xercesc/util/regx/Token.cpp index aa1046e964713e7af63c392b3e727970ecc91d9a..bc9cd9ae2b0c4bd639b419ee3e1e27c3b9753660 100644 --- a/src/xercesc/util/regx/Token.cpp +++ b/src/xercesc/util/regx/Token.cpp @@ -251,12 +251,11 @@ int Token::analyzeFirstCharacter(RangeToken* const rangeTok, if (size() == 1) return FC_CONTINUE; - int ret2; - if (ret1 != FC_ANY) { - ret2 = getChild(1)->analyzeFirstCharacter(rangeTok, options, tokFactory); - } + if (ret1 == FC_ANY) + return FC_ANY; - if (ret1 == FC_ANY || ret2 == FC_ANY) + int ret2 = getChild(1)->analyzeFirstCharacter(rangeTok, options, tokFactory); + if (ret2 == FC_ANY) return FC_ANY; if (ret1 == FC_CONTINUE || ret2 == FC_CONTINUE) diff --git a/src/xercesc/validators/DTD/DTDScanner.cpp b/src/xercesc/validators/DTD/DTDScanner.cpp index e36f2d7a151ec2d22c98bbd420f2e9afdbdb4ddd..27669b309a10160b125b7b22b3eaf2e22ee8592b 100644 --- a/src/xercesc/validators/DTD/DTDScanner.cpp +++ b/src/xercesc/validators/DTD/DTDScanner.cpp @@ -375,15 +375,10 @@ bool DTDScanner::getQuotedString(XMLBuffer& toFill) if (!fReaderMgr->skipIfQuote(quoteCh)) return false; - while (true) + XMLCh nextCh; + // Get another char and see if it matches the starting quote char + while ((nextCh=fReaderMgr->getNextChar())!=quoteCh) { - // Get another char - const XMLCh nextCh = fReaderMgr->getNextChar(); - - // See if it matches the starting quote char - if (nextCh == quoteCh) - break; - // // We should never get either an end of file null char here. If we // do, just fail. It will be handled more gracefully in the higher @@ -1459,7 +1454,7 @@ void DTDScanner::scanComment() else bbComment.append(nextCh); } - else if (curState == OneDash) + else if (curState == OneDash) { // // If its another dash, then we change to the two dashes states. @@ -1470,14 +1465,14 @@ void DTDScanner::scanComment() { curState = TwoDashes; } - else + else { bbComment.append(chDash); bbComment.append(nextCh); curState = InText; } } - else if (curState == TwoDashes) + else if (curState == TwoDashes) { // The next character must be the closing bracket if (nextCh != chCloseAngle) @@ -2495,7 +2490,11 @@ void DTDScanner::scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD) { const XMLCh nextCh = fReaderMgr->peekNextChar(); - if (nextCh == chOpenAngle) + if (!nextCh) + { + return; // nothing left + } + else if (nextCh == chOpenAngle) { // Get the reader we started this on // XML 1.0 P28a Well-formedness constraint: PE Between Declarations @@ -2523,7 +2522,7 @@ void DTDScanner::scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD) } } - else if (fReaderMgr->getCurrentReader()->isWhitespace(nextCh)) + else if (fReaderMgr->getCurrentReader()->isWhitespace(nextCh)) { // // If we have a doc type handler, and advanced callbacks are @@ -2542,7 +2541,7 @@ void DTDScanner::scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD) , bbSpace.getLen() ); } - else + else { // // If we hit an end of entity in the middle of white @@ -2552,7 +2551,7 @@ void DTDScanner::scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD) fReaderMgr->skipPastSpaces(); } } - else if (nextCh == chPercent) + else if (nextCh == chPercent) { // // Expand (and scan if external) the reference value. Tell @@ -2562,7 +2561,7 @@ void DTDScanner::scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD) fReaderMgr->getNextChar(); expandPERef(true, false, false, true); } - else if (inIncludeSect && (nextCh == chCloseSquare)) + else if (inIncludeSect && (nextCh == chCloseSquare)) { // // Its the end of a conditional include section. So scan it and @@ -2574,16 +2573,12 @@ void DTDScanner::scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD) fScanner->emitError(XMLErrs::ExpectedEndOfConditional); fReaderMgr->skipPastChar(chCloseAngle); } - else if (!fReaderMgr->skippedChar(chCloseAngle)) + else if (!fReaderMgr->skippedChar(chCloseAngle)) { fScanner->emitError(XMLErrs::ExpectedEndOfConditional); fReaderMgr->skipPastChar(chCloseAngle); } return; - } - else if (!nextCh) - { - return; // nothing left } else { @@ -2616,7 +2611,6 @@ void DTDScanner::scanExtSubsetDecl(const bool inIncludeSect, const bool isDTD) bAcceptDecl = false; } } - catch(const EndOfEntityException& toCatch) { // @@ -3730,18 +3724,13 @@ bool DTDScanner::scanSystemLiteral(XMLBuffer& toFill) return false; } - while (true) + XMLCh nextCh; + // Break out on terminating quote + while ((nextCh=fReaderMgr->getNextChar())!=quoteCh) { - const XMLCh nextCh = fReaderMgr->getNextChar(); - // Watch for EOF if (!nextCh) ThrowXMLwithMemMgr(UnexpectedEOFException, XMLExcepts::Gen_UnexpectedEOF, fMemoryManager); - - // Break out on terminating quote - if (nextCh == quoteCh) - break; - toFill.append(nextCh); } return true; diff --git a/src/xercesc/validators/common/CMNode.hpp b/src/xercesc/validators/common/CMNode.hpp index bf480a871e356a9aaeef7c1624383c273c11d40f..1f4799f487cefa8cab8bc1a9915b5cf461cdee00 100644 --- a/src/xercesc/validators/common/CMNode.hpp +++ b/src/xercesc/validators/common/CMNode.hpp @@ -132,7 +132,7 @@ inline CMNode::CMNode(const ContentSpecNode::NodeTypes type, , fType(type) , fFirstPos(0) , fLastPos(0) - , fMaxStates(~0) + , fMaxStates(UINT_MAX) { } diff --git a/src/xercesc/validators/schema/identity/XercesXPath.cpp b/src/xercesc/validators/schema/identity/XercesXPath.cpp index 1d54b051c3cb08b1f09fc64fad766d934e54bbe3..85e88419397fe20ce22f58b566e963dddf99fcbd 100644 --- a/src/xercesc/validators/schema/identity/XercesXPath.cpp +++ b/src/xercesc/validators/schema/identity/XercesXPath.cpp @@ -757,11 +757,7 @@ bool XPathScanner::scanExpression(const XMLCh* const data, XMLCh ch; XMLBuffer dataBuffer(128, tokens->getMemoryManager()); - while (true) { - - if (currentOffset == endOffset) { - break; - } + while (currentOffset != endOffset) { ch = data[currentOffset];