From: regrain Date: Tue, 20 Jan 2004 15:48:37 +0000 (+0000) Subject: * Bug fix for the use of shadow dictionaries X-Git-Tag: Version0.4~75 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=413108bd0261c821361a4fec1c0fa34ea446cb29;p=gdcm.git * Bug fix for the use of shadow dictionaries -- BeNours --- 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); } /**