]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Increased a size of buffer to store the attribute ID and the read from file study.
authorsrn <srn@opencascade.com>
Wed, 4 Apr 2007 06:23:33 +0000 (06:23 +0000)
committersrn <srn@opencascade.com>
Wed, 4 Apr 2007 06:23:33 +0000 (06:23 +0000)
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx

index f963a80c4257e22d357823edba55079e3905b965..bc23ce57baa7edcc1f1414e1aef8eded40cbed29 100644 (file)
@@ -476,14 +476,16 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Han
 
   //The macro adds all necessary checks for standardly behaiving attributes
   __FindOrCreateAttributeForBuilder
-  
+
   //Add checks for TreeNode and UserID attributes  
   if (strncmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode",17) == 0 ) {
+    
     Standard_GUID aTreeNodeGUID;
     if (strcmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode") == 0) {
       aTreeNodeGUID = SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID();
     } else {
-      char* aGUIDString = new char[40];
+      char* aGUIDString = new char[41];
       char* aType = (char*)aTypeOfAttribute.ToCString();
       sprintf(aGUIDString, &(aType[17]));
       if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
@@ -506,7 +508,7 @@ Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Han
     if (strcmp(aTypeOfAttribute.ToCString(), "AttributeUserID") == 0) {
       aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID();
     } else {
-      char* aGUIDString = new char[40];
+      char* aGUIDString = new char[41];
       char* aType = (char*)aTypeOfAttribute.ToCString();
       sprintf(aGUIDString, &(aType[15]));
       if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
index dd91556cd8dc9948c3557aa81058e2ab5fd21e6e..17bad0e6a0a5bb8cf2705c6022b8d9a0cb7b4a15 100644 (file)
@@ -1170,9 +1170,9 @@ static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy,
 
   Handle(TDF_Attribute) anAttr;
 
-  char* current_string = new char[hdf_dataset->GetSize()];
+  char* current_string = new char[hdf_dataset->GetSize()+1];
   hdf_dataset->ReadFromDisk(current_string);
-
+  
   if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) {
     anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment");
   } else if (!strcmp(hdf_dataset->GetName(),"AttributeReference") ||
@@ -1184,14 +1184,14 @@ static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy,
   } else {
     anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName());
   }
-
+  
   if (!anAttr.IsNull()) {
 
     Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr);
     ga->Load(current_string);
     //cout << "Reading: " << aSO->GetID() << " "<< ga->Type() << " value: " << current_string << endl;
   }
-
+  
   delete(current_string);
   hdf_dataset->CloseOnDisk();
 }