[PC-BSD Commits] r2156 - pcbsd/trunk/libpcbsd
svn at pcbsd.org
svn at pcbsd.org
Mon Jun 23 10:25:37 PDT 2008
Author: kris
Date: 2008-06-23 10:25:36 -0700 (Mon, 23 Jun 2008)
New Revision: 2156
Modified:
pcbsd/trunk/libpcbsd/CMakeLists.txt
pcbsd/trunk/libpcbsd/netif.cpp
pcbsd/trunk/libpcbsd/netif.h
pcbsd/trunk/libpcbsd/utils.cpp
Log:
Fixed up libpcbsd to compile with cmake properly with QT4, not QT3
Modified: pcbsd/trunk/libpcbsd/CMakeLists.txt
===================================================================
--- pcbsd/trunk/libpcbsd/CMakeLists.txt 2008-06-23 16:16:50 UTC (rev 2155)
+++ pcbsd/trunk/libpcbsd/CMakeLists.txt 2008-06-23 17:25:36 UTC (rev 2156)
@@ -9,11 +9,12 @@
include(KDE4Defaults)
find_package(Qt4 REQUIRED)
+INCLUDE(${QT_USE_FILE})
-add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
+add_definitions(${QT_DEFINITIONS})
-link_directories(${KDE4_LIB_DIR})
-include_directories(${KDE4_INCLUDE_DIR} ${QT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+link_directories(${QT_LIB_DIR})
+include_directories(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set (pcbsd_SRCS
netif.cpp
@@ -22,7 +23,7 @@
add_library(pcbsd SHARED ${pcbsd_SRCS})
-target_link_libraries(pcbsd ${QT_AND_KDECORE_LIBRARIES} ${KDE4_KIO_LIBS})
+target_link_libraries(pcbsd ${QT_LIBRARIES})
### INSTALL ###
Modified: pcbsd/trunk/libpcbsd/netif.cpp
===================================================================
--- pcbsd/trunk/libpcbsd/netif.cpp 2008-06-23 16:16:50 UTC (rev 2155)
+++ pcbsd/trunk/libpcbsd/netif.cpp 2008-06-23 17:25:36 UTC (rev 2156)
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <qregexp.h>
+#include <qstring.h>
#include "netif.h"
#include "utils.h"
@@ -69,7 +70,7 @@
struct ifreq ifr;
memset(&ifr, 0, sizeof(struct ifreq));
- strncpy(ifr.ifr_name, name, IFNAMSIZ);
+ strncpy(ifr.ifr_name, name.toAscii(), IFNAMSIZ);
int s = socket(PF_INET, SOCK_DGRAM, 0);
ioctl(s, SIOCGIFADDR, &ifr);
@@ -83,7 +84,7 @@
struct ifreq ifr;
memset(&ifr, 0, sizeof(struct ifreq));
- strncpy(ifr.ifr_name, name, IFNAMSIZ);
+ strncpy(ifr.ifr_name, name.toAscii(), IFNAMSIZ);
int s = socket(PF_INET, SOCK_DGRAM, 0);
ioctl(s, SIOCGIFNETMASK, &ifr);
@@ -105,7 +106,7 @@
mib[2] = 0;
mib[3] = AF_LINK;
mib[4] = NET_RT_IFLIST;
- mib[5] = if_nametoindex(name);
+ mib[5] = if_nametoindex(name.toAscii());
//First find the size of the return, so we can adjust buf accordingly
sysctl(mib, 6, NULL, &len, NULL, 0);
@@ -118,7 +119,7 @@
QString mac;
for (uint i=0; i < 6; i++)
{
- mac += QString::number(*(ptr+i), 16).right(2).rightJustify(2, '0');
+ mac += QString::number(*(ptr+i), 16).right(2).rightJustified(2, '0');
if (i<5) mac += ":";
}
@@ -130,7 +131,7 @@
struct ifmediareq ifm;
memset(&ifm, 0, sizeof(struct ifmediareq));
- strncpy(ifm.ifm_name, name, IFNAMSIZ);
+ strncpy(ifm.ifm_name, name.toAscii(), IFNAMSIZ);
int s = socket(AF_INET, SOCK_DGRAM, 0);
ioctl(s, SIOCGIFMEDIA, &ifm);
@@ -161,7 +162,7 @@
QString NetworkInterface::devName()
{
- uint pos = name.find(QRegExp("[0-9]+$"));
+ uint pos = name.indexOf(QRegExp("[0-9]+$"));
QString result = name;
result.truncate(pos);
return result;
@@ -172,7 +173,7 @@
struct ifmediareq ifm;
memset(&ifm, 0, sizeof(struct ifmediareq));
- strncpy(ifm.ifm_name, name, IFNAMSIZ);
+ strncpy(ifm.ifm_name, name.toAscii(), IFNAMSIZ);
int s = socket(AF_INET, SOCK_DGRAM, 0);
ioctl(s, SIOCGIFMEDIA, &ifm);
@@ -185,7 +186,7 @@
struct ifreq ifr;
memset(&ifr, 0, sizeof(struct ifreq));
- strncpy(ifr.ifr_name, name, IFNAMSIZ);
+ strncpy(ifr.ifr_name, name.toAscii(), IFNAMSIZ);
int s = socket(AF_INET, SOCK_DGRAM, 0);
ioctl(s, SIOCGIFFLAGS, &ifr);
@@ -205,7 +206,7 @@
mib[2] = 0;
mib[3] = AF_LINK;
mib[4] = NET_RT_IFLIST;
- mib[5] = if_nametoindex(name);
+ mib[5] = if_nametoindex(name.toAscii());
//First find the size of the return, so we can adjust buf accordingly
sysctl(mib, 6, NULL, &len, NULL, 0);
@@ -229,7 +230,7 @@
mib[2] = 0;
mib[3] = AF_LINK;
mib[4] = NET_RT_IFLIST;
- mib[5] = if_nametoindex(name);
+ mib[5] = if_nametoindex(name.toAscii());
//First find the size of the return, so we can adjust buf accordingly
sysctl(mib, 6, NULL, &len, NULL, 0);
@@ -253,7 +254,7 @@
mib[2] = 0;
mib[3] = AF_LINK;
mib[4] = NET_RT_IFLIST;
- mib[5] = if_nametoindex(name);
+ mib[5] = if_nametoindex(name.toAscii());
//First find the size of the return, so we can adjust buf accordingly
sysctl(mib, 6, NULL, &len, NULL, 0);
@@ -277,7 +278,7 @@
mib[2] = 0;
mib[3] = AF_LINK;
mib[4] = NET_RT_IFLIST;
- mib[5] = if_nametoindex(name);
+ mib[5] = if_nametoindex(name.toAscii());
//First find the size of the return, so we can adjust buf accordingly
sysctl(mib, 6, NULL, &len, NULL, 0);
@@ -291,6 +292,6 @@
uint NetworkInterface::devNum()
{
- uint pos = name.find(QRegExp("[0-9]+$"));
+ uint pos = name.indexOf(QRegExp("[0-9]+$"));
return name.mid(pos).toInt();
}
Modified: pcbsd/trunk/libpcbsd/netif.h
===================================================================
--- pcbsd/trunk/libpcbsd/netif.h 2008-06-23 16:16:50 UTC (rev 2155)
+++ pcbsd/trunk/libpcbsd/netif.h 2008-06-23 17:25:36 UTC (rev 2156)
@@ -26,6 +26,7 @@
#define _PCBSD_NETIF_H_
#include <qstringlist.h>
+#include <qstring.h>
class NetworkInterface
{
Modified: pcbsd/trunk/libpcbsd/utils.cpp
===================================================================
--- pcbsd/trunk/libpcbsd/utils.cpp 2008-06-23 16:16:50 UTC (rev 2155)
+++ pcbsd/trunk/libpcbsd/utils.cpp 2008-06-23 17:25:36 UTC (rev 2156)
@@ -33,7 +33,7 @@
{
char result[1000];
size_t len = sizeof(result);
- sysctlbyname(sysctl.ascii(), result, &len, NULL, 0);
+ sysctlbyname(sysctl.toAscii(), result, &len, NULL, 0);
result[len] = '\0';
return QString(result);
}
@@ -42,7 +42,7 @@
{
int result = 0;
size_t len = sizeof(result);
- sysctlbyname(sysctl.ascii(), &result, &len, NULL, 0);
+ sysctlbyname(sysctl.toAscii(), &result, &len, NULL, 0);
return result;
}
More information about the Commits
mailing list