Mercurial > hg > orthanc
diff OrthancServer/DicomProtocol/RemoteModalityParameters.cpp @ 1654:3727a09e7b53
fix some icc warnings
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 28 Sep 2015 15:03:35 +0200 |
parents | d710ea64f0fd |
children | 0001f8cd7849 |
line wrap: on
line diff
--- 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<uint16_t>(tmp)); } catch (std::runtime_error /* error inside JsonCpp */) { try { - SetPort(boost::lexical_cast<int>(portValue.asString())); + SetPort(boost::lexical_cast<uint16_t>(portValue.asString())); } catch (boost::bad_lexical_cast) {