]> Creatis software - gdcm.git/commitdiff
ENH: Minor cleanup. Moved the cleanup of the transfer syntax directly within the...
authormalaterre <malaterre>
Tue, 11 Jan 2005 23:16:47 +0000 (23:16 +0000)
committermalaterre <malaterre>
Tue, 11 Jan 2005 23:16:47 +0000 (23:16 +0000)
src/gdcmDocument.cxx
src/gdcmTS.cxx

index ae50bc8a2cbd31b55893e6e57c672bb5f84939d0..c60284b6d51e09afadbd75d4239f6e89a27723e5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/11 23:06:35 $
-  Version:   $Revision: 1.180 $
+  Date:      $Date: 2005/01/11 23:16:47 $
+  Version:   $Revision: 1.181 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -2373,7 +2373,7 @@ std::string Document::GetTransferSyntaxName()
 
    if ( transferSyntax == GDCM_NOTLOADED )
    {
-      gdcmVerboseMacro( "Transfer Syntax not loaded. " << std::endl
+      gdcmErrorMacro( "Transfer Syntax not loaded. " << std::endl
                << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE" );
       return "Uncompressed ACR-NEMA";
    }
@@ -2383,13 +2383,8 @@ std::string Document::GetTransferSyntaxName()
       return "Uncompressed ACR-NEMA";
    }
 
-   while ( ! isdigit((unsigned char)transferSyntax[transferSyntax.length()-1]) )
-   {
-      transferSyntax.erase(transferSyntax.length()-1, 1);
-   }
    // we do it only when we need it
-   TS* ts         = Global::GetTS();
-   std::string tsName = ts->GetValue( transferSyntax );
+   const TSKey &tsName = Global::GetTS()->GetValue( transferSyntax );
 
    // Global::GetTS() is a global static you shall never try to delete it!
    return tsName;
index f0f2049c98b396da2975088157dc1df339c6db42..d61ca287af2c98a8cc75b151a264f431e12bcda9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmTS.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/11 16:44:43 $
-  Version:   $Revision: 1.35 $
+  Date:      $Date: 2005/01/11 23:16:47 $
+  Version:   $Revision: 1.36 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -134,7 +134,14 @@ int TS::Count(TSKey const &key)
 
 TSAtr const & TS::GetValue(TSKey const &key) 
 {
-   TSHT::const_iterator it = TsMap.find(key);
+   // First thing clean up the string sometime the transfer syntax is padded with spaces
+   std::string copy = key;
+   while ( copy.size() && !isdigit((unsigned char)copy[copy.size()-1]) )
+   {
+      copy.erase(copy.size()-1, 1);
+   }
+
+   TSHT::const_iterator it = TsMap.find(copy);
    if (it == TsMap.end())
    {
       return GDCM_UNFOUND;