瀏覽代碼

Fix various warnings

unused variable, wrong cast, return from non void function...
Julien Finet 13 年之前
父節點
當前提交
ea469935d6

+ 3 - 0
CMake/CTestCustom.cmake.in

@@ -75,6 +75,9 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
   "PythonQt.*src.*PythonQt.*(cpp|h)"
   "include.PythonQt.PythonQt.*h"
 
+  # ctkDcmSCU is a copy from dcmtk, it should be fixed there.
+  ".*ctkDcmSCU.cc.*"
+
   # Suppressing warnings about duplicate libraries in Darwin
   # At some point this may be addressed by CMake feature request: 
   # http://public.kitware.com/Bug/view.php?id=10179

+ 1 - 1
Libs/Core/ctkDependencyGraph.cpp

@@ -608,7 +608,7 @@ void ctkDependencyGraph::insertEdge(int from, int to)
   
   // resize if needed
   size_t capacity = d_ptr->Edges[from]->capacity();
-  if (d_ptr->OutDegree[from] > capacity)
+  if (d_ptr->OutDegree[from] > static_cast<int>(capacity))
     {
     d_ptr->Edges[from]->resize(capacity + capacity * 0.3);
     }

+ 6 - 2
Libs/Core/ctkErrorLogFDMessageHandler.cpp

@@ -170,10 +170,14 @@ void ctkFDHandler::run()
     while(c != '\n')
       {
 #ifdef Q_OS_WIN32
-      _read(this->Pipe[0], &c, 1); // When used with pipe, read() is blocking
+      ssize_t res = _read(this->Pipe[0], &c, 1); // When used with pipe, read() is blocking
 #else
-      read(this->Pipe[0], &c, 1); // When used with pipe, read() is blocking
+      ssize_t res = read(this->Pipe[0], &c, 1); // When used with pipe, read() is blocking
 #endif
+      if (res == -1)
+        {
+        break;
+        }
       if (c != '\n')
         {
         line += c;

+ 6 - 2
Libs/Core/ctkErrorLogModel.cpp

@@ -159,10 +159,14 @@ void ctkErrorLogTerminalOutput::output(const QString& text)
     QMutexLocker locker(&d->OutputMutex);
     QString textWithNewLine = text + "\n";
 #ifdef _MSC_VER
-    _write(d->FD, qPrintable(textWithNewLine), textWithNewLine.size());
+    ssize_t res = _write(d->FD, qPrintable(textWithNewLine), textWithNewLine.size());
 #else
-    write(d->FD, qPrintable(textWithNewLine), textWithNewLine.size());
+    ssize_t res = write(d->FD, qPrintable(textWithNewLine), textWithNewLine.size());
 #endif
+    if (res == -1)
+      {
+      return;
+      }
   }
 }
 

+ 2 - 0
Libs/DICOM/Core/ctkDICOMDatabase.cpp

@@ -467,6 +467,8 @@ void ctkDICOMDatabase::insert( const ctkDICOMDataset& ctkDataset, bool storeFile
 void ctkDICOMDatabase::insert ( const QString& filePath, bool storeFile, bool generateThumbnail, bool createHierarchy, const QString& destinationDirectoryName)
 {
   Q_D(ctkDICOMDatabase);
+  Q_UNUSED(createHierarchy);
+  Q_UNUSED(destinationDirectoryName);
 
   /// first we check if the file is already in the database
   if (fileExistsAndUpToDate(filePath))

+ 4 - 4
Libs/DICOM/Core/ctkDICOMIndexer.cpp

@@ -100,7 +100,6 @@ void ctkDICOMIndexer::addFile(ctkDICOMDatabase& ctkDICOMDatabase,
                                    const QString& destinationDirectoryName)
                                    
 {
-  Q_D(ctkDICOMIndexer);
   if (!destinationDirectoryName.isEmpty())
   {
     logger.warn("Ignoring destinationDirectoryName parameter, just taking it as indication we should copy!");
@@ -123,7 +122,6 @@ void ctkDICOMIndexer::addDirectory(ctkDICOMDatabase& ctkDICOMDatabase,
   OFStandard::searchDirectoryRecursively( QDir::toNativeSeparators(src_directory.c_str()).toAscii().data(), originalDcmtkFileNames, "", "");
 
   int totalNumberOfFiles = originalDcmtkFileNames.size();
-  int numberOfFilesProcessed = 0;
 
   // hack to reverse list of filenames (not neccessary when image loading works correctly)
   for ( OFListIterator(OFString) iter = originalDcmtkFileNames.begin(); iter != originalDcmtkFileNames.end(); ++iter )
@@ -159,8 +157,10 @@ void ctkDICOMIndexer::addDirectory(ctkDICOMDatabase& ctkDICOMDatabase,
 }
 
 //------------------------------------------------------------------------------
-void ctkDICOMIndexer::refreshDatabase(ctkDICOMDatabase& ctkDICOMDatabase, const QString& directoryName)
+void ctkDICOMIndexer::refreshDatabase(ctkDICOMDatabase& dicomDatabase, const QString& directoryName)
 {
+  Q_UNUSED(dicomDatabase);
+  Q_UNUSED(directoryName);
   /*
    * Probably this should go to the database class as well
    * Or we have to extend the interface to make possible what we do here
@@ -168,7 +168,7 @@ void ctkDICOMIndexer::refreshDatabase(ctkDICOMDatabase& ctkDICOMDatabase, const
    
 
   /// get all filenames from the database
-  QSqlQuery allFilesQuery(ctkDICOMDatabase.database());
+  QSqlQuery allFilesQuery(dicomDatabase.database());
   QStringList databaseFileNames;
   QStringList filesToRemove;
   this->loggedExec(allFilesQuery, "SELECT Filename from Images;");

+ 0 - 2
Libs/DICOM/Core/ctkDICOMModel.cpp

@@ -733,8 +733,6 @@ bool ctkDICOMModel::setParentData(const QModelIndex &index, const QVariant &valu
     }
   else
     {
-    Node* node = d->nodeFromIndex(index);
-
     bool checkedExist = false;
     bool partiallyCheckedExist = false;
     bool uncheckedExist = false;

+ 1 - 0
Libs/DICOM/Core/ctkDICOMQuery.cpp

@@ -76,6 +76,7 @@ public:
         emit this->query->debug("Got a find response!");
         return this->ctkDcmSCU::handleFINDResponse(presID, response, waitForNextResponse);
         }
+      return DIMSE_NULLKEY;
     };
 };
 

+ 0 - 1
Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp

@@ -270,7 +270,6 @@ void ctkDICOMQueryRetrieveWidget::retrieve()
   retrieve->setKeepAssociationOpen(true);
   // pull from GUI
   retrieve->setMoveDestinationAETitle( serverParameters["StorageAETitle"].toString() );
-  int step = 0;
 
   // do the rerieval for each selected series
   foreach( QString studyUID, d->QueriesByStudyUID.keys() )

+ 1 - 0
Libs/Visualization/VTK/Widgets/ctkVTKMagnifyView.cpp

@@ -117,6 +117,7 @@ void ctkVTKMagnifyViewPrivate::resetEventHandler()
 // --------------------------------------------------------------------------
 void ctkVTKMagnifyViewPrivate::timerEvent(QTimerEvent * event)
 {
+  Q_UNUSED(event);
   Q_ASSERT(event->timerId() == this->EventHandler.TimerId);
 
   if (this->EventHandler.EventType == UpdatePixmapEvent)