Mercurial > hg > orthanc
changeset 3235:6055bea6a6dc
merge
author | am@osimis.io |
---|---|
date | Fri, 15 Feb 2019 10:38:17 +0100 |
parents | 3ca924140de6 (current diff) 47fbb0467a62 (diff) |
children | 872efde28e58 |
files | |
diffstat | 9 files changed, 230 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Fri Feb 15 10:37:58 2019 +0100 +++ b/CMakeLists.txt Fri Feb 15 10:38:17 2019 +0100 @@ -338,6 +338,29 @@ ##################################################################### +## Build a static library to share code between the plugins +##################################################################### + +if (ENABLE_PLUGINS AND + (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS)) + add_library(ThirdPartyPlugins STATIC + ${BOOST_SOURCES} + ${JSONCPP_SOURCES} + ${LIBICONV_SOURCES} + ${LIBICU_SOURCES} + Plugins/Samples/Common/OrthancPluginCppWrapper.cpp + ) + + # Add the "-fPIC" option as this static library must be embedded + # inside shared libraries (important on UNIX) + set_property( + TARGET ThirdPartyPlugins + PROPERTY POSITION_INDEPENDENT_CODE ON + ) +endif() + + +##################################################################### ## Build the "ServeFolders" plugin ##################################################################### @@ -359,14 +382,12 @@ endif() add_library(ServeFolders SHARED - ${BOOST_SOURCES} - ${JSONCPP_SOURCES} - ${LIBICONV_SOURCES} Plugins/Samples/ServeFolders/Plugin.cpp - Plugins/Samples/Common/OrthancPluginCppWrapper.cpp ${SERVE_FOLDERS_RESOURCES} ) + target_link_libraries(ServeFolders ThirdPartyPlugins) + set_target_properties( ServeFolders PROPERTIES VERSION ${ORTHANC_VERSION} @@ -404,14 +425,12 @@ endif() add_library(ModalityWorklists SHARED - ${BOOST_SOURCES} - ${JSONCPP_SOURCES} - ${LIBICONV_SOURCES} - Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Plugins/Samples/ModalityWorklists/Plugin.cpp ${MODALITY_WORKLISTS_RESOURCES} ) + target_link_libraries(ModalityWorklists ThirdPartyPlugins) + set_target_properties( ModalityWorklists PROPERTIES VERSION ${ORTHANC_VERSION}
--- a/Core/DicomParsing/FromDcmtkBridge.h Fri Feb 15 10:37:58 2019 +0100 +++ b/Core/DicomParsing/FromDcmtkBridge.h Fri Feb 15 10:38:17 2019 +0100 @@ -131,6 +131,14 @@ DcmItem& dataset, Encoding defaultEncoding); + static Encoding DetectEncoding(DcmItem& dataset, + Encoding defaultEncoding) + { + // Compatibility wrapper for Orthanc <= 1.5.4 + bool hasCodeExtensions; // ignored + return DetectEncoding(hasCodeExtensions, dataset, defaultEncoding); + } + static DicomTag Convert(const DcmTag& tag); static DicomTag GetTag(const DcmElement& element);
--- a/Core/Toolbox.cpp Fri Feb 15 10:37:58 2019 +0100 +++ b/Core/Toolbox.cpp Fri Feb 15 10:38:17 2019 +0100 @@ -499,7 +499,11 @@ return "GB18030"; case Encoding_Thai: +#if BOOST_LOCALE_WITH_ICU == 1 + return "tis620.2533"; +#else return "TIS620.2533-0"; +#endif case Encoding_Korean: return "ISO-IR-149";
--- a/Resources/CMake/BoostConfiguration.cmake Fri Feb 15 10:37:58 2019 +0100 +++ b/Resources/CMake/BoostConfiguration.cmake Fri Feb 15 10:38:17 2019 +0100 @@ -228,6 +228,18 @@ if (NOT ENABLE_LOCALE) message("boost::locale is disabled") else() + set(BOOST_ICU_SOURCES + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/boundary.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/codecvt.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/collator.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/conversion.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/date_time.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/formatter.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/icu_backend.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/numeric.cpp + ${BOOST_SOURCES_DIR}/libs/locale/src/icu/time_zone.cpp + ) + list(APPEND BOOST_SOURCES ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp ${BOOST_SOURCES_DIR}/libs/locale/src/shared/generator.cpp @@ -246,6 +258,11 @@ if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR CMAKE_SYSTEM_VERSION STREQUAL "LinuxStandardBase") + add_definitions( + -DBOOST_LOCALE_NO_WINAPI_BACKEND=1 + -DBOOST_LOCALE_NO_POSIX_BACKEND=1 + ) + list(APPEND BOOST_SOURCES ${BOOST_SOURCES_DIR}/libs/locale/src/std/codecvt.cpp ${BOOST_SOURCES_DIR}/libs/locale/src/std/collate.cpp @@ -254,12 +271,15 @@ ${BOOST_SOURCES_DIR}/libs/locale/src/std/std_backend.cpp ) - add_definitions( - -DBOOST_LOCALE_WITH_ICONV=1 - -DBOOST_LOCALE_NO_WINAPI_BACKEND=1 - -DBOOST_LOCALE_NO_POSIX_BACKEND=1 - ) - + if (BOOST_LOCALE_BACKEND STREQUAL "iconv") + add_definitions(-DBOOST_LOCALE_WITH_ICONV=1) + elseif (BOOST_LOCALE_BACKEND STREQUAL "icu") + add_definitions(-DBOOST_LOCALE_WITH_ICU=1) + list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES}) + else() + message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}") + endif() + elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR @@ -268,6 +288,11 @@ CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # For WebAssembly or asm.js + add_definitions( + -DBOOST_LOCALE_NO_WINAPI_BACKEND=1 + -DBOOST_LOCALE_NO_STD_BACKEND=1 + ) + list(APPEND BOOST_SOURCES ${BOOST_SOURCES_DIR}/libs/locale/src/posix/codecvt.cpp ${BOOST_SOURCES_DIR}/libs/locale/src/posix/collate.cpp @@ -276,13 +301,24 @@ ${BOOST_SOURCES_DIR}/libs/locale/src/posix/posix_backend.cpp ) + if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR + BOOST_LOCALE_BACKEND STREQUAL "iconv") + # In WebAssembly or asm.js, we rely on the version of iconv + # that is shipped with the stdlib + add_definitions(-DBOOST_LOCALE_WITH_ICONV=1) + elseif (BOOST_LOCALE_BACKEND STREQUAL "icu") + add_definitions(-DBOOST_LOCALE_WITH_ICU=1) + list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES}) + else() + message(FATAL_ERROR "Unsupported value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}") + endif() + + elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") add_definitions( - -DBOOST_LOCALE_WITH_ICONV=1 - -DBOOST_LOCALE_NO_WINAPI_BACKEND=1 + -DBOOST_LOCALE_NO_POSIX_BACKEND=1 -DBOOST_LOCALE_NO_STD_BACKEND=1 ) - - elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") + list(APPEND BOOST_SOURCES ${BOOST_SOURCES_DIR}/libs/locale/src/win32/collate.cpp ${BOOST_SOURCES_DIR}/libs/locale/src/win32/converter.cpp @@ -291,19 +327,19 @@ ${BOOST_SOURCES_DIR}/libs/locale/src/win32/win_backend.cpp ) - add_definitions( - -DBOOST_LOCALE_NO_POSIX_BACKEND=1 - -DBOOST_LOCALE_NO_STD_BACKEND=1 - ) - # Starting with release 0.8.2, Orthanc statically links against # libiconv, even on Windows. Indeed, the "WCONV" library of # Windows XP seems not to support properly several codepages # (notably "Latin3", "Hebrew", and "Arabic"). Set - # "USE_BOOST_ICONV" to "OFF" to use WCONV anyway. + # "BOOST_LOCALE_BACKEND" to "wconv" to use WCONV anyway. - if (USE_BOOST_ICONV) + if (BOOST_LOCALE_BACKEND STREQUAL "iconv") add_definitions(-DBOOST_LOCALE_WITH_ICONV=1) + elseif (BOOST_LOCALE_BACKEND STREQUAL "icu") + add_definitions(-DBOOST_LOCALE_WITH_ICU=1) + list(APPEND BOOST_SOURCES ${BOOST_ICU_SOURCES}) + elseif (BOOST_LOCALE_BACKEND STREQUAL "wconv") + message("Using Window's wconv") else() add_definitions(-DBOOST_LOCALE_WITH_WCONV=1) endif()
--- a/Resources/CMake/LibIconvConfiguration.cmake Fri Feb 15 10:37:58 2019 +0100 +++ b/Resources/CMake/LibIconvConfiguration.cmake Fri Feb 15 10:38:17 2019 +0100 @@ -1,98 +1,89 @@ -if (NOT ENABLE_LOCALE) - message("Support for locales is disabled") - -elseif (NOT USE_BOOST_ICONV) - message("Not using libiconv") +message("Using libiconv") -else() - message("Using libiconv") +if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICONV) + set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.15) + set(LIBICONV_URL "http://orthanc.osimis.io/ThirdPartyDownloads/libiconv-1.15.tar.gz") + set(LIBICONV_MD5 "ace8b5f2db42f7b3b3057585e80d9808") - if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICONV) - set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.15) - set(LIBICONV_URL "http://orthanc.osimis.io/ThirdPartyDownloads/libiconv-1.15.tar.gz") - set(LIBICONV_MD5 "ace8b5f2db42f7b3b3057585e80d9808") - - DownloadPackage(${LIBICONV_MD5} ${LIBICONV_URL} "${LIBICONV_SOURCES_DIR}") + DownloadPackage(${LIBICONV_MD5} ${LIBICONV_URL} "${LIBICONV_SOURCES_DIR}") - # Disable the support of libiconv that is shipped by default with - # the C standard library on Linux. Setting this macro redirects - # calls from "iconv*()" to "libiconv*()" by defining macros in the - # C headers of "libiconv-1.15". - add_definitions(-DLIBICONV_PLUG=1) + # Disable the support of libiconv that is shipped by default with + # the C standard library on Linux. Setting this macro redirects + # calls from "iconv*()" to "libiconv*()" by defining macros in the + # C headers of "libiconv-1.15". + add_definitions(-DLIBICONV_PLUG=1) - # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ - add_definitions( - -DBUILDING_LIBICONV=1 - -DIN_LIBRARY=1 - -DLIBDIR="" - -DICONV_CONST= - ) + # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ + add_definitions( + -DBUILDING_LIBICONV=1 + -DIN_LIBRARY=1 + -DLIBDIR="" + -DICONV_CONST= + ) - configure_file( - ${LIBICONV_SOURCES_DIR}/srclib/localcharset.h - ${LIBICONV_SOURCES_DIR}/include - COPYONLY) + configure_file( + ${LIBICONV_SOURCES_DIR}/srclib/localcharset.h + ${LIBICONV_SOURCES_DIR}/include + COPYONLY) - set(HAVE_VISIBILITY 0) - set(ICONV_CONST ${ICONV_CONST}) - set(USE_MBSTATE_T 1) - set(BROKEN_WCHAR_H 0) - set(EILSEQ) - set(HAVE_WCHAR_T 1) - configure_file( - ${LIBICONV_SOURCES_DIR}/include/iconv.h.build.in - ${LIBICONV_SOURCES_DIR}/include/iconv.h - ) - unset(HAVE_VISIBILITY) - unset(ICONV_CONST) - unset(USE_MBSTATE_T) - unset(BROKEN_WCHAR_H) - unset(EILSEQ) - unset(HAVE_WCHAR_T) + set(HAVE_VISIBILITY 0) + set(ICONV_CONST ${ICONV_CONST}) + set(USE_MBSTATE_T 1) + set(BROKEN_WCHAR_H 0) + set(EILSEQ) + set(HAVE_WCHAR_T 1) + configure_file( + ${LIBICONV_SOURCES_DIR}/include/iconv.h.build.in + ${LIBICONV_SOURCES_DIR}/include/iconv.h + ) + unset(HAVE_VISIBILITY) + unset(ICONV_CONST) + unset(USE_MBSTATE_T) + unset(BROKEN_WCHAR_H) + unset(EILSEQ) + unset(HAVE_WCHAR_T) - if (NOT EXISTS ${LIBICONV_SOURCES_DIR}/include/config.h) - # Create an empty "config.h" for libiconv - file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "") - endif() + if (NOT EXISTS ${LIBICONV_SOURCES_DIR}/include/config.h) + # Create an empty "config.h" for libiconv + file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "") + endif() - include_directories( - ${LIBICONV_SOURCES_DIR}/include - ) + include_directories( + ${LIBICONV_SOURCES_DIR}/include + ) - set(LIBICONV_SOURCES - ${LIBICONV_SOURCES_DIR}/lib/iconv.c - ${LIBICONV_SOURCES_DIR}/lib/relocatable.c - ${LIBICONV_SOURCES_DIR}/libcharset/lib/localcharset.c - ${LIBICONV_SOURCES_DIR}/libcharset/lib/relocatable.c - ) + set(LIBICONV_SOURCES + ${LIBICONV_SOURCES_DIR}/lib/iconv.c + ${LIBICONV_SOURCES_DIR}/lib/relocatable.c + ${LIBICONV_SOURCES_DIR}/libcharset/lib/localcharset.c + ${LIBICONV_SOURCES_DIR}/libcharset/lib/relocatable.c + ) - source_group(ThirdParty\\libiconv REGULAR_EXPRESSION ${LIBICONV_SOURCES_DIR}/.*) + source_group(ThirdParty\\libiconv REGULAR_EXPRESSION ${LIBICONV_SOURCES_DIR}/.*) - if (CMAKE_SYSTEM_NAME STREQUAL "Windows") - add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0) - else() - add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1) - endif() + if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0) + else() + add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1) + endif() - else() - CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV_H) - if (NOT HAVE_ICONV_H) - message(FATAL_ERROR "Please install the libiconv-dev package") - endif() +else() + CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV_H) + if (NOT HAVE_ICONV_H) + message(FATAL_ERROR "Please install the libiconv-dev package") + endif() - # Check whether the support for libiconv is bundled within the - # standard C library - CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV_LIB) - if (NOT HAVE_ICONV_LIB) - # No builtin support for libiconv, try and find an external library. - # Open question: Does this make sense on any platform? - CHECK_LIBRARY_EXISTS(iconv iconv_open "" HAVE_ICONV_LIB_2) - if (NOT HAVE_ICONV_LIB_2) - message(FATAL_ERROR "Please install the libiconv-dev package") - else() - link_libraries(iconv) - endif() + # Check whether the support for libiconv is bundled within the + # standard C library + CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV_LIB) + if (NOT HAVE_ICONV_LIB) + # No builtin support for libiconv, try and find an external library. + # Open question: Does this make sense on any platform? + CHECK_LIBRARY_EXISTS(iconv iconv_open "" HAVE_ICONV_LIB_2) + if (NOT HAVE_ICONV_LIB_2) + message(FATAL_ERROR "Please install the libiconv-dev package") + else() + link_libraries(iconv) endif() - endif() endif()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CMake/LibIcuConfiguration.cmake Fri Feb 15 10:38:17 2019 +0100 @@ -0,0 +1,37 @@ + +# http://userguide.icu-project.org/packaging +# http://userguide.icu-project.org/howtouseicu + +message("Using libicu") + +if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICU) + set(LIBICU_SOURCES_DIR ${CMAKE_BINARY_DIR}/icu) + set(LIBICU_URL "http://orthanc.osimis.io/ThirdPartyDownloads/icu4c-63_1-src.tgz") + set(LIBICU_MD5 "9e40f6055294284df958200e308bce50") + + DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}") + + + # TODO + add_definitions( + -DU_STATIC_IMPLEMENTATION + #-DU_COMBINED_IMPLEMENTATION + ) + + +else() + CHECK_INCLUDE_FILE_CXX(unicode/uvernum.h HAVE_ICU_H) + if (NOT HAVE_ICU_H) + message(FATAL_ERROR "Please install the libicu-dev package") + endif() + + find_library(LIBICU_PATH_1 NAMES icuuc) + find_library(LIBICU_PATH_2 NAMES icui18n) + + if (NOT LIBICU_PATH_1 OR + NOT LIBICU_PATH_2) + message(FATAL_ERROR "Please install the libicu-dev package") + else() + link_libraries(icuuc icui18n) + endif() +endif()
--- a/Resources/CMake/OrthancFrameworkConfiguration.cmake Fri Feb 15 10:37:58 2019 +0100 +++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake Fri Feb 15 10:38:17 2019 +0100 @@ -94,7 +94,7 @@ endif() if (NOT ENABLE_LOCALE) - unset(USE_SYSTEM_LIBICONV CACHE) + unset(BOOST_LOCALE_BACKEND CACHE) add_definitions(-DORTHANC_ENABLE_LOCALE=0) endif() @@ -378,16 +378,24 @@ ## -## Locale support: libiconv +## Locale support ## if (ENABLE_LOCALE) if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # In WebAssembly or asm.js, we rely on the version of iconv that # is shipped with the stdlib - unset(USE_BOOST_ICONV CACHE) + unset(BOOST_LOCALE_BACKEND CACHE) else() - include(${CMAKE_CURRENT_LIST_DIR}/LibIconvConfiguration.cmake) + if (BOOST_LOCALE_BACKEND STREQUAL "iconv") + include(${CMAKE_CURRENT_LIST_DIR}/LibIconvConfiguration.cmake) + elseif (BOOST_LOCALE_BACKEND STREQUAL "icu") + include(${CMAKE_CURRENT_LIST_DIR}/LibIcuConfiguration.cmake) + elseif (BOOST_LOCALE_BACKEND STREQUAL "wconv") + message("Using Microsoft Window's wconv") + else() + message(FATAL_ERROR "Invalid value for BOOST_LOCALE_BACKEND: ${BOOST_LOCALE_BACKEND}") + endif() endif() add_definitions(-DORTHANC_ENABLE_LOCALE=1) @@ -610,6 +618,7 @@ ${CURL_SOURCES} ${JSONCPP_SOURCES} ${LIBICONV_SOURCES} + ${LIBICU_SOURCES} ${LIBJPEG_SOURCES} ${LIBP11_SOURCES} ${LIBPNG_SOURCES}
--- a/Resources/CMake/OrthancFrameworkParameters.cmake Fri Feb 15 10:37:58 2019 +0100 +++ b/Resources/CMake/OrthancFrameworkParameters.cmake Fri Feb 15 10:38:17 2019 +0100 @@ -43,6 +43,7 @@ set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") set(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp") set(USE_SYSTEM_LIBICONV ON CACHE BOOL "Use the system version of libiconv") +set(USE_SYSTEM_LIBICU ON CACHE BOOL "Use the system version of libicu") set(USE_SYSTEM_LIBJPEG ON CACHE BOOL "Use the system version of libjpeg") set(USE_SYSTEM_LIBP11 OFF CACHE BOOL "Use the system version of libp11 (PKCS#11 wrapper library)") set(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of libpng") @@ -66,13 +67,13 @@ # Advanced and distribution-specific parameters set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)") set(SYSTEM_MONGOOSE_USE_CALLBACKS ON CACHE BOOL "The system version of Mongoose uses callbacks (version >= 3.7)") -set(USE_BOOST_ICONV ON CACHE BOOL "Use iconv instead of wconv (Windows only)") +set(BOOST_LOCALE_BACKEND "iconv" CACHE STRING "Back-end for locales that is used by Boost (can be \"iconv\", \"icu\", or \"wconv\" on Windows)") set(USE_PUGIXML ON CACHE BOOL "Use the Pugixml parser (turn off only for debug)") set(USE_LEGACY_JSONCPP OFF CACHE BOOL "Use the old branch 0.x.y of JsonCpp, that does not require a C++11 compiler (for old versions of Visual Studio)") mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE) mark_as_advanced(SYSTEM_MONGOOSE_USE_CALLBACKS) -mark_as_advanced(USE_BOOST_ICONV) +mark_as_advanced(BOOST_LOCALE_BACKEND) mark_as_advanced(USE_PUGIXML) mark_as_advanced(USE_LEGACY_JSONCPP)
--- a/UnitTestsSources/FromDcmtkTests.cpp Fri Feb 15 10:37:58 2019 +0100 +++ b/UnitTestsSources/FromDcmtkTests.cpp Fri Feb 15 10:38:17 2019 +0100 @@ -1507,7 +1507,8 @@ int a = boost::lexical_cast<int>(components[0]); int b = boost::lexical_cast<int>(components[1]); if (a < 0 || a > 15 || - b < 0 || b > 15) + b < 0 || b > 15 || + (a == 0 && b == 0)) { throw; } @@ -1543,7 +1544,7 @@ ParsedDicomFile dicom(false); dicom.ReplacePlainString(DICOM_TAG_SPECIFIC_CHARACTER_SET, "\\ISO 2022 IR 149"); ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString - (DCM_PatientName, korean.c_str(), korean.size(), true).good()); + (DCM_PatientName, korean.c_str(), OFBool(true)).good()); bool hasCodeExtensions; Encoding encoding = dicom.DetectEncoding(hasCodeExtensions); @@ -1624,7 +1625,7 @@ ParsedDicomFile dicom(false); dicom.ReplacePlainString(DICOM_TAG_SPECIFIC_CHARACTER_SET, "\\ISO 2022 IR 87"); ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString - (DCM_PatientName, japanese.c_str(), japanese.size(), true).good()); + (DCM_PatientName, japanese.c_str(), OFBool(true)).good()); bool hasCodeExtensions; Encoding encoding = dicom.DetectEncoding(hasCodeExtensions); @@ -1686,13 +1687,13 @@ static const uint8_t chinese[] = { 0x57, 0x61, 0x6e, 0x67, 0x5e, 0x58, 0x69, 0x61, 0x6f, 0x44, 0x6f, - 0x6e, 0x67, 0x3d, 0xcd, 0xf5, 0x5e, 0xd0, 0xa1, 0xb6, 0xab, 0x3d + 0x6e, 0x67, 0x3d, 0xcd, 0xf5, 0x5e, 0xd0, 0xa1, 0xb6, 0xab, 0x3d, 0x00 }; ParsedDicomFile dicom(false); dicom.ReplacePlainString(DICOM_TAG_SPECIFIC_CHARACTER_SET, "GB18030"); ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString - (DCM_PatientName, reinterpret_cast<const char*>(chinese), sizeof(chinese), true).good()); + (DCM_PatientName, reinterpret_cast<const char*>(chinese), OFBool(true)).good()); bool hasCodeExtensions; Encoding encoding = dicom.DetectEncoding(hasCodeExtensions); @@ -1742,7 +1743,7 @@ 0x64, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x73, 0xd6, 0xd0, 0xce, 0xc4, 0x2c, 0x20, 0x74, 0x6f, 0x6f, 0x2e, 0x0d, 0x0a, 0x54, 0x68, 0x65, 0x20, 0x74, 0x68, 0x69, 0x72, 0x64, 0x20, 0x6c, 0x69, - 0x6e, 0x65, 0x2e, 0x0d, 0x0a + 0x6e, 0x65, 0x2e, 0x0d, 0x0a, 0x00 }; static const uint8_t patternRaw[] = { @@ -1754,7 +1755,7 @@ ParsedDicomFile dicom(false); dicom.ReplacePlainString(DICOM_TAG_SPECIFIC_CHARACTER_SET, "GB18030"); ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString - (DCM_PatientComments, reinterpret_cast<const char*>(chinese), sizeof(chinese), true).good()); + (DCM_PatientComments, reinterpret_cast<const char*>(chinese), OFBool(true)).good()); bool hasCodeExtensions; Encoding encoding = dicom.DetectEncoding(hasCodeExtensions); @@ -1786,7 +1787,7 @@ static const uint8_t chinese[] = { 0x5a, 0x68, 0x61, 0x6e, 0x67, 0x5e, 0x58, 0x69, 0x61, 0x6f, 0x44, 0x6f, 0x6e, 0x67, 0x3d, 0x1b, 0x24, 0x29, 0x41, 0xd5, 0xc5, 0x5e, 0x1b, 0x24, - 0x29, 0x41, 0xd0, 0xa1, 0xb6, 0xab, 0x3d, 0x20 + 0x29, 0x41, 0xd0, 0xa1, 0xb6, 0xab, 0x3d, 0x20, 0x00 }; // echo -n "Zhang^XiaoDong=..." | hexdump -v -e '14/1 "0x%02x, "' -e '"\n"' @@ -1798,7 +1799,7 @@ ParsedDicomFile dicom(false); dicom.ReplacePlainString(DICOM_TAG_SPECIFIC_CHARACTER_SET, "\\ISO 2022 IR 58"); ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString - (DCM_PatientName, reinterpret_cast<const char*>(chinese), sizeof(chinese), true).good()); + (DCM_PatientName, reinterpret_cast<const char*>(chinese), OFBool(true)).good()); bool hasCodeExtensions; Encoding encoding = dicom.DetectEncoding(hasCodeExtensions); @@ -1818,7 +1819,7 @@ static const uint8_t chinese[] = { 0x31, 0x2e, 0x1b, 0x24, 0x29, 0x41, 0xb5, 0xda, 0xd2, 0xbb, 0xd0, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xa1, 0xa3, 0x0d, 0x0a, 0x32, 0x2e, 0x1b, 0x24, 0x29, 0x41, 0xb5, 0xda, 0xb6, 0xfe, 0xd0, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xa1, 0xa3, 0x0d, 0x0a, - 0x33, 0x2e, 0x1b, 0x24, 0x29, 0x41, 0xb5, 0xda, 0xc8, 0xfd, 0xd0, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xa1, 0xa3, 0x0d, 0x0a + 0x33, 0x2e, 0x1b, 0x24, 0x29, 0x41, 0xb5, 0xda, 0xc8, 0xfd, 0xd0, 0xd0, 0xce, 0xc4, 0xd7, 0xd6, 0xa1, 0xa3, 0x0d, 0x0a, 0x00 }; static const uint8_t line1[] = { @@ -1839,7 +1840,7 @@ ParsedDicomFile dicom(false); dicom.ReplacePlainString(DICOM_TAG_SPECIFIC_CHARACTER_SET, "\\ISO 2022 IR 58"); ASSERT_TRUE(dicom.GetDcmtkObject().getDataset()->putAndInsertString - (DCM_PatientName, reinterpret_cast<const char*>(chinese), sizeof(chinese), true).good()); + (DCM_PatientName, reinterpret_cast<const char*>(chinese), OFBool(true)).good()); bool hasCodeExtensions; Encoding encoding = dicom.DetectEncoding(hasCodeExtensions);