neilg 2003/12/07 16:11:26 Modified: c/src/xercesc/internal IGXMLScanner2.cpp SGXMLScanner.cpp Log: fix bug in PSVI where a segfault would occur if an attribute was not defined Revision Changes Path 1.50 +40 -37 xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp Index: IGXMLScanner2.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- IGXMLScanner2.cpp 28 Nov 2003 20:20:54 -0000 1.49 +++ IGXMLScanner2.cpp 8 Dec 2003 00:11:26 -0000 1.50 @@ -578,43 +578,46 @@ actualAttDef = (SchemaAttDef *)attDef; else if (attDefForWildCard) actualAttDef = (SchemaAttDef *)attDefForWildCard; - XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration *)fModel->getXSObject(actualAttDef); - PSVIAttribute *toFill = fPSVIAttrList->getPSVIAttributeToFill(); - DatatypeValidator * attrDataType = actualAttDef->getDatatypeValidator(); - XSSimpleTypeDefinition *validatingType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrDataType); - if(attrValid != PSVIItem::VALIDITY_VALID) - { - toFill->reset( - fRootElemName - , attrValid - , attrAssessed - , normBuf.getRawBuffer() - , validatingType - , 0 - , actualAttDef->getValue() - , false - , attrDecl - , 0 - ); - } - else - { - XSSimpleTypeDefinition *memberType = 0; - if(validatingType->getVariety() == XSSimpleTypeDefinition::VARIETY_UNION) - memberType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator); - toFill->reset( - fRootElemName - , attrValid - , attrAssessed - , normBuf.getRawBuffer() - , validatingType - , memberType - , actualAttDef->getValue() - , false - , attrDecl - , (memberType)?attrValidator:attrDataType - ); - } + if(actualAttDef) + { + XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration *)fModel->getXSObject(actualAttDef); + PSVIAttribute *toFill = fPSVIAttrList->getPSVIAttributeToFill(); + DatatypeValidator * attrDataType = actualAttDef->getDatatypeValidator(); + XSSimpleTypeDefinition *validatingType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrDataType); + if(attrValid != PSVIItem::VALIDITY_VALID) + { + toFill->reset( + fRootElemName + , attrValid + , attrAssessed + , normBuf.getRawBuffer() + , validatingType + , 0 + , actualAttDef->getValue() + , false + , attrDecl + , 0 + ); + } + else + { + XSSimpleTypeDefinition *memberType = 0; + if(validatingType->getVariety() == XSSimpleTypeDefinition::VARIETY_UNION) + memberType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator); + toFill->reset( + fRootElemName + , attrValid + , attrAssessed + , normBuf.getRawBuffer() + , validatingType + , memberType + , actualAttDef->getValue() + , false + , attrDecl + , (memberType)?attrValidator:attrDataType + ); + } + } } } else 1.63 +40 -37 xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp Index: SGXMLScanner.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- SGXMLScanner.cpp 3 Dec 2003 20:00:27 -0000 1.62 +++ SGXMLScanner.cpp 8 Dec 2003 00:11:26 -0000 1.63 @@ -2599,43 +2599,46 @@ actualAttDef = (SchemaAttDef *)attDef; else if (attDefForWildCard) actualAttDef = (SchemaAttDef *)attDefForWildCard; - XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration *)fModel->getXSObject(actualAttDef); - PSVIAttribute *toFill = fPSVIAttrList->getPSVIAttributeToFill(); - DatatypeValidator * attrDataType = actualAttDef->getDatatypeValidator(); - XSSimpleTypeDefinition *validatingType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrDataType); - if(attrValid != PSVIItem::VALIDITY_VALID) - { - toFill->reset( - fRootElemName - , attrValid - , attrAssessed - , normBuf.getRawBuffer() - , validatingType - , 0 - , actualAttDef->getValue() - , false - , attrDecl - , 0 - ); - } - else - { - XSSimpleTypeDefinition *memberType = 0; - if(validatingType->getVariety() == XSSimpleTypeDefinition::VARIETY_UNION) - memberType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator); - toFill->reset( - fRootElemName - , attrValid - , attrAssessed - , normBuf.getRawBuffer() - , validatingType - , memberType - , actualAttDef->getValue() - , false - , attrDecl - , (memberType)?attrValidator:attrDataType - ); - } + if(actualAttDef) + { + XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration *)fModel->getXSObject(actualAttDef); + PSVIAttribute *toFill = fPSVIAttrList->getPSVIAttributeToFill(); + DatatypeValidator * attrDataType = actualAttDef->getDatatypeValidator(); + XSSimpleTypeDefinition *validatingType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrDataType); + if(attrValid != PSVIItem::VALIDITY_VALID) + { + toFill->reset( + fRootElemName + , attrValid + , attrAssessed + , normBuf.getRawBuffer() + , validatingType + , 0 + , actualAttDef->getValue() + , false + , attrDecl + , 0 + ); + } + else + { + XSSimpleTypeDefinition *memberType = 0; + if(validatingType->getVariety() == XSSimpleTypeDefinition::VARIETY_UNION) + memberType = (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator); + toFill->reset( + fRootElemName + , attrValid + , attrAssessed + , normBuf.getRawBuffer() + , validatingType + , memberType + , actualAttDef->getValue() + , false + , attrDecl + , (memberType)?attrValidator:attrDataType + ); + } + } } } else
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]