Open jleima opened 5 months ago
I fixed this by making all the float, strings. Everywhere there is something like
float mServerVersion;
std::string mServerVersion;
mServerVersion(-1.0)
mServerVersion("0")
-SpeedTest::SpeedTest(float minServerVersion) : +SpeedTest::SpeedTest(std::string minServerVersion) :
+ +bool version_ok (std::string client, std::string min_ver) {
unsigned maj = 0, min = 0, bug = 0;
unsigned maj2 = 0, min2 = 0, bug2 = 0;
sscanf(client.c_str(), "%u.%u.%u", &maj, &min, &bug);
sscanf(min_ver.c_str(), "%u.%u.%u", &maj2, &min2, &bug2);
if (maj < maj2) return false;
if (maj > maj2) return true;
if (min < min2) return false;
if (min > min2) return true;
if (bug < bug2) return false;
if (bug > bug2) return true;
return true; +}
if (client.connect() && client.version() >= mMinSupportedServer) {
if (client.connect() && (version_ok (client.version() , mMinSupportedServer))) {
if (client.version() < mMinSupportedServer) {
if (!version_ok (client.version() , mMinSupportedServer)) {
I fixed this by making all the float, strings. Everywhere there is something like
float mServerVersion;
std::string mServerVersion;
mServerVersion(-1.0)
mServerVersion("0")
-SpeedTest::SpeedTest(float minServerVersion) : +SpeedTest::SpeedTest(std::string minServerVersion) :
+ +bool version_ok (std::string client, std::string min_ver) {
unsigned maj = 0, min = 0, bug = 0;
unsigned maj2 = 0, min2 = 0, bug2 = 0;
sscanf(client.c_str(), "%u.%u.%u", &maj, &min, &bug);
sscanf(min_ver.c_str(), "%u.%u.%u", &maj2, &min2, &bug2);
if (maj < maj2) return false;
if (maj > maj2) return true;
if (min < min2) return false;
if (min > min2) return true;
if (bug < bug2) return false;
if (bug > bug2) return true;
return true; +}
if (client.connect() && client.version() >= mMinSupportedServer) {
if (client.connect() && (version_ok (client.version() , mMinSupportedServer))) {
if (client.version() < mMinSupportedServer) {
if (!version_ok (client.version() , mMinSupportedServer)) {