]> Creatis software - gdcm.git/commitdiff
ENH: avoid writing illegal images with a double dots.
authormalaterre <malaterre>
Wed, 2 Jan 2008 14:58:00 +0000 (14:58 +0000)
committermalaterre <malaterre>
Wed, 2 Jan 2008 14:58:00 +0000 (14:58 +0000)
src/gdcmUtil.cxx
src/gdcmUtil.h

index 6655dc5f7585d200a419a6ce76da986c414429a1..bf3b7056397b9f147328be167ab74fbd690efd1f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmUtil.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/10/17 08:57:55 $
-  Version:   $Revision: 1.189 $
+  Date:      $Date: 2008/01/02 14:58:00 $
+  Version:   $Revision: 1.190 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -111,7 +111,7 @@ std::string Util::RootUID        = GDCM_UID;
 #endif   
    uint8_t *Util::FileMetaInformationVersion = (uint8_t *)&FMIV;
 
-   std::string Util::GDCM_MAC_ADRESS = GetMACAddress();
+   std::string Util::GDCM_MAC_ADDRESS = GetMACAddress();
 
 //-------------------------------------------------------------------------
 // Public
@@ -965,6 +965,7 @@ std::string Util::CreateUniqueUID(const std::string &root)
    if ( root.empty() )
    {
       // gdcm UID prefix, as supplied by http://www.medicalconnections.co.uk
+      assert( !RootUID.empty() );
       prefix = RootUID; 
    }
    else
@@ -975,8 +976,11 @@ std::string Util::CreateUniqueUID(const std::string &root)
    // A root was specified use it to forge our new UID:
    append += ".";
    //append += Util::GetMACAddress(); // to save CPU time
-   append += Util::GDCM_MAC_ADRESS;
-   append += ".";
+   if( !Util::GDCM_MAC_ADDRESS.empty() ) // When mac address was empty we would end up with a double . which is illegal
+     {
+     append += Util::GDCM_MAC_ADDRESS;
+     append += ".";
+     }
    append += Util::GetCurrentDateTime();
    append += ".";
    //Also add a mini random number just in case:
@@ -1275,7 +1279,7 @@ void Util::hfpswap(double *a, double *b)
   ghost@aladdin.com
  */
 
-/* $Id: gdcmUtil.cxx,v 1.189 2007/10/17 08:57:55 jpr Exp $ */
+/* $Id: gdcmUtil.cxx,v 1.190 2008/01/02 14:58:00 malaterre Exp $ */
 
 /*
   Independent implementation of MD5 (RFC 1321).
index 77f5f89226c47d201021a7c201d31867fccc5ab4..f24b0000235393c6275a343d5f2dd8369a08c3fa 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmUtil.h,v $
   Language:  C++
-  Date:      $Date: 2007/10/30 09:14:42 $
-  Version:   $Revision: 1.71 $
+  Date:      $Date: 2008/01/02 14:58:00 $
+  Version:   $Revision: 1.72 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -126,7 +126,7 @@ private:
    static uint8_t *FileMetaInformationVersion;
    
    static const uint16_t FMIV;
-   static std::string GDCM_MAC_ADRESS;
+   static std::string GDCM_MAC_ADDRESS;
 
 // For MD5
 
@@ -152,7 +152,7 @@ private:
   ghost@aladdin.com
 */
 
-/* $Id: gdcmUtil.h,v 1.71 2007/10/30 09:14:42 jpr Exp $ */
+/* $Id: gdcmUtil.h,v 1.72 2008/01/02 14:58:00 malaterre Exp $ */
 /*
   Independent implementation of MD5 (RFC 1321).
   This code implements the MD5 Algorithm defined in RFC 1321, whose