Clang Warning patch

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
chaircrusher
Posts: 32
Joined: Tue, 2011-12-20, 23:24
Location: iowa city,ia

Clang Warning patch

#1 Post by chaircrusher »

CLang also warns about use of deprecated library functions all over the place, and I can post those warnings if anyone cares. But this is a patch for a couple of other warnings:

Code: Select all

From 70c8f8516f712fd7f4483edf0a6d26cb8af80c8b Mon Sep 17 00:00:00 2001
From: Kent Williams <norman-k-williams@uiowa.edu>
Date: Fri, 27 Jan 2012 11:15:31 -0600
Subject: [PATCH] Fix CLANG Warnings

---
 dcmdata/libsrc/dcvrobow.cc |    2 +-
 dcmwlm/wwwapps/writwlst.cc |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dcmdata/libsrc/dcvrobow.cc b/dcmdata/libsrc/dcvrobow.cc
index 0c1d16a..b3f43f4 100644
--- a/dcmdata/libsrc/dcvrobow.cc
+++ b/dcmdata/libsrc/dcvrobow.cc
@@ -516,7 +516,7 @@ OFCondition DcmOtherByteOtherWord::getOFString(OFString &stringVal,
         {
             /* ... and convert it to a character string (hex mode) */
             char buffer[32];
-            sprintf(buffer, "%2.2hx", uint8Val);
+            sprintf(buffer, "%2.2hx", static_cast<unsigned short>(uint8Val));
             /* assign result */
             stringVal = buffer;
         }
diff --git a/dcmwlm/wwwapps/writwlst.cc b/dcmwlm/wwwapps/writwlst.cc
index 581b033..880f4d9 100644
--- a/dcmwlm/wwwapps/writwlst.cc
+++ b/dcmwlm/wwwapps/writwlst.cc
@@ -81,7 +81,9 @@ usage()
 
 #define SimpleStr_defaultSize 32
 
+#ifndef MAX(a,b)
 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
 
 class SimpleStr {
 private:
-- 
1.7.6.1

J. Riesmeier
DCMTK Developer
Posts: 2506
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#2 Post by J. Riesmeier »

Thank you for the report and suggested patch. We've just committed the required changes. See our public git repository for details.
CLang also warns about use of deprecated library functions all over the place, and I can post those warnings if anyone cares.
You could send the log file with the messages by email to dicom/at/offis/dot/de if you like. We will then see what we can do ...

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest