[med-svn] [dcmtk] 02/05: d/p/09: Fix format errors, Closes: #865418

Gert Wollny gewo at moszumanska.debian.org
Thu Sep 7 09:04:52 UTC 2017


This is an automated email from the git hooks/post-receive script.

gewo pushed a commit to branch master
in repository dcmtk.

commit a41e0fc483814de782f822f8a65e431e3db22759
Author: Gert Wollny <gewo at debian.org>
Date:   Wed Sep 6 07:40:45 2017 +0000

    d/p/09: Fix format errors, Closes: #865418
---
 debian/patches/09_fix_format_on_32bit.patch | 181 ++++++++++++++++++++++++++++
 debian/patches/series                       |   2 +-
 2 files changed, 182 insertions(+), 1 deletion(-)

diff --git a/debian/patches/09_fix_format_on_32bit.patch b/debian/patches/09_fix_format_on_32bit.patch
new file mode 100644
index 0000000..515f5d0
--- /dev/null
+++ b/debian/patches/09_fix_format_on_32bit.patch
@@ -0,0 +1,181 @@
+Description: Fix format errors on 32 bit platforms
+ For some reason upstream wants to use %lu on 32 bit platforms and 
+ the compiler complains that it expects unsigned long. Why upstream 
+ wants this is not clear, because the variable passed in is Uint32.
+Author: Gert Wollny <gewo at debian.org> 
+Debian-Bug:  https://bugs.debian.org/865418
+Last-Changed: 2017-09-06
+
+--- a/dcmdata/libsrc/dcpath.cc
++++ b/dcmdata/libsrc/dcpath.cc
+@@ -125,11 +125,7 @@
+     }
+     else if ( (vr == EVR_item) || (vr == EVR_dataset) )
+     {
+-#if SIZEOF_LONG == 8
+       sprintf(buf, "[%u]", (*it)->m_itemNo);
+-#else
+-      sprintf(buf, "[%lu]", (*it)->m_itemNo);
+-#endif
+       pathStr.append(buf);
+       it++;
+       if (it != endOfList) pathStr.append(".");
+@@ -288,11 +284,7 @@
+         result.push_back("[*]");
+       else
+       {
+-#if SIZEOF_LONG == 8
+         if (sprintf(buf, "[%u]", itemNo) < 2) return EC_IllegalParameter;
+-#else
+-        if (sprintf(buf, "[%lu]", itemNo) < 2) return EC_IllegalParameter;
+-#endif
+         result.push_back(buf);
+       }
+       nextIsItem = OFFalse;
+--- a/dcmdata/libsrc/dcvrul.cc
++++ b/dcmdata/libsrc/dcvrul.cc
+@@ -178,15 +178,10 @@
+             {
+                 /* check whether first value is printed (omit delimiter) */
+                 if (i == 0)
+-#if SIZEOF_LONG == 8
+                     sprintf(buffer, "%u", *uintVals);
+                 else
+                     sprintf(buffer, "\\%u", *uintVals);
+-#else
+-                    sprintf(buffer, "%lu", *uintVals);
+-                else
+-                    sprintf(buffer, "\\%lu", *uintVals);
+-#endif
++
+                 /* check whether current value sticks to the length limit */
+                 newLength = printedLength + OFstatic_cast(unsigned long, strlen(buffer));
+                 if ((newLength <= maxLength) && ((i + 1 == count) || (newLength + 3 <= maxLength)))
+@@ -325,11 +320,7 @@
+             /* get specified value from multi-valued string */
+             pos = DcmElement::getValueFromString(stringVal, pos, stringLen, value);
+             if (value.empty() ||
+-#if SIZEOF_LONG == 8
+                 (sscanf(value.c_str(), "%u", &field[i]) != 1)
+-#else
+-                (sscanf(value.c_str(), "%lu", &field[i]) != 1)
+-#endif
+                 )
+             {
+                 errorFlag = EC_CorruptedData;
+--- a/dcmsr/libsrc/dsrtcosp.cc
++++ b/dcmsr/libsrc/dsrtcosp.cc
+@@ -147,11 +147,7 @@
+         /* retrieve sample positions from string */
+         while (result.good() && (ptr != NULL))
+         {
+-#if SIZEOF_LONG == 8
+             if (sscanf(ptr, "%u", &value) == 1)
+-#else
+-            if (sscanf(ptr, "%lu", &value) == 1)
+-#endif
+             {
+                 addItem(value);
+                 /* jump to next time offset */
+--- a/dcmdata/libsrc/dcvrsl.cc
++++ b/dcmdata/libsrc/dcvrsl.cc
+@@ -177,17 +177,10 @@
+             for (unsigned int i = 0; i < count; i++, sintVals++)
+             {
+                 /* check whether first value is printed (omit delimiter) */
+-#if SIZEOF_LONG == 8
+                 if (i == 0)
+                     sprintf(buffer, "%d", *sintVals);
+                 else
+                     sprintf(buffer, "\\%d", *sintVals);
+-#else
+-                if (i == 0)
+-                    sprintf(buffer, "%ld", *sintVals);
+-                else
+-                    sprintf(buffer, "\\%ld", *sintVals);
+-#endif
+                 /* check whether current value sticks to the length limit */
+                 newLength = printedLength + OFstatic_cast(unsigned long, strlen(buffer));
+                 if ((newLength <= maxLength) && ((i + 1 == count) || (newLength + 3 <= maxLength)))
+@@ -326,11 +319,7 @@
+             /* get specified value from multi-valued string */
+             pos = DcmElement::getValueFromString(stringVal, pos, stringLen, value);
+             if (value.empty() ||
+-#if SIZEOF_LONG == 8
+                 (sscanf(value.c_str(), "%d", &field[i]) != 1)
+-#else
+-                (sscanf(value.c_str(), "%ld", &field[i]) != 1)
+-#endif
+                 )
+             {
+                 errorFlag = EC_CorruptedData;
+--- a/dcmsr/libsrc/dsrimgfr.cc
++++ b/dcmsr/libsrc/dsrimgfr.cc
+@@ -127,11 +127,7 @@
+     {
+         if (!tmpString.empty())
+             tmpString += '\\';
+-#if SIZEOF_LONG == 8
+         sprintf(buffer, "%d", *iterator);
+-#else
+-        sprintf(buffer, "%ld", *iterator);
+-#endif
+         tmpString += buffer;
+         iterator++;
+     }
+@@ -158,11 +154,7 @@
+         /* retrieve frame values from string */
+         while (result.good() && (ptr != NULL))
+         {
+-#if SIZEOF_LONG == 8
+             if (sscanf(ptr, "%d", &value) == 1)
+-#else
+-            if (sscanf(ptr, "%ld", &value) == 1)
+-#endif
+             {
+                 addItem(value);
+                 /* jump to next frame value */
+--- a/dcmdata/libsrc/dcvris.cc
++++ b/dcmdata/libsrc/dcvris.cc
+@@ -106,11 +106,7 @@
+     if (l_error.good())
+     {
+         /* convert string to integer value */
+-#if SIZEOF_LONG == 8
+         if (sscanf(str.c_str(), "%d", &sintVal) != 1)
+-#else
+-        if (sscanf(str.c_str(), "%ld", &sintVal) != 1)
+-#endif
+             l_error = EC_CorruptedData;
+     }
+     return l_error;
+--- a/dcmimage/libsrc/dicoimg.cc
++++ b/dcmimage/libsrc/dicoimg.cc
+@@ -574,11 +574,7 @@
+                 /* set image resolution */
+                 dataset.putAndInsertUint16(DCM_Columns, Columns);
+                 dataset.putAndInsertUint16(DCM_Rows, Rows);
+-#if SIZEOF_LONG == 8
+-                sprintf(numBuf, "%d", NumberOfFrames);
+-#else
+-                sprintf(numBuf, "%ld", NumberOfFrames);
+-#endif
++                sprintf(numBuf, "%u", NumberOfFrames);
+                 dataset.putAndInsertString(DCM_NumberOfFrames, numBuf);
+                 dataset.putAndInsertUint16(DCM_SamplesPerPixel, 3);
+                 dataset.putAndInsertUint16(DCM_PlanarConfiguration, planarConfig);
+--- a/dcmimgle/libsrc/dimoimg.cc
++++ b/dcmimgle/libsrc/dimoimg.cc
+@@ -2019,11 +2019,7 @@
+             /* set image resolution */
+             dataset.putAndInsertUint16(DCM_Columns, Columns);
+             dataset.putAndInsertUint16(DCM_Rows, Rows);
+-#if SIZEOF_LONG == 8
+-            sprintf(numBuf, "%d", NumberOfFrames);
+-#else
+-            sprintf(numBuf, "%ld", NumberOfFrames);
+-#endif
++            sprintf(numBuf, "%u", NumberOfFrames);
+             dataset.putAndInsertString(DCM_NumberOfFrames, numBuf);
+             dataset.putAndInsertUint16(DCM_SamplesPerPixel, 1);
+             /* set pixel encoding and data */
diff --git a/debian/patches/series b/debian/patches/series
index 0bed37b..fe41440 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,4 +6,4 @@
 06_soversion_abi.patch
 07_dont_export_all_executables.patch
 08_remove_system_processor.patch
-#09_round_time.patch
+09_fix_format_on_32bit.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/dcmtk.git



More information about the debian-med-commit mailing list