X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=src%2FgdcmDicomDir.cxx;h=6f80dfce2b7d19b98e1c92d63edf93ca73365ad9;hb=8cdbf11a3b1f8427281f31a9fd2a70aa66d620fa;hp=fb566c629744cdda1fbc37418442a2c1e35e7c18;hpb=4f48626ba6d2dc26d40f07b780b0fdb5fcc04911;p=gdcm.git diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index fb566c62..6f80dfce 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -74,10 +74,10 @@ gdcmDicomDir::gdcmDicomDir(const char *FileName, bool parseDir, if(strlen(FileName)==1 && FileName[0]=='.') { // user passed '.' as Name // we get current directory name - char*dummy=(char*) malloc(1000); - getcwd(dummy,(size_t)1000); + char* dummy= new char[1000]; + getcwd(dummy, (size_t)1000); SetFileName(dummy); // will be converted into a string - free(dummy); // no longer needed + delete[] dummy; // no longer needed } if(parseDir) @@ -307,11 +307,10 @@ bool gdcmDicomDir::Write(std::string fileName) return(false); } - char * filePreamble; - filePreamble=(char*)calloc(128,1); + char * filePreamble = new char[128]; fwrite(filePreamble,128,1,fp1); fwrite("DICM",4,1,fp1); - free(filePreamble); + delete[] filePreamble; UpdateDirectoryRecordSequenceLength(); WriteEntries(fp1); @@ -326,8 +325,8 @@ bool gdcmDicomDir::Write(std::string fileName) void gdcmDicomDir::WriteEntries(FILE *_fp) { - // TODO (?) tester les echecs en ecriture - // (apres chaque fwrite, dans le WriteEntry) + /// \todo (?) tester les echecs en ecriture + /// (apres chaque fwrite, dans le WriteEntry) gdcmDicomDirMeta *ptrMeta; ListDicomDirPatient::iterator itPatient; @@ -446,13 +445,13 @@ void gdcmDicomDir::CheckBoundaries() itImage = ((*itSerie)->GetDicomDirImages()).begin(); while (itImage != (*itSerie)->GetDicomDirImages().end() ) { (*itImage)->ResetBoundaries(1); - ++itImage; - } - ++itSerie; - } - ++itStudy; - } - ++itPatient; + ++itImage; + } + ++itSerie; + } + ++itStudy; + } + ++itPatient; } } @@ -642,6 +641,9 @@ void gdcmDicomDir::AddObjectToEnd(gdcmDicomDirType type,ListTag::iterator begin, case gdcmDicomDir::GDCM_DICOMDIR_IMAGE: AddDicomDirImageToEnd(begin,end); break; + case gdcmDicomDir::GDCM_DICOMDIR_NONE: + AddDicomDirImageToEnd(begin,end); //FIXME + break; } } @@ -929,7 +931,8 @@ void gdcmDicomDir::UpdateDirectoryRecordSequenceLength() { offset += 4; // delimiters don't have a value. } } - bool res=SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps. + //bool res=SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps. + SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps. return; }