# HG changeset patch # User Sebastien Jodogne # Date 1443445415 -7200 # Node ID 3727a09e7b533b4f231792d9fd84898935c68c22 # Parent 0c86b30bb8b230e613d63cfb81dd39d78b749b3d fix some icc warnings diff -r 0c86b30bb8b2 -r 3727a09e7b53 Core/Images/Font.cpp --- a/Core/Images/Font.cpp Mon Sep 28 13:49:48 2015 +0200 +++ b/Core/Images/Font.cpp Mon Sep 28 15:03:35 2015 +0200 @@ -118,7 +118,7 @@ throw OrthancException(ErrorCode_BadFont); } - c->bitmap_[j] = value; + c->bitmap_[j] = static_cast(value); } int index = boost::lexical_cast(characters[i]); @@ -166,7 +166,7 @@ unsigned int width = MyMin(character.width_, target.GetWidth() - x); unsigned int height = MyMin(character.height_, target.GetHeight() - y); - uint8_t bpp = target.GetBytesPerPixel(); + unsigned int bpp = target.GetBytesPerPixel(); // Blit the font bitmap OVER the target image // https://en.wikipedia.org/wiki/Alpha_compositing @@ -184,7 +184,8 @@ for (unsigned int cx = left; cx < width; cx++, pos++, p++) { uint16_t alpha = character.bitmap_[pos]; - *p = (alpha * static_cast(color[0]) + (255 - alpha) * static_cast(*p)) >> 8; + uint16_t value = alpha * static_cast(color[0]) + (255 - alpha) * static_cast(*p); + *p = static_cast(value >> 8); } break; @@ -196,9 +197,11 @@ for (unsigned int cx = left; cx < width; cx++, pos++, p += 3) { uint16_t alpha = character.bitmap_[pos]; - p[0] = (alpha * static_cast(color[0]) + (255 - alpha) * static_cast(p[0])) >> 8; - p[1] = (alpha * static_cast(color[1]) + (255 - alpha) * static_cast(p[1])) >> 8; - p[2] = (alpha * static_cast(color[2]) + (255 - alpha) * static_cast(p[2])) >> 8; + for (uint8_t i = 0; i < 3; i++) + { + uint16_t value = alpha * static_cast(color[i]) + (255 - alpha) * static_cast(p[i]); + p[i] = static_cast(value >> 8); + } } break; diff -r 0c86b30bb8b2 -r 3727a09e7b53 Core/Images/JpegWriter.cpp --- a/Core/Images/JpegWriter.cpp Mon Sep 28 13:49:48 2015 +0200 +++ b/Core/Images/JpegWriter.cpp Mon Sep 28 15:03:35 2015 +0200 @@ -69,7 +69,7 @@ unsigned int width, unsigned int height, PixelFormat format, - int quality) + uint8_t quality) { cinfo.image_width = width; cinfo.image_height = height; diff -r 0c86b30bb8b2 -r 3727a09e7b53 Core/Images/JpegWriter.h --- a/Core/Images/JpegWriter.h Mon Sep 28 13:49:48 2015 +0200 +++ b/Core/Images/JpegWriter.h Mon Sep 28 15:03:35 2015 +0200 @@ -42,7 +42,7 @@ class JpegWriter { private: - int quality_; + uint8_t quality_; public: JpegWriter() : quality_(90) diff -r 0c86b30bb8b2 -r 3727a09e7b53 Core/Toolbox.cpp --- a/Core/Toolbox.cpp Mon Sep 28 13:49:48 2015 +0200 +++ b/Core/Toolbox.cpp Mon Sep 28 15:03:35 2015 +0200 @@ -468,9 +468,13 @@ assert(value < 16); if (value < 10) + { return value + '0'; + } else + { return (value - 10) + 'a'; + } } @@ -508,8 +512,8 @@ result.resize(32); for (unsigned int i = 0; i < 16; i++) { - result[2 * i] = GetHexadecimalCharacter(actualHash[i] / 16); - result[2 * i + 1] = GetHexadecimalCharacter(actualHash[i] % 16); + result[2 * i] = GetHexadecimalCharacter(static_cast(actualHash[i] / 16)); + result[2 * i + 1] = GetHexadecimalCharacter(static_cast(actualHash[i] % 16)); } } #endif diff -r 0c86b30bb8b2 -r 3727a09e7b53 OrthancServer/DicomProtocol/RemoteModalityParameters.cpp --- a/OrthancServer/DicomProtocol/RemoteModalityParameters.cpp Mon Sep 28 13:49:48 2015 +0200 +++ b/OrthancServer/DicomProtocol/RemoteModalityParameters.cpp Mon Sep 28 15:03:35 2015 +0200 @@ -50,7 +50,7 @@ RemoteModalityParameters::RemoteModalityParameters(const std::string& aet, const std::string& host, - int port, + uint16_t port, ModalityManufacturer manufacturer) { SetApplicationEntityTitle(aet); @@ -60,16 +60,6 @@ } - void RemoteModalityParameters::SetPort(int port) - { - if (port <= 0 || port >= 65535) - { - throw OrthancException(ErrorCode_ParameterOutOfRange); - } - - port_ = port; - } - void RemoteModalityParameters::FromJson(const Json::Value& modality) { if (!modality.isArray() || @@ -84,13 +74,20 @@ const Json::Value& portValue = modality.get(2u, ""); try { - SetPort(portValue.asInt()); + int tmp = portValue.asInt(); + + if (tmp <= 0 || tmp >= 65535) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + + SetPort(static_cast(tmp)); } catch (std::runtime_error /* error inside JsonCpp */) { try { - SetPort(boost::lexical_cast(portValue.asString())); + SetPort(boost::lexical_cast(portValue.asString())); } catch (boost::bad_lexical_cast) { diff -r 0c86b30bb8b2 -r 3727a09e7b53 OrthancServer/DicomProtocol/RemoteModalityParameters.h --- a/OrthancServer/DicomProtocol/RemoteModalityParameters.h Mon Sep 28 13:49:48 2015 +0200 +++ b/OrthancServer/DicomProtocol/RemoteModalityParameters.h Mon Sep 28 15:03:35 2015 +0200 @@ -34,6 +34,7 @@ #include "../ServerEnumerations.h" +#include #include #include @@ -44,7 +45,7 @@ private: std::string aet_; std::string host_; - int port_; + uint16_t port_; ModalityManufacturer manufacturer_; public: @@ -52,7 +53,7 @@ RemoteModalityParameters(const std::string& aet, const std::string& host, - int port, + uint16_t port, ModalityManufacturer manufacturer); const std::string& GetApplicationEntityTitle() const @@ -75,12 +76,15 @@ host_ = host; } - int GetPort() const + uint16_t GetPort() const { return port_; } - void SetPort(int port); + void SetPort(uint16_t port) + { + port_ = port; + } ModalityManufacturer GetManufacturer() const { diff -r 0c86b30bb8b2 -r 3727a09e7b53 UnitTestsSources/FromDcmtkTests.cpp --- a/UnitTestsSources/FromDcmtkTests.cpp Mon Sep 28 13:49:48 2015 +0200 +++ b/UnitTestsSources/FromDcmtkTests.cpp Mon Sep 28 15:03:35 2015 +0200 @@ -181,7 +181,7 @@ img.SetHeight(256); img.SetFormat(PixelFormat_Grayscale16); - int v = 0; + uint16_t v = 0; for (unsigned int y = 0; y < img.GetHeight(); y++) { uint16_t *p = reinterpret_cast(img.GetAccessor().GetRow(y)); diff -r 0c86b30bb8b2 -r 3727a09e7b53 UnitTestsSources/ImageTests.cpp --- a/UnitTestsSources/ImageTests.cpp Mon Sep 28 13:49:48 2015 +0200 +++ b/UnitTestsSources/ImageTests.cpp Mon Sep 28 15:03:35 2015 +0200 @@ -50,15 +50,15 @@ TEST(PngWriter, ColorPattern) { Orthanc::PngWriter w; - int width = 17; - int height = 61; - int pitch = width * 3; + unsigned int width = 17; + unsigned int height = 61; + unsigned int pitch = width * 3; std::vector image(height * pitch); - for (int y = 0; y < height; y++) + for (unsigned int y = 0; y < height; y++) { uint8_t *p = &image[0] + y * pitch; - for (int x = 0; x < width; x++, p += 3) + for (unsigned int x = 0; x < width; x++, p += 3) { p[0] = (y % 3 == 0) ? 255 : 0; p[1] = (y % 3 == 1) ? 255 : 0; diff -r 0c86b30bb8b2 -r 3727a09e7b53 UnitTestsSources/MemoryCacheTests.cpp --- a/UnitTestsSources/MemoryCacheTests.cpp Mon Sep 28 13:49:48 2015 +0200 +++ b/UnitTestsSources/MemoryCacheTests.cpp Mon Sep 28 15:03:35 2015 +0200 @@ -190,11 +190,6 @@ LOG(INFO) << "Removing cache entry for " << value_; log_ += boost::lexical_cast(value_) + " "; } - - int GetValue() const - { - return value_; - } }; class IntegerProvider : public Orthanc::ICachePageProvider @@ -235,8 +230,6 @@ - - namespace { class S : public Orthanc::IDynamicObject @@ -253,11 +246,6 @@ { return value_; } - - static const std::string& Access(const Orthanc::IDynamicObject& obj) - { - return dynamic_cast(obj).GetValue(); - } }; }