Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Necessary changes to compile in visual studio 2013 and windows 10. #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/opc/ua/protocol/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inline std::string ToHexDump(const char * buf, std::size_t size)
template <typename T> inline std::ostream & ToHexDump(std::ostream & os, const std::vector<T> & buf, std::size_t size)
{
std::stringstream lineEnd;
size = std::min(size, buf.size());
size = (std::min)(size, buf.size());
unsigned pos = 0;
os << "size: " << size << "(0x" << std::hex << size << ")";

Expand Down
2 changes: 1 addition & 1 deletion src/protocol/binary_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ void DataDeserializer::Deserialize<ByteString>(ByteString & value)
uint32_t stringSize = 0;
*this >> stringSize;

if (stringSize != ~uint32_t())
if (stringSize != ~uint32_t() && stringSize > 0)
{
value.Data.resize(stringSize);
GetData(In, reinterpret_cast<char *>(&value.Data[0]), stringSize);
Expand Down
8 changes: 6 additions & 2 deletions src/protocol/binary_variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,13 +1061,17 @@ void DataDeserializer::Deserialize<Variant>(Variant & var)
{ var = deserializer.get<DiagnosticInfo>(); }

else if (encodingMask == ((uint8_t)VariantType::DIAGNOSTIC_INFO | HAS_ARRAY_MASK))
{ var = deserializer.get<std::vector<DiagnosticInfo>>(); }
{
var = deserializer.get<DiagnosticInfoList>();
}

else if (encodingMask == ((uint8_t)VariantType::EXTENSION_OBJECT))
{ var = deserializer.get<ExtensionObject>(); }

else if (encodingMask == ((uint8_t)VariantType::EXTENSION_OBJECT | HAS_ARRAY_MASK))
{ var = deserializer.get<std::vector<ExtensionObject>>(); }
{
var = deserializer.get<std::vector<OpcUa::ExtensionObject>>();
}

else
{ throw std::logic_error("Deserialization of VariantType: " + std::to_string(encodingMask) + " is not supported yet."); }
Expand Down
8 changes: 7 additions & 1 deletion src/protocol/deserialize_auto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,20 @@ void DataDeserializer::Deserialize<XmlElement>(XmlElement & data)
*/

template<>
void DataDeserializer::Deserialize<ExtensionObject>(ExtensionObject & data)
void DataDeserializer::Deserialize<OpcUa::ExtensionObject>(OpcUa::ExtensionObject & data)
{
*this >> data.TypeId;
*this >> data.Encoding;

if ((data.Encoding) & (1 >> (0))) { *this >> data.Body; }
}

template<>
void DataDeserializer::Deserialize<std::vector<OpcUa::ExtensionObject>>(std::vector<OpcUa::ExtensionObject> & infos)
{
DeserializeContainer(*this, infos);
}


/* DISABLED

Expand Down
3 changes: 2 additions & 1 deletion src/server/tcp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
///

#ifdef _WIN32
#include <WinSock2.h>
#include <windows.h>
#endif

Expand Down Expand Up @@ -178,7 +179,7 @@ class TcpServerConnection : private Common::ThreadObserver
{
LOG_INFO(Logger, "shutting down opc ua binary server");
Stopped = true;
shutdown(Socket, SHUT_RDWR);
shutdown(Socket, SD_BOTH/*SHUT_RDWR*/);
ServerThread->Join();
ServerThread.reset();
}
Expand Down