]> Creatis software - gdcm.git/blobdiff - src/gdcmDocument.cxx
* Fix some compilation warnings
[gdcm.git] / src / gdcmDocument.cxx
index d9d70e0b71db8e31a8c398e1457f86ec12a11bfd..4e9f21f5d403fbb824a333826e2d896de5730239 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 12:58:28 $
-  Version:   $Revision: 1.294 $
+  Date:      $Date: 2005/10/19 13:15:39 $
+  Version:   $Revision: 1.299 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -127,7 +127,7 @@ bool Document::DoTheLoadingDocumentJob(  )
 
    Group0002Parsed = false;
 
-   gdcmWarningMacro( "Starting parsing of file: " << Filename.c_str());
+   gdcmDebugMacro( "Starting parsing of file: " << Filename.c_str());
 
    Fp->seekg(0, std::ios::end);
    long lgt = Fp->tellg();       // total length of the file
@@ -277,7 +277,7 @@ bool Document::DoTheLoadingDocumentJob(  )
  */
 void Document::AddForceLoadElement (uint16_t group, uint16_t elem) 
 { 
-   Element el;
+   DicomElement el;
    el.Group = group;
    el.Elem  = elem;
    UserForceLoadList.push_back(el); 
@@ -604,7 +604,8 @@ void Document::WriteContent(std::ofstream *fp, FileType filetype)
 {
    // Skip if user wants to write an ACR-NEMA file
 
-   if ( filetype == ImplicitVR || filetype == ExplicitVR )
+   if ( filetype == ImplicitVR || filetype == ExplicitVR ||
+     filetype == JPEG )
    {
       // writing Dicom File Preamble
       char filePreamble[128];
@@ -1080,8 +1081,7 @@ void Document::ParseDES(DocEntrySet *set, long offset,
             if ( newDocEntry->GetGroup()%2 != 0 )
             {
                 Fp->seekg( l, std::ios::cur);
-                RemoveEntry( newDocEntry );  // Remove and delete
-                //used = false; // never used
+                delete newDocEntry;  // Delete, not in the set 
                 continue;  
             } 
          } 
@@ -1089,8 +1089,7 @@ void Document::ParseDES(DocEntrySet *set, long offset,
          {
            // User asked to skip *any* SeQuence
             Fp->seekg( l, std::ios::cur);
-            //used = false; // never used
-            RemoveEntry( newDocEntry );  // Remove and delete
+            delete newDocEntry; // Delete, not in the set
             continue;
          }
          // delay the dynamic cast as late as possible
@@ -1103,11 +1102,9 @@ void Document::ParseDES(DocEntrySet *set, long offset,
          // is a Document, then we are building the first depth level.
          // Hence the SeqEntry we are building simply has a depth
          // level of one:
-//         SQItem *parentSQItem = dynamic_cast< SQItem* > ( set );
         if ( set == this ) // ( dynamic_cast< Document* > ( set ) )
          {
             newSeqEntry->SetDepthLevel( 1 );
-         //   newSeqEntry->SetKey( newSeqEntry->GetKey() );
          }
          // But when "set" is already a SQItem, we are building a nested
          // sequence, and hence the depth level of the new SeqEntry
@@ -1117,9 +1114,6 @@ void Document::ParseDES(DocEntrySet *set, long offset,
          else if (SQItem *parentSQItem = dynamic_cast< SQItem* > ( set ) )
          {
             newSeqEntry->SetDepthLevel( parentSQItem->GetDepthLevel() + 1 );
-
-          //  newSeqEntry->SetKey(  parentSQItem->GetBaseTagKey()
-          //                      + newSeqEntry->GetKey() );
          }
 
          if ( l != 0 )
@@ -1159,7 +1153,7 @@ void Document::ParseDES(DocEntrySet *set, long offset,
       }
       first = false;
    }                               // end While
-   gdcmWarningMacro( "Exit from ParseDES, delim-mode " << delim_mode );
+   gdcmDebugMacro( "Exit from ParseDES, delim-mode " << delim_mode );
 }
 
 /**
@@ -1495,10 +1489,9 @@ VRKey Document::FindDocEntryVR()
    VRKey vr;
    Fp->read(&(vr[0]),(size_t)2);
 
-   gdcmWarningMacro( "--> VR: " << vr )
+   gdcmDebugMacro( "--> VR: " << vr )
    if ( !CheckDocEntryVR(vr) )
    {
-      Global::GetVR()->Print(std::cerr);
       gdcmWarningMacro( "Unknown VR '" << vr << "'" )
       Fp->seekg(positionOnEntry, std::ios::beg);
       return GDCM_VRUNKNOWN;
@@ -1695,7 +1688,7 @@ bool Document::CheckSwap()
    char *entCur = deb + 128;
    if ( memcmp(entCur, "DICM", (size_t)4) == 0 )
    {
-      gdcmWarningMacro( "Looks like DICOM Version3 (preamble + DCM)" );
+      gdcmDebugMacro( "Looks like DICOM Version3 (preamble + DCM)" );
       
       // Group 0002 should always be VR, and the first element 0000
       // Let's be carefull (so many wrong headers ...)
@@ -1727,24 +1720,24 @@ bool Document::CheckSwap()
       // instead of just checking for UL, OB and UI !? group 0000 
       {
          Filetype = ExplicitVR;
-         gdcmWarningMacro( "Group 0002 : Explicit Value Representation");
+         gdcmDebugMacro( "Group 0002 : Explicit Value Representation");
       } 
       else 
       {
          Filetype = ImplicitVR;
-         gdcmWarningMacro( "Group 0002 :Not an explicit Value Representation;"
+         gdcmErrorMacro( "Group 0002 :Not an explicit Value Representation;"
                         << "Looks like a bugged Header!");
       }
       
       if ( net2host )
       {
          SwapCode = 4321;
-         gdcmWarningMacro( "HostByteOrder != NetworkByteOrder");
+         gdcmDebugMacro( "HostByteOrder != NetworkByteOrder");
       }
       else 
       {
          SwapCode = 1234;
-         gdcmWarningMacro( "HostByteOrder = NetworkByteOrder");
+         gdcmDebugMacro( "HostByteOrder = NetworkByteOrder");
       }
       
       // Position the file position indicator at first tag 
@@ -1791,7 +1784,7 @@ bool Document::CheckSwap()
            memcmp(entCur, "OB", (size_t)2) == 0 )
          {
             Filetype = ExplicitVR;
-            gdcmWarningMacro( "Group 0002 : Explicit Value Representation");
+            gdcmDebugMacro( "Group 0002 : Explicit Value Representation");
             return true;
           }
     }
@@ -1974,7 +1967,7 @@ DocEntry *Document::ReadNextDocEntry()
          }
       }
    }
-   gdcmWarningMacro( "Found VR: " << vr << " / Real VR: " << realVR );
+   gdcmDebugMacro( "Found VR: " << vr << " / Real VR: " << realVR );
 
    DocEntry *newEntry;
    if ( Global::GetVR()->IsVROfSequence(realVR) )