]> Creatis software - gdcm.git/blobdiff - src/gdcmSQItem.cxx
BUG: very same bug when using char* instead of string
[gdcm.git] / src / gdcmSQItem.cxx
index 417093d03ce42351cf21bda9114e74fc4fe569ce..d34f7a9d640f622dd96e8f83d9783bea1d54ac7b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSQItem.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/24 18:03:14 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2004/07/17 22:47:01 $
+  Version:   $Revision: 1.21 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -76,7 +76,10 @@ gdcmSQItem::~gdcmSQItem()
       Entry->SetPrintLevel(2);
       Entry->Print(os);   
       if ( gdcmSeqEntry* SeqEntry = dynamic_cast<gdcmSeqEntry*>(Entry) )
+      {
+         (void)SeqEntry;  //not used
          PrintEndLine = false;
+      }
       if (PrintEndLine)
          os << std::endl;
    } 
@@ -98,11 +101,13 @@ void gdcmSQItem::Write(FILE *fp,FileType filetype)
       // as 'no length'
       if ( (*i)->isItemDelimitor() )
          break;
-      if ( ((*i)->GetGroup() == 0xfffe) && ((*i)->GetElement() == 0x0000) ) 
-        // Fix in order to make some MR PHILIPS images e-film readable
-        // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm:
-        // we just *always* ignore spurious fffe|0000 tag !   
-         return;                       
+
+      // Fix in order to make some MR PHILIPS images e-film readable
+      // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm:
+      // we just *always* ignore spurious fffe|0000 tag ! 
+      if ( ((*i)->GetGroup() == 0xfffe) && ((*i)->GetElement() == 0x0000) )  
+         break; 
+
       // It's up to the gdcmDocEntry Writter to write the SQItem begin element
       // (fffe|e000) as a 'no length' one
       (*i)->Write(fp, filetype);
@@ -134,8 +139,8 @@ bool gdcmSQItem::AddEntry(gdcmDocEntry *entry)
  * @return  true if element was found or created successfully
  */
 
-bool gdcmSQItem::SetEntryByNumber(std::string val,guint16 group, 
-                                  guint16 element)
+bool gdcmSQItem::SetEntryByNumber(std::string val,uint16_t group, 
+                                  uint16_t element)
 {
    for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
    { 
@@ -148,7 +153,7 @@ bool gdcmSQItem::SetEntryByNumber(std::string val,guint16 group,
          // instead of ReplaceOrCreateByNumber 
          // that is a method of gdcmDocument :-( 
          gdcmValEntry* Entry = (gdcmValEntry*)0;
-         TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+         gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
 
          if ( ! ptagHT->count(key))
          {
@@ -202,10 +207,14 @@ bool gdcmSQItem::SetEntryByNumber(std::string val,guint16 group,
  * \brief   Gets a Dicom Element inside a SQ Item Entry, by number
  * @return
  */
-gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(guint16 group, guint16 element) {
-   for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) {
+gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(uint16_t group, uint16_t element)
+{
+   for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
+   {
       if ( (*i)->GetGroup()==group && (*i)->GetElement()==element)
+      {
          return (*i);
+      }
    }   
    return NULL;
 }
@@ -215,9 +224,12 @@ gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(guint16 group, guint16 element) {
  * @return
  */ 
 
-std::string gdcmSQItem::GetEntryByNumber(guint16 group, guint16 element) { 
-   for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) {
-      if ( (*i)->GetGroup()==group && (*i)->GetElement()==element) {
+std::string gdcmSQItem::GetEntryByNumber(uint16_t group, uint16_t element)
+{ 
+   for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
+   {
+      if ( (*i)->GetGroup()==group && (*i)->GetElement()==element)
+      {
          return ((gdcmValEntry *)(*i))->GetValue();
       }
    }