]> Creatis software - gdcm.git/commitdiff
* Bug fix for the use of shadow dictionaries
authorregrain <regrain>
Tue, 20 Jan 2004 15:48:37 +0000 (15:48 +0000)
committerregrain <regrain>
Tue, 20 Jan 2004 15:48:37 +0000 (15:48 +0000)
     -- BeNours

ChangeLog
src/gdcmParser.cxx

index 39f5ba511e6c0af93d318de27efc253e1ff0152a..59d8f9c488a1500f4794fac70043ad2f0752a0ef 100644 (file)
--- 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
index 054604313d3c2c81bdb39af6b02a91b72f8e1534..362ca03fc8a9b9d48a40b6270d2210b2f8f362e1 100644 (file)
@@ -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);
 }
 
 /**