cleaning\ncorrections of code
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include "mainwindow.h"
|
||||
#include "tools.h"
|
||||
#include "password.h"
|
||||
#include <QTextStream>
|
||||
#include <QHostAddress>
|
||||
#include <QMimeDatabase>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -57,14 +57,12 @@ QString getFileType(QString filename)
|
||||
|
||||
QString preparePath(QString path)
|
||||
{
|
||||
return path.trimmed().replace(' ', "\ ");
|
||||
return path.trimmed().replace(' ', '\ ');
|
||||
}
|
||||
|
||||
int whatIpVersion(QString ipAddress)
|
||||
{
|
||||
QStringList fieldList;
|
||||
// ulong field;
|
||||
// uint i;
|
||||
uint ipversion;
|
||||
QHostAddress serverAddress;
|
||||
|
||||
@@ -73,40 +71,13 @@ int whatIpVersion(QString ipAddress)
|
||||
if (!serverAddress.setAddress(ipAddress))
|
||||
{
|
||||
error ("Address " + ipAddress + " is bad");
|
||||
info(DEBUGMACRO, "ERROR - not an IP address : " + ipAddress);
|
||||
return 0;
|
||||
}
|
||||
ipversion = serverAddress.protocol();
|
||||
info(DEBUGMACRO, "ip protocol version is : " + QByteArray::number(ipversion));
|
||||
|
||||
return (ipversion==IPV4?4:6);
|
||||
|
||||
|
||||
/*fieldList = ipAddress.split(":");
|
||||
if (fieldList.count() == 8)
|
||||
{
|
||||
for (i=0;i<8;i++)
|
||||
{
|
||||
field = fieldList[i].toUInt();
|
||||
if (field > 65535)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
info(DEBUGMACRO, "Address is Ip V6");
|
||||
return 6;
|
||||
}
|
||||
fieldList = ipAddress.split(".");
|
||||
if(fieldList.count() == 4)
|
||||
{
|
||||
for (i=0;i<4;i++)
|
||||
{
|
||||
field = fieldList[i].toUInt();
|
||||
if (field > 255)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
info(DEBUGMACRO, "Address is ip V4");
|
||||
return 4;
|
||||
}*/
|
||||
return (ipversion == QAbstractSocket::IPv4Protocol?4:6);
|
||||
}
|
||||
|
||||
QHostAddress searchHosts(QString server)
|
||||
|
||||
Reference in New Issue
Block a user