From 45d82dc97cbd3c3a8289eb8a01d6332dba6bf419 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 18 Jul 2013 15:20:05 -0700 Subject: [PATCH] correct reference to new hostname for Qt temp variable changes --- interface/src/Application.cpp | 7 ++++--- libraries/shared/src/NodeList.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 3a8d6cff48..f9cebf41b4 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1143,10 +1143,11 @@ void Application::editPreferences() { return; } - const char* newHostname = domainServerHostname->text().toStdString().c_str(); - + char newHostname[MAX_HOSTNAME_BYTES] = {}; + memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size()); + // check if the domain server hostname is new - if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, sizeof(&newHostname)) != 0) { + if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, strlen(newHostname)) != 0) { // if so we need to clear the nodelist and delete the existing voxel and environment data Node *voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); diff --git a/libraries/shared/src/NodeList.h b/libraries/shared/src/NodeList.h index 20eaddc738..0c8a68d38c 100644 --- a/libraries/shared/src/NodeList.h +++ b/libraries/shared/src/NodeList.h @@ -32,7 +32,7 @@ const int DOMAIN_SERVER_CHECK_IN_USECS = 1 * 1000000; extern const char SOLO_NODE_TYPES[3]; -const int MAX_HOSTNAME_BYTES = 255; +const int MAX_HOSTNAME_BYTES = 256; extern const char DEFAULT_DOMAIN_HOSTNAME[MAX_HOSTNAME_BYTES]; extern const char DEFAULT_DOMAIN_IP[INET_ADDRSTRLEN]; // IP Address will be re-set by lookup on startup