]> Creatis software - gdcm.git/blobdiff - src/gdcmDocument.cxx
ENH: Fix a warning with gcc4: TestHash.cxx:20: warning: deprecated conversion from...
[gdcm.git] / src / gdcmDocument.cxx
index 857f12de05ca1a44e4acbc750d1599e2752f1c29..c037ba6de931a36addc304ce7cb3272daa6acfe7 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/06 22:31:31 $
-  Version:   $Revision: 1.96 $
+  Date:      $Date: 2004/10/10 03:03:10 $
+  Version:   $Revision: 1.101 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -33,7 +33,7 @@
    #include <netinet/in.h>
 #endif
 
-#  include <iomanip>
+#include <iomanip>
 
 // Implicit VR Little Endian
 #define UI1_2_840_10008_1_2      "1.2.840.10008.1.2"
@@ -981,12 +981,12 @@ bool gdcmDocument::SetEntryByNumber(std::string const& content,
       gdcmVRKey vr = valEntry->GetVR();
       if( vr == "US" || vr == "SS" )
       {
-         c = CountSubstring(content, "\\") + 1; // for multivaluated items
+         c = gdcmUtil::CountSubstring(content, "\\") + 1; // for multivaluated items
          l = c*2;
       }
       else if( vr == "UL" || vr == "SL" )
       {
-         c = CountSubstring(content, "\\") + 1; // for multivaluated items
+         c = gdcmUtil::CountSubstring(content, "\\") + 1; // for multivaluated items
          l = c*4;;
       }
    }
@@ -1452,6 +1452,7 @@ void gdcmDocument::ParseDES(gdcmDocEntrySet *set,
             // form ( group, elem )...
             if (gdcmDocument* dummy = dynamic_cast< gdcmDocument* > ( set ) )
             {
+               (void)dummy;
                newBinEntry->SetKey( newBinEntry->GetKey() );
             }
             // but when "this" is a SQItem, we are inserting this new
@@ -1784,8 +1785,8 @@ void gdcmDocument::FindDocEntryLength( gdcmDocEntry *entry )
    {
       if ( vr == "OB" || vr == "OW" || vr == "SQ" || vr == "UN" ) 
       {
-         // The following reserved two bytes (see PS 3.5-2001, section
-         // 7.1.2 Data element structure with explicit vr p27) must be
+         // The following reserved two bytes (see PS 3.5-2003, section
+         // "7.1.2 Data element structure with explicit vr", p 27) must be
          // skipped before proceeding on reading the length on 4 bytes.
          fseek(Fp, 2L, SEEK_CUR);
          uint32_t length32 = ReadInt32();
@@ -1951,7 +1952,7 @@ void gdcmDocument::FindDocEntryVR( gdcmDocEntry *entry )
 */
 bool gdcmDocument::CheckDocEntryVR(gdcmDocEntry *entry, gdcmVRKey vr)
 {
-   char msg[100]; // for sprintf
+   std::string msg;
    bool realExplicit = true;
 
    // Assume we are reading a falsely explicit VR file i.e. we reached
@@ -1979,9 +1980,9 @@ bool gdcmDocument::CheckDocEntryVR(gdcmDocEntry *entry, gdcmVRKey vr)
    {
       // We thought this was explicit VR, but we end up with an
       // implicit VR tag. Let's backtrack.   
-      sprintf(msg,"Falsely explicit vr file (%04x,%04x)\n", 
-                   entry->GetGroup(), entry->GetElement());
-      dbg.Verbose(1, "gdcmDocument::FindVR: ",msg);
+      msg = gdcmUtil::Format("Falsely explicit vr file (%04x,%04x)\n", 
+                    entry->GetGroup(), entry->GetElement());
+      dbg.Verbose(1, "gdcmDocument::FindVR: ", msg.c_str());
 
       if( entry->GetGroup() % 2 && entry->GetElement() == 0x0000)
       {
@@ -2119,7 +2120,7 @@ std::string gdcmDocument::GetDocEntryUnvalue(gdcmDocEntry* entry)
          uint16_t newInt16;
 
          tokens.erase( tokens.begin(), tokens.end()); // clean any previous value
-         Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
+         gdcmUtil::Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
          for (unsigned int i=0; i<tokens.size(); i++) 
          {
             newInt16 = atoi(tokens[i].c_str());
@@ -2133,7 +2134,7 @@ std::string gdcmDocument::GetDocEntryUnvalue(gdcmDocEntry* entry)
          uint32_t newInt32;
 
          tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
-         Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
+         gdcmUtil::Tokenize (((gdcmValEntry *)entry)->GetValue(), tokens, "\\");
          for (unsigned int i=0; i<tokens.size();i++) 
          {
             newInt32 = atoi(tokens[i].c_str());
@@ -2839,11 +2840,11 @@ void gdcmDocument::ComputeRLEInfo()
    }
    // Encoded pixel data: for the time being we are only concerned with
    // Jpeg or RLE Pixel data encodings.
-   // As stated in ps-3.3, 8.2:
+   // As stated in PS 3.5-2003, section 8.2 p44:
    // "If sent in Encapsulated Format (i.e. other than the Native Format) the
    //  value representation OB is used".
    // Hence we expect an OB value representation. Concerning OB VR,
-   // the section PS3.3, A.4.c (p58 and p59), states:
+   // the section PS 3.5-2003, section A.4.c p 58-59, states:
    // "For the Value Representations OB and OW, the encoding shall meet the
    //   following specifications depending on the Data element tag:"
    //   [...snip...]
@@ -2877,7 +2878,7 @@ void gdcmDocument::ComputeRLEInfo()
       delete[] basicOffsetTableItemValue;
    }
 
-   // Encapsulated RLE Compressed Images (see PS-3.3, Annex G).
+   // Encapsulated RLE Compressed Images (see PS 3.5-2003, Annex G)
    // Loop on the frame[s] and store the parsed information in a
    // gdcmRLEFramesInfo.
    long frameLength;
@@ -2926,10 +2927,10 @@ void gdcmDocument::ComputeRLEInfo()
        // Store the collected info
        gdcmRLEFrame* newFrameInfo = new gdcmRLEFrame;
        newFrameInfo->NumberFragments = nbRleSegments;
-       for( unsigned int k = 1; k <= nbRleSegments; k++ )
+       for( unsigned int uk = 1; uk <= nbRleSegments; uk++ )
        {
-          newFrameInfo->Offset[k] = frameOffset + rleSegmentOffsetTable[k];
-          newFrameInfo->Length[k] = rleSegmentLength[k];
+          newFrameInfo->Offset[uk] = frameOffset + rleSegmentOffsetTable[uk];
+          newFrameInfo->Length[uk] = rleSegmentLength[uk];
        }
        RLEInfo.Frames.push_back( newFrameInfo );
    }