X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmFile.cxx;h=6276a5bcd1f5dad974f59d271a14636f6d06621a;hb=refs%2Ftags%2FVersion0.6.bp;hp=f044feb11eb06bf4ffbd20d45c59ca749f2cb6af;hpb=9649936f884197f6f6260aae051d33729bce07d5;p=gdcm.git diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index f044feb1..6276a5bc 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2004/10/28 03:10:58 $ - Version: $Revision: 1.150 $ + Date: $Date: 2004/11/05 21:23:46 $ + Version: $Revision: 1.152 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -73,6 +73,7 @@ File::File(std::string const & filename ) */ void File::Initialise() { + PixelConverter = NULL; //just in case if ( HeaderInternal->IsReadable() ) { ImageDataSizeRaw = ComputeDecompressedPixelDataSizeFromHeader(); @@ -85,7 +86,7 @@ void File::Initialise() ImageDataSize = ImageDataSizeRaw; } - PixelConverter = new PixelConvert; + PixelConverter = new PixelConvert; //LEAK ! PixelConverter->GrabInformationsFromHeader( HeaderInternal ); } SaveInitialValues(); @@ -105,6 +106,11 @@ File::~File() HeaderInternal = 0; DeleteInitialValues(); + if( PixelConverter ) + { + //delete PixelConverter; + } + } /** @@ -558,7 +564,7 @@ bool File::WriteRawData(std::string const & fileName) std::ofstream fp1(fileName.c_str(), std::ios::out | std::ios::binary ); if (!fp1) { - printf("Fail to open (write) file [%s] \n", fileName.c_str()); + dbg.Verbose(2, "Fail to open (write) file:", fileName.c_str()); return false; } fp1.write((char*)Pixel_Data, ImageDataSize); @@ -634,16 +640,16 @@ bool File::WriteBase (std::string const & fileName, FileType type) std::ios::out | std::ios::binary); if (fp1 == NULL) { - printf("Failed to open (write) File [%s] \n", fileName.c_str()); + dbg.Verbose(2, "Failed to open (write) File: " , fileName.c_str()); return false; } if ( type == ImplicitVR || type == ExplicitVR ) { // writing Dicom File Preamble - uint8_t filePreamble[128]; + char filePreamble[128]; memset(filePreamble, 0, 128); - fp1->write((char*)filePreamble, 128); + fp1->write(filePreamble, 128); fp1->write("DICM", 4); } @@ -700,6 +706,7 @@ bool File::WriteBase (std::string const & fileName, FileType type) } // ----------------- End of Special Patch ---------------- fp1->close (); + delete fp1; return true; }