Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion Modules/ThirdParty/GDCM/UpdateFromUpstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ readonly paths="
Utilities/gdcm_openjpeg.h
Utilities/gdcmopenjpeg
Utilities/gdcmrle
Utilities/gdcmutfcpp
Utilities/gdcmuuid
Utilities/gdcm_uuid.h
Utilities/gdcm_zlib.h
Expand Down
118 changes: 78 additions & 40 deletions Modules/ThirdParty/GDCM/src/gdcm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
cmake_minimum_required(VERSION 3.9.2 FATAL_ERROR)
set(GDCM_MAX_VALIDATED_CMAKE_VERSION "3.13.4")

set(GDCM_MAX_VALIDATED_CMAKE_VERSION "3.13.1")
if("${CMAKE_VERSION}" VERSION_LESS_EQUAL "${GDCM_MAX_VALIDATED_CMAKE_VERSION}")
# As of 2018-12-04 GDCM has been validated to build with cmake version 3.13.1 new policies.
# Set and use the newest cmake policies that are validated to work
set(GDCM_CMAKE_POLICY_VERSION "${CMAKE_VERSION}")
else()
set(GDCM_CMAKE_POLICY_VERSION "${GDCM_MAX_VALIDATED_CMAKE_VERSION}")
endif()
cmake_policy(VERSION ${GDCM_CMAKE_POLICY_VERSION})
# Set minimum required version of CMake, and policy version
cmake_minimum_required(VERSION 3.9.2...${GDCM_MAX_VALIDATED_CMAKE_VERSION} FATAL_ERROR) # travis-ci wants 3.9.2

# GDCM version 3.0.0 will only support C++11 and greater
if(CMAKE_CXX_STANDARD EQUAL "98" )
Expand All @@ -17,7 +10,7 @@ endif()
#----------------------------------------------------------------------------

project(GDCM
VERSION 3.0.24
VERSION 3.2.5
LANGUAGES CXX C
)
## NOTE: the "DESCRIPTION" feature of project() was introduced in cmake 3.10.0
Expand Down Expand Up @@ -125,20 +118,39 @@ if(BUILD_SHARED_LIBS)
endif()

#-----------------------------------------------------------------------------
if(NOT EXECUTABLE_OUTPUT_PATH)
set(EXECUTABLE_OUTPUT_PATH ${GDCM_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
mark_as_advanced(EXECUTABLE_OUTPUT_PATH)
# Compatibility with older usage of EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH.
# This should be removed in the future.
if(EXECUTABLE_OUTPUT_PATH)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
message(WARNING "EXECUTABLE_OUTPUT_PATH is deprecated. Use CMAKE_RUNTIME_OUTPUT_DIRECTORY instead.")
endif()
if(NOT LIBRARY_OUTPUT_PATH)
set(LIBRARY_OUTPUT_PATH ${GDCM_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
mark_as_advanced(LIBRARY_OUTPUT_PATH)
if(LIBRARY_OUTPUT_PATH)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH})
message(WARNING "LIBRARY_OUTPUT_PATH is deprecated. Use CMAKE_LIBRARY_OUTPUT_DIRECTORY and CMAKE_ARCHIVE_OUTPUT_DIRECTORY instead.")
endif()

# TODO: The following should be used for CMake 3 and beyond,
# EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH are deprecated
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH})
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
endif()
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
endif()

# Set for legacy internal usage of EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH
if (NOT EXECUTABLE_OUTPUT_PATH)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
if (NOT LIBRARY_OUTPUT_PATH)
if (BUILD_SHARED_LIBS)
set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
else()
set(LIBRARY_OUTPUT_PATH ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
endif()
endif()

#-----------------------------------------------------------------------------
# Adding GDCM_DATA_ROOT
Expand Down Expand Up @@ -187,6 +199,10 @@ macro(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
endif()
endmacro()

if(UNIX)
include(GNUInstallDirs)
endif()

#include(${GDCM_SOURCE_DIR}/CMake/gdcmPlatformCxxTests.cmake)
#
#GDCM_PLATFORM_CXX_TEST(GDCM_CXX_HAS_FUNCTION
Expand Down Expand Up @@ -524,7 +540,7 @@ if(GDCM_STANDALONE)
endif()
if(NOT DEFINED GDCM_DEFAULT_JAVA_VERSION)
# override with cmake -DGDCM_DEFAULT_JAVA_VERSION:STRING=1.5 if you dare
set(GDCM_DEFAULT_JAVA_VERSION 1.7)
set(GDCM_DEFAULT_JAVA_VERSION 1.8)
endif()
if(GDCM_WRAP_JAVA)
set(GDCM_JAVA_SOURCE_VERSION "${GDCM_DEFAULT_JAVA_VERSION}" CACHE STRING "javac source version")
Expand Down Expand Up @@ -696,23 +712,45 @@ if(GDCM_STANDALONE)
)

# documented at https://vtk.org/doc/nightly/html/group__module.html
vtk_module_build(
MODULES ${vtkgdcm_modules}
INSTALL_EXPORT GDCM
ARCHIVE_DESTINATION "${GDCM_INSTALL_LIB_DIR}"
HEADERS_DESTINATION "${GDCM_INSTALL_INCLUDE_DIR}/vtk${vtk_version_suffix}"
CMAKE_DESTINATION "${GDCM_INSTALL_PACKAGE_DIR}"
LICENSE_DESTINATION "${GDCM_INSTALL_DATA_DIR}/vtkgdcm-${GDCM_SHORT_VERSION}"
HIERARCHY_DESTINATION "${GDCM_INSTALL_LIB_DIR}/vtk${vtk_version_suffix}/hierarchy/vtkgdcm"
LIBRARY_NAME_SUFFIX "${vtkgdcm_library_suffix}"
VERSION "${GDCM_VERSION}"
SOVERSION "1"
# TODO: these are probably not set as they should be
#USE_EXTERNAL "${GDCM_USE_EXTERNAL}"
#TEST_DATA_TARGET vtkgdcmData
#TEST_INPUT_DATA_DIRECTORY "${vtkgdcm_test_data_directory_input}"
#TEST_OUTPUT_DATA_DIRECTORY "${vtkgdcm_test_data_directory_output}"
)
if(VTK_VERSION VERSION_LESS 9.3)
vtk_module_build(
MODULES ${vtkgdcm_modules}
INSTALL_EXPORT GDCM
ARCHIVE_DESTINATION "${GDCM_INSTALL_LIB_DIR}"
HEADERS_DESTINATION "${GDCM_INSTALL_INCLUDE_DIR}/vtk${vtk_version_suffix}"
CMAKE_DESTINATION "${GDCM_INSTALL_PACKAGE_DIR}"
LICENSE_DESTINATION "${GDCM_INSTALL_DATA_DIR}/vtkgdcm-${GDCM_SHORT_VERSION}"
#SPDX_DESTINATION "${GDCM_INSTALL_DATA_DIR}/vtkgdcm-${GDCM_SHORT_VERSION}"
HIERARCHY_DESTINATION "${GDCM_INSTALL_LIB_DIR}/vtk${vtk_version_suffix}/hierarchy/vtkgdcm"
LIBRARY_NAME_SUFFIX "${vtkgdcm_library_suffix}"
VERSION "${GDCM_VERSION}"
SOVERSION "1"
# TODO: these are probably not set as they should be
#USE_EXTERNAL "${GDCM_USE_EXTERNAL}"
#TEST_DATA_TARGET vtkgdcmData
#TEST_INPUT_DATA_DIRECTORY "${vtkgdcm_test_data_directory_input}"
#TEST_OUTPUT_DATA_DIRECTORY "${vtkgdcm_test_data_directory_output}"
)
else()
vtk_module_build(
MODULES ${vtkgdcm_modules}
INSTALL_EXPORT GDCM
ARCHIVE_DESTINATION "${GDCM_INSTALL_LIB_DIR}"
HEADERS_DESTINATION "${GDCM_INSTALL_INCLUDE_DIR}/vtk${vtk_version_suffix}"
CMAKE_DESTINATION "${GDCM_INSTALL_PACKAGE_DIR}"
LICENSE_DESTINATION "${GDCM_INSTALL_DATA_DIR}/vtkgdcm-${GDCM_SHORT_VERSION}"
SPDX_DESTINATION "${GDCM_INSTALL_DATA_DIR}/vtkgdcm-${GDCM_SHORT_VERSION}"
HIERARCHY_DESTINATION "${GDCM_INSTALL_LIB_DIR}/vtk${vtk_version_suffix}/hierarchy/vtkgdcm"
LIBRARY_NAME_SUFFIX "${vtkgdcm_library_suffix}"
VERSION "${GDCM_VERSION}"
SOVERSION "1"
# TODO: these are probably not set as they should be
#USE_EXTERNAL "${GDCM_USE_EXTERNAL}"
#TEST_DATA_TARGET vtkgdcmData
#TEST_INPUT_DATA_DIRECTORY "${vtkgdcm_test_data_directory_input}"
#TEST_OUTPUT_DATA_DIRECTORY "${vtkgdcm_test_data_directory_output}"
)
endif()

if(VTKGDCM_WRAP_PYTHON)
find_package(PythonInterp ${VTK_PYTHON_VERSION} QUIET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool ASN1::ParseDump(const char *array, size_t length)
BIO *out=NULL;

out=BIO_new(BIO_s_file());
assert( out );
gdcm_assert( out );
BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
if (!ASN1_parse_dump(out,(const unsigned char*)array,length,indent,dump) )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Region *BoxRegion::Clone() const

bool BoxRegion::Empty() const
{
assert( 0 );
gdcm_assert( 0 );
return false;
}

Expand Down Expand Up @@ -146,14 +146,14 @@ BoxRegion BoxRegion::BoundingBox(BoxRegion const & b1, BoxRegion const & b2 )

BoxRegion::BoxRegion(const BoxRegion& b)
{
assert( b.Internals );
gdcm_assert( b.Internals );
Internals = new BoxRegionInternals;
*Internals = *b.Internals;
}

void BoxRegion::operator=(const BoxRegion& b)
{
assert( b.Internals );
gdcm_assert( b.Internals );
*Internals = *b.Internals;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ bool CAPICryptographicMessageSyntax::Decrypt(char *output, size_t &outlen, const
keyBlob.header.reserved = 0;
keyBlob.header.aiKeyAlg = GetAlgIdByObjId(cekAlg->pszObjId);
keyBlob.cbKeySize = cekLen;
assert(cekLen <= 32);
gdcm_assert(cekLen <= 32);
memcpy(keyBlob.rgbKeyData, cek, cekLen);

if (!CryptImportKey(hProv, (unsigned char*)&keyBlob, sizeof(keyBlob), 0, 0, &hCEK))
Expand Down Expand Up @@ -480,7 +480,7 @@ void CAPICryptographicMessageSyntax::ReverseBytes(unsigned char* data, DWORD len

bool CAPICryptographicMessageSyntax::LoadFile(const char * filename, unsigned char* & buffer, DWORD & bufLen)
{
assert( !buffer );
gdcm_assert( !buffer );
FILE * f = fopen(filename, "rb");
if (f == NULL)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class MemberCommand : public Command
T* m_This;
TMemberFunctionPointer m_MemberFunction;
TConstMemberFunctionPointer m_ConstMemberFunction;
MemberCommand():m_MemberFunction(nullptr),m_ConstMemberFunction(nullptr) {}
MemberCommand():m_This(nullptr),m_MemberFunction(nullptr),m_ConstMemberFunction(nullptr) {}
~MemberCommand() override= default;

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ CryptoFactory* CryptoFactory::GetFactoryInstance(CryptoLib id)
gdcmErrorMacro( "No crypto factory registered with id " << (int)id );
return nullptr;
}
assert(it->second);
gdcm_assert(it->second);
return it->second;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DataEvent : public AnyEvent
typedef AnyEvent Superclass;
DataEvent(const char *bytes = nullptr, size_t len = 0):Bytes(bytes),Length(len) {}
~DataEvent() override = default;
DataEvent(const Self&s) : AnyEvent(s){};
DataEvent(const Self&s) : AnyEvent(s), Bytes(nullptr), Length(0) {}
void operator=(const Self&) = delete;

const char * GetEventName() const override { return "DataEvent"; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ unsigned int Directory::Explore(FilenameType const &name, bool recursive)
if ('\\' == dirName[dirName.size() - 1])
dirName = dirName.substr(0, dirName.size() - 1);
if ('/' != dirName[dirName.size() - 1]) dirName.push_back('/');
assert( '/' == dirName[dirName.size()-1] );
gdcm_assert( '/' == dirName[dirName.size()-1] );
const std::wstring firstfile = dirName+L"*";
HANDLE hFile = FindFirstFileW(firstfile.c_str(), &fileData);

Expand Down Expand Up @@ -106,7 +106,7 @@ unsigned int Directory::Explore(FilenameType const &name, bool recursive)
#else
std::string fileName;
std::string dirName = name;
// assert( System::FileIsDirectory( dirName ) );
// gdcm_assert( System::FileIsDirectory( dirName ) );
Directories.push_back(dirName);
// Real POSIX implementation: scandir is a BSD extension only, and doesn't
// work on debian for example
Expand All @@ -127,7 +127,7 @@ unsigned int Directory::Explore(FilenameType const &name, bool recursive)
struct stat buf;
dirent *d;
if ('/' != dirName[dirName.size()-1]) dirName.push_back('/');
assert( '/' == dirName[dirName.size()-1] );
gdcm_assert( '/' == dirName[dirName.size()-1] );
for (d = readdir(dir); d; d = readdir(dir))
{
fileName = dirName + d->d_name;
Expand All @@ -152,7 +152,7 @@ unsigned int Directory::Explore(FilenameType const &name, bool recursive)
|| strcmp( d->d_name, ".." ) == 0
|| d->d_name[0] == '.' ) // discard any hidden dir
continue;
assert( d->d_name[0] != '.' ); // hidden directory ??
gdcm_assert( d->d_name[0] != '.' ); // hidden directory ??
if ( recursive )
{
nFiles += Explore( fileName, recursive);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public :

/// Set/Get the file names within the directory
FilenamesType const &GetFilenames() const {
assert( !(Toplevel.empty()) && "Need to call Explore first" );
gdcm_assert( !(Toplevel.empty()) && "Need to call Explore first" );
return Filenames; }

/// Return the Directories traversed
Expand Down
19 changes: 16 additions & 3 deletions Modules/ThirdParty/GDCM/src/gdcm/Source/Common/gdcmException.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
# endif
#endif

#define gdcm_forced_assert(cond) assert(cond)

namespace gdcm
{

Expand All @@ -54,9 +56,9 @@ class Exception : public std::exception
const unsigned int lineNumber,
const char* const func)
{
assert(desc != nullptr);
assert(file != nullptr);
assert(func != nullptr);
gdcm_forced_assert(desc != nullptr);
gdcm_forced_assert(file != nullptr);
gdcm_forced_assert(func != nullptr);
std::ostringstream oswhat;
oswhat << file << ":" << lineNumber << " (" << func << "):\n";
oswhat << desc;
Expand Down Expand Up @@ -98,6 +100,17 @@ class Exception : public std::exception

} // end namespace gdcm

// Always defined
#define gdcm_assert(cond) \
if (!(cond)) throw gdcm::Exception("An invalid logic behavior occurred" #cond, __FILE__ , __LINE__)

/* Asserts that should only exist in debug builds. */
#ifndef NDEBUG // checks in debug builds and elision in release builds (like assert)
#define gdcm_debug_assert(cond) gdcm_assert(cond)
#else
#define gdcm_debug_assert(cond) ((void)0)
#endif

// Undo warning suppression.
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wdeprecated")
Expand Down
15 changes: 9 additions & 6 deletions Modules/ThirdParty/GDCM/src/gdcm/Source/Common/gdcmFilename.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include <cstdlib> // realpath
#include <cstring>

#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
#include <windows.h>
#endif

namespace gdcm
{

Expand Down Expand Up @@ -48,7 +52,7 @@ const char *Filename::GetPath()
const char *Filename::GetName()
{
std::string filename = FileName;
assert( !filename.empty() );
gdcm_assert( !filename.empty() );
#if defined(_WIN32)
std::string::size_type slash_pos = filename.find_last_of("/\\");
#else
Expand All @@ -65,7 +69,7 @@ const char *Filename::GetName()
const char *Filename::ToWindowsSlashes()
{
Conversion = FileName;
//assert( !Conversion.empty() );
//gdcm_assert( !Conversion.empty() );
for (std::string::iterator it = Conversion.begin(); it != Conversion.end(); ++it )
{
if( *it == '/' )
Expand All @@ -82,13 +86,13 @@ const char *Filename::ToUnixSlashes()
{
Conversion = FileName;
//std::string::size_type s = Conversion.find("\\");
//assert( s == std::string::npos );
assert( !Conversion.empty() );
//gdcm_assert( s == std::string::npos );
gdcm_assert( !Conversion.empty() );
for (std::string::iterator it = Conversion.begin(); it != Conversion.end(); ++it )
{
if( *it == '\\' )
{
assert( it+1 == Conversion.end() || *(it+1) != ' ' ); // is it an escaped space ?
gdcm_assert( it+1 == Conversion.end() || *(it+1) != ' ' ); // is it an escaped space ?
*it = '/';
}
}
Expand All @@ -97,7 +101,6 @@ const char *Filename::ToUnixSlashes()
}

#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
#include <windows.h>

inline void Realpath(const char *path, std::string & resolved_path)
{
Expand Down
Loading
Loading