mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0028714: XmlMFunction_ScopeDriver fail to read and write function label including 0 tag in label path.
Reproduced on TDF_Reference attribute that refers to label with zero-tags entry. Make checking of saved/retrieved tags in XML format pass zero-tags as correct.
This commit is contained in:
parent
4f0ba168fb
commit
ec2039e9a7
@ -190,10 +190,10 @@ Standard_Boolean XmlObjMgt::GetTagEntryString
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
char * aPtr;
|
char * aPtr;
|
||||||
long aTagValue = strtol (&aSource[1], &aPtr, 10);
|
long aTagValue = strtol (&aSource[1], &aPtr, 10);
|
||||||
if (aTagValue <= 0 || aPtr[0] != aQuote ||
|
Standard_Integer aLen = (Standard_Integer)(aPtr - &aSource[1]);
|
||||||
|
if (aTagValue < 0 || aLen == 0 || aPtr[0] != aQuote ||
|
||||||
errno == ERANGE || errno == EINVAL)
|
errno == ERANGE || errno == EINVAL)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
Standard_Integer aLen = (Standard_Integer)(aPtr - &aSource[1]);
|
|
||||||
aTagEntryPtr[0] = ':';
|
aTagEntryPtr[0] = ':';
|
||||||
memcpy (&aTagEntryPtr[1], &aSource[1], aLen);
|
memcpy (&aTagEntryPtr[1], &aSource[1], aLen);
|
||||||
aTagEntryPtr += (aLen + 1);
|
aTagEntryPtr += (aLen + 1);
|
||||||
@ -246,9 +246,10 @@ void XmlObjMgt::SetTagEntryString (XmlObjMgt_DOMString& theTarget,
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
char * ptr;
|
char * ptr;
|
||||||
long aTagValue = strtol (aTagEntry, &ptr, 10);
|
long aTagValue = strtol (aTagEntry, &ptr, 10);
|
||||||
if (aTagValue <= 0 || errno == ERANGE || errno == EINVAL)
|
|
||||||
return; // error
|
|
||||||
Standard_Integer aTagSize = (Standard_Integer)(ptr - aTagEntry);
|
Standard_Integer aTagSize = (Standard_Integer)(ptr - aTagEntry);
|
||||||
|
if (aTagValue < 0 || aTagSize == 0 ||
|
||||||
|
errno == ERANGE || errno == EINVAL)
|
||||||
|
return; // error
|
||||||
|
|
||||||
// Add one XPath level to the expression in aTarget
|
// Add one XPath level to the expression in aTarget
|
||||||
memcpy (&aTargetPtr[0], aRefElem1, anElem1Size);
|
memcpy (&aTargetPtr[0], aRefElem1, anElem1Size);
|
||||||
|
24
tests/bugs/caf/bug27187
Normal file
24
tests/bugs/caf/bug27187
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
puts "==========="
|
||||||
|
puts "OCC27187"
|
||||||
|
puts "==========="
|
||||||
|
puts ""
|
||||||
|
#################################
|
||||||
|
# XmlMFunction_ScopeDriver fail to read and write function label including 0 tag in label path.
|
||||||
|
#################################
|
||||||
|
|
||||||
|
NewDocument Doc XmlOcaf
|
||||||
|
# label that contains "0" tag not only in "Root"
|
||||||
|
set Lab 0:1:4:9999:0:1:4:2001:4:2001:4:1:4:1001:4:1001
|
||||||
|
Label Doc $Lab
|
||||||
|
SetReference Doc 0:1 $Lab
|
||||||
|
|
||||||
|
set aFileName ${imagedir}/${casename}_doc.xml
|
||||||
|
SaveAs Doc ${aFileName}
|
||||||
|
Close Doc
|
||||||
|
|
||||||
|
# check that the reference is correctly restored
|
||||||
|
Open ${aFileName} Doc
|
||||||
|
if {[GetReference Doc 0:1] != $Lab} {
|
||||||
|
puts "Error: restored Reference attribute value is bad '[GetReference Doc 0:1]'"
|
||||||
|
}
|
||||||
|
Close Doc
|
Loading…
x
Reference in New Issue
Block a user