Mercurial > hg > orthanc
changeset 3840:e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 15 Apr 2020 22:17:42 +0200 |
parents | 95083d2f6819 |
children | be7df7fe3d80 |
files | Core/DicomFormat/DicomMap.cpp Core/DicomFormat/DicomMap.h Plugins/Engine/OrthancPlugins.cpp |
diffstat | 3 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/DicomFormat/DicomMap.cpp Wed Apr 15 17:58:30 2020 +0200 +++ b/Core/DicomFormat/DicomMap.cpp Wed Apr 15 22:17:42 2020 +0200 @@ -745,7 +745,7 @@ } - bool DicomMap::IsDicomFile(const char* dicom, + bool DicomMap::IsDicomFile(const void* dicom, size_t size) { /** @@ -755,16 +755,18 @@ * account to determine whether the file is or is not a DICOM file. **/ + const uint8_t* p = reinterpret_cast<const uint8_t*>(dicom); + return (size >= 132 && - dicom[128] == 'D' && - dicom[129] == 'I' && - dicom[130] == 'C' && - dicom[131] == 'M'); + p[128] == 'D' && + p[129] == 'I' && + p[130] == 'C' && + p[131] == 'M'); } bool DicomMap::ParseDicomMetaInformation(DicomMap& result, - const char* dicom, + const void* dicom, size_t size) { if (!IsDicomFile(dicom, size)) @@ -788,7 +790,7 @@ DicomTag tag(0x0000, 0x0000); // Dummy initialization ValueRepresentation vr; std::string value; - if (!ReadNextTag(tag, vr, value, dicom, size, position) || + if (!ReadNextTag(tag, vr, value, reinterpret_cast<const char*>(dicom), size, position) || tag.GetGroup() != 0x0002 || tag.GetElement() != 0x0000 || vr != ValueRepresentation_UnsignedLong || @@ -805,7 +807,7 @@ while (position < stopPosition) { - if (ReadNextTag(tag, vr, value, dicom, size, position)) + if (ReadNextTag(tag, vr, value, reinterpret_cast<const char*>(dicom), size, position)) { result.SetValue(tag, value, IsBinaryValueRepresentation(vr)); }
--- a/Core/DicomFormat/DicomMap.h Wed Apr 15 17:58:30 2020 +0200 +++ b/Core/DicomFormat/DicomMap.h Wed Apr 15 22:17:42 2020 +0200 @@ -180,11 +180,11 @@ void GetTags(std::set<DicomTag>& tags) const; - static bool IsDicomFile(const char* dicom, + static bool IsDicomFile(const void* dicom, size_t size); static bool ParseDicomMetaInformation(DicomMap& result, - const char* dicom, + const void* dicom, size_t size); void LogMissingTagsForStore() const;
--- a/Plugins/Engine/OrthancPlugins.cpp Wed Apr 15 17:58:30 2020 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Wed Apr 15 22:17:42 2020 +0200 @@ -2433,7 +2433,7 @@ return; case _OrthancPluginService_GetInstanceData: - *p.resultString = instance.GetBufferData(); + *p.resultString = reinterpret_cast<const char*>(instance.GetBufferData()); return; case _OrthancPluginService_HasInstanceMetadata: