From c4357fba8630e9120d4e2daed622a944c9d9578e Mon Sep 17 00:00:00 2001 From: rahuel Date: Fri, 5 Nov 2004 08:25:34 +0000 Subject: [PATCH] Portability Alpha_OSF(CCRT) --- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 38 ++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index 0eadebb95..d5865bbdd 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -95,10 +95,12 @@ static void ReadAttributes(Handle(TDF_Data)& DF, if (!strncmp(hdf_dataset->GetName(),"AttributeTreeNode",17)) { MESSAGE("Create a Attribute : AttributeTreeNode"); - char current_strings[5][hdf_dataset->GetSize()/5]; -// char **current_strings = new (char*)[5]; -// for(int i=0;i<5;i++) -// current_strings[i] = new char[hdf_dataset->GetSize()/5+1]; +//CCRT char current_strings[5][hdf_dataset->GetSize()/5]; +//CCRT char **current_strings = new (char*)[5]; + char **current_strings = new char*[5]; + for(int i=0;i<5;i++) + current_strings[i] = new char[hdf_dataset->GetSize()/5+1]; +//CCRT hdf_dataset->ReadFromDisk(current_strings); MESSAGE("Create an Attribute : AttributeTreeNode"); @@ -126,9 +128,9 @@ static void ReadAttributes(Handle(TDF_Data)& DF, if (!aLabel.FindAttribute(aGUID,aNode)) aNode = TDataStd_TreeNode::Set(aLabel,aGUID); aNewNode->SetFirst(aNode); } -// for(int i=0;i<5;i++) -// delete[] current_strings[i]; -// delete[] current_strings; + for(int i=0;i<5;i++) + delete[] current_strings[i]; + delete[] current_strings; } else { int size = hdf_dataset->GetSize(); @@ -576,8 +578,9 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) // MESSAGE( "HDFexception ! " ); // cerr << "HDFexception ! " << endl; delete aHDFUrl; - char eStr[strlen(aUrl)+17]; -// char *eStr = new char[strlen(aUrl)+17+1]; +//CCRT char eStr[strlen(aUrl)+17]; + char *eStr = new char[strlen(aUrl)+17+1]; +//CCRT sprintf(eStr,"Can't open file %s",aUrl); THROW_SALOME_CORBA_EXCEPTION(CORBA::string_dup(eStr),SALOME::BAD_PARAM); } @@ -624,8 +627,9 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) // MESSAGE( "HDFexception ! " ); // cerr << "HDFexception ! " << endl; delete aHDFUrl; - char eStr[strlen(aUrl)+17]; -// char *eStr = new char[strlen(aUrl)+17+1]; +//CCRT char eStr[strlen(aUrl)+17]; + char *eStr = new char[strlen(aUrl)+17+1]; +//CCRT sprintf(eStr,"Can't open file %s",aUrl); THROW_SALOME_CORBA_EXCEPTION(CORBA::string_dup(eStr),SALOME::BAD_PARAM); } @@ -1172,7 +1176,11 @@ static void SaveAttributes(SALOMEDS::SObject_ptr SO, HDFgroup *hdf_group_sobject TNsize[0]=5; TNsize[1]=maxSize+1; - char Data[5][maxSize+1]; +//CCRT char Data[5][maxSize+1]; + char **Data = new char *[5]; + for(int i=0;i<5;i++) + Data[i] = new char[maxSize+1]; +//CCRT for(index=0;index<5;index++) { strcpy(Data[index],Val[index]); for(int a = strlen(Data[index]) + 1; a < maxSize; a++) Data[index][a] = ' '; // mpv: for ASCII format @@ -1188,9 +1196,9 @@ static void SaveAttributes(SALOMEDS::SObject_ptr SO, HDFgroup *hdf_group_sobject MESSAGE("attribute AttributeTreeNode with various GUID wrote on file:"); MESSAGE(aDataSetName); delete(aDataSetName); -// for(int i=0;i<5;i++) -// delete[] Data[i]; -// delete[] Data; + for(int i=0;i<5;i++) + delete[] Data[i]; + delete[] Data; } } } -- 2.39.2