From 413108bd0261c821361a4fec1c0fa34ea446cb29 Mon Sep 17 00:00:00 2001 From: regrain Date: Tue, 20 Jan 2004 15:48:37 +0000 Subject: [PATCH] * Bug fix for the use of shadow dictionaries -- BeNours --- ChangeLog | 4 ++++ src/gdcmParser.cxx | 15 +++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39f5ba51..59d8f9c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-01-19 Benoit Regrain + * Add the use of shadow dictionaries + * bug fix and coding style + 2004-01-19 Benoit Regrain * src/gdcmFile.cxx : bug fix concerning the close of file * src/gdcmParser.[h|cxx] : remove obvious Pub informations diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index 05460431..362ca03f 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -782,6 +782,7 @@ void gdcmParser::UpdateShaEntries(void) else vr=(*it)->GetVR(); + (*it)->SetValue(GetHeaderEntryUnvalue(*it)); if(entry) { // Set the new entry and the new value @@ -793,7 +794,6 @@ void gdcmParser::UpdateShaEntries(void) else { // Remove precedent value transformation - (*it)->SetValue(GetHeaderEntryUnvalue(*it)); (*it)->SetDictEntry(NewVirtualDictEntry((*it)->GetGroup(),(*it)->GetElement(),vr)); } } @@ -1312,24 +1312,15 @@ void gdcmParser::LoadHeaderEntry(gdcmHeaderEntry *Entry) } // We need an additional byte for storing \0 that is not on disk - char* NewValue = (char*)malloc(length+1); - if( !NewValue) - { - dbg.Verbose(1, "LoadElementValue: Failed to allocate NewValue"); - return; - } - NewValue[length]= 0; - - item_read = fread(NewValue, (size_t)length, (size_t)1, fp); + std::string NewValue(length,0); + item_read = fread(&(NewValue[0]), (size_t)length, (size_t)1, fp); if ( item_read != 1 ) { - free(NewValue); dbg.Verbose(1, "gdcmParser::LoadElementValue","unread element value"); Entry->SetValue("gdcm::UnRead"); return; } Entry->SetValue(NewValue); - free(NewValue); } /** -- 2.45.1