]> Creatis software - gdcm.git/blobdiff - src/gdcmUtil.cxx
* Fix memory leaks
[gdcm.git] / src / gdcmUtil.cxx
index c836cb4c75dacf14991d265e93231a5badb59b39..01808c8189c8a4a680da44edc54d0969fdeec552 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmUtil.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/09/06 15:28:49 $
-  Version:   $Revision: 1.163 $
+  Date:      $Date: 2005/10/20 07:25:10 $
+  Version:   $Revision: 1.166 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -186,7 +186,7 @@ int Util::CountSubstring (const std::string &str,
  */
 bool Util::IsCleanString(std::string const &s)
 {
-  std::cout<< std::endl << s << std::endl;
+   std::cout<< std::endl << s << std::endl;
    for(unsigned int i=0; i<s.size(); i++)
    {
       //std::cout<< std::endl << i << " : " << (unsigned char)s[i] << std::endl;
@@ -195,7 +195,7 @@ bool Util::IsCleanString(std::string const &s)
          return false;
       }
    }
-return true;   
+   return true;   
 }
 
 /**
@@ -896,7 +896,7 @@ std::string Util::CreateUniqueUID(const std::string &root)
    append += Util::GDCM_MAC_ADRESS;
    append += ".";
    append += Util::GetCurrentDateTime();
-
+   append += ".";
    //Also add a mini random number just in case:
    char tmp[10];
    int r = (int) (100.0*rand()/RAND_MAX);
@@ -939,9 +939,7 @@ std::ostream &binary_write(std::ostream &os, const uint16_t &val)
 {
 #if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
    uint16_t swap;
-   //swap = ((( val << 8 ) & 0xff00 ) | (( val >> 8 ) & 0x00ff ) );
-   //save CPU time
-   swap = ( val << 8 |  val >> 8  );
+   swap = ( val << 8 | val >> 8 );
 
    return os.write(reinterpret_cast<const char*>(&swap), 2);
 #else
@@ -958,9 +956,6 @@ std::ostream &binary_write(std::ostream &os, const uint32_t &val)
 {
 #if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
    uint32_t swap;
-//   swap = ( ((val<<24) & 0xff000000) | ((val<<8)  & 0x00ff0000) | 
-//            ((val>>8)  & 0x0000ff00) | ((val>>24) & 0x000000ff) );
-// save CPU time
    swap = (  (val<<24)               | ((val<<8)  & 0x00ff0000) | 
             ((val>>8)  & 0x0000ff00) |  (val>>24)               );
    return os.write(reinterpret_cast<const char*>(&swap), 4);