From: jpr Date: Tue, 4 Jul 2006 09:36:18 +0000 (+0000) Subject: Port Mathieu's patch from gdcm 1.2 (in gdcmValEntry.cxx) X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=057158e5e9575f1241d322989c673371d85b0e7d;p=gdcm.git Port Mathieu's patch from gdcm 1.2 (in gdcmValEntry.cxx) ENH: Better patch. Always pad with space except if VR is UI (Shouldn't we think in unifying gdcm1.3 an cvs version -post gdcm1.3- a lot of work is done twice; interesting enhencements are now in gdcm1.3 The only pb is New vs new, right? --- diff --git a/src/gdcmDataEntry.cxx b/src/gdcmDataEntry.cxx index 570c3c50..36aa38e2 100644 --- a/src/gdcmDataEntry.cxx +++ b/src/gdcmDataEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDataEntry.cxx,v $ Language: C++ - Date: $Date: 2006/06/29 13:26:08 $ - Version: $Revision: 1.39 $ + Date: $Date: 2006/07/04 09:36:18 $ + Version: $Revision: 1.40 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -366,7 +366,6 @@ uint32_t DataEntry::GetValueCount( ) const void DataEntry::SetString(std::string const &value) { DeleteBinArea(); - const VRKey &vr = GetVR(); if ( vr == "US" || vr == "SS" ) { @@ -417,16 +416,16 @@ void DataEntry::SetString(std::string const &value) tokens.clear(); } else - { - //if( value.size() > 0 ) // when user sets a string to 0, *do* the job. - { - size_t l = value.size(); - SetLength(l + l%2); - NewBinArea(); - memcpy(BinArea, value.c_str(), l); - if (l%2) + { + size_t l = value.size(); + SetLength(l + l%2); + NewBinArea(); + memcpy(BinArea, value.c_str(), l); + if (l%2) // padded with blank except for UI + if ( vr == "UI" ) BinArea[l] = '\0'; - } + else + BinArea[l] = ' '; } State = STATE_LOADED; }