generic: misc cleanups

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2017-06-24 08:06:43 +00:00
parent 0a2cb537d4
commit 6908880a09
20 changed files with 42 additions and 244 deletions

View file

@ -188,8 +188,6 @@ check_function_exists(mkstemp HAVE_MKSTEMP) # kdecore/fakes.cpp
check_function_exists(mkdtemp HAVE_MKDTEMP) # kdecore/fakes.cpp
check_function_exists(strlcpy HAVE_STRLCPY) # kdecore/fakes.cpp
check_function_exists(strlcat HAVE_STRLCAT) # kdecore/fakes.cpp
check_function_exists(strcasestr HAVE_STRCASESTR) # kdecore/fakes.cpp
check_symbol_exists(strcasestr string.h HAVE_STRCASESTR_PROTO)
check_function_exists(setenv HAVE_SETENV) # kdecore/fakes.cpp
check_function_exists(seteuid HAVE_SETEUID) # kdecore/fakes.cpp
check_function_exists(setmntent HAVE_SETMNTENT) # solid, kio, kdecore

View file

@ -68,7 +68,6 @@
#cmakedefine HAVE_SETMNTENT 1
#cmakedefine HAVE_STRLCPY 1
#cmakedefine HAVE_STRLCAT 1
#cmakedefine HAVE_STRCASESTR 1
#cmakedefine HAVE_STRTOLL 1
#cmakedefine HAVE_UNSETENV 1
#cmakedefine HAVE_USLEEP 1

View file

@ -22,7 +22,7 @@
#include "AuthBackend.h"
class QByteArray;
#include <QByteArray>
namespace KAuth
{

View file

@ -24,8 +24,6 @@
#include <QtCore/qiodevice.h>
class QIODevice;
/**
* This is the base class for compression filters
* such as gzip and bzip2. It's pretty much internal.

View file

@ -21,7 +21,6 @@
#include <kdecore_export.h>
#include <QtCore/qfile.h>
class QFile;
class KFilterBase;
/**

View file

@ -423,106 +423,6 @@ KDECORE_EXPORT unsigned long strlcat(char *dst, const char *src, unsigned long s
}
#endif /* !HAVE_STRLCAT */
#ifndef HAVE_STRCASESTR
/*
* My personal strstr() implementation that beats most other algorithms.
* Until someone tells me otherwise, I assume that this is the
* fastest implementation of strstr() in C.
* I deliberately chose not to comment it. You should have at least
* as much fun trying to understand it, as I had to write it :-).
*
* Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */
#include <ctype.h>
KDECORE_EXPORT char *strcasestr (phaystack, pneedle)
const char *phaystack;
const char *pneedle;
{
register const unsigned char *haystack, *needle;
register unsigned b, c;
haystack = (const unsigned char *) phaystack;
needle = (const unsigned char *) pneedle;
b = tolower (*needle);
if (b != '\0')
{
haystack--; /* possible ANSI violation */
do
{
c = *++haystack;
if (c == '\0')
goto ret0;
}
while (tolower (c) != (int) b);
c = tolower (*++needle);
if (c == '\0')
goto foundneedle;
++needle;
goto jin;
for (;;)
{
register unsigned a;
register const unsigned char *rhaystack, *rneedle;
do
{
a = *++haystack;
if (a == '\0')
goto ret0;
if (tolower (a) == (int) b)
break;
a = *++haystack;
if (a == '\0')
goto ret0;
shloop:
;
}
while (tolower (a) != (int) b);
jin: a = *++haystack;
if (a == '\0')
goto ret0;
if (tolower (a) != (int) c)
goto shloop;
rhaystack = haystack-- + 1;
rneedle = needle;
a = tolower (*rneedle);
if (tolower (*rhaystack) == (int) a)
do
{
if (a == '\0')
goto foundneedle;
++rhaystack;
a = tolower (*++needle);
if (tolower (*rhaystack) != (int) a)
break;
if (a == '\0')
goto foundneedle;
++rhaystack;
a = tolower (*++needle);
}
while (tolower (*rhaystack) == (int) a);
needle = rneedle; /* took the register-poor approach */
if (a == '\0')
break;
}
}
foundneedle:
return (char*) haystack;
ret0:
return 0;
}
#endif /* !HAVE_STRCASESTR */
#ifndef HAVE_TRUNC
#include <math.h> /* floor */

View file

@ -429,7 +429,7 @@ bool KDirWatchPrivate::useQFSWatch(Entry* e)
kDebug(7001) << "fsWatcher->addPath" << e->path;
if (!fsWatcher) {
fsWatcher = new KFileSystemWatcher();
fsWatcher = new QFileSystemWatcher();
connect(fsWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(fswEventReceived(QString)));
connect(fsWatcher, SIGNAL(fileChanged(QString)), this, SLOT(fswEventReceived(QString)));
}

View file

@ -35,9 +35,6 @@
#include <QtCore/qobject.h>
#include <QtCore/qtimer.h>
class QFileSystemWatcher;
class QSocketNotifier;
#ifdef HAVE_FAM
#include <limits.h>
#include <fam.h>
@ -53,8 +50,6 @@ class QSocketNotifier;
#ifndef QT_NO_FILESYSTEMWATCHER
#include <QtCore/qfilesystemwatcher.h>
typedef QFileSystemWatcher KFileSystemWatcher;
#endif
/* KDirWatchPrivate is a singleton and does the watching
@ -188,7 +183,7 @@ public:
#endif
#ifndef QT_NO_FILESYSTEMWATCHER
KFileSystemWatcher *fsWatcher;
QFileSystemWatcher *fsWatcher;
bool useQFSWatch(Entry* e);
#endif

View file

@ -23,7 +23,7 @@
#include <ksharedptr.h>
#include <kglobal.h>
class QString;
#include <QString>
/**
* \class KLockFile klockfile.h <KLockFile>

View file

@ -26,9 +26,8 @@
#include <QtCore/qvariant.h>
#include <QtCore/qurl.h>
class QStringList;
class QMimeData;
#include <QtCore/qstringlist.h>
#include <QtCore/qmimedata.h>
class KUrlPrivate;

View file

@ -27,10 +27,8 @@
You should include this file in any .cpp file that uses any one of these
functions:
strlcat, strlcpy,
strcasestr,
setenv, unsetenv,
usleep, initgroups,
random, srandom (this is for KRandom itself, prefer using KRandom in any other code)
mkdtemp (this is for KTempDir itself, prefer using KTempDir everywhere else)
mkstemp, mkstemps (prefer to use QTemporaryfile instead)
trunc
@ -39,136 +37,59 @@
#cmakedefine HAVE_STRLCAT_PROTO 1
#if !defined(HAVE_STRLCAT_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
unsigned long strlcat(char*, const char*, unsigned long);
#ifdef __cplusplus
}
#endif
extern "C++" unsigned long strlcat(char*, const char*, unsigned long);
#endif
#cmakedefine HAVE_STRLCPY_PROTO 1
#if !defined(HAVE_STRLCPY_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
unsigned long strlcpy(char*, const char*, unsigned long);
#ifdef __cplusplus
}
#endif
#endif
#cmakedefine HAVE_STRCASESTR_PROTO 1
#if !defined(HAVE_STRCASESTR_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
char *strcasestr(const char *str1, const char *str2);
#ifdef __cplusplus
}
#endif
extern "C++" unsigned long strlcpy(char*, const char*, unsigned long);
#endif
#cmakedefine HAVE_SETENV_PROTO 1
#if !defined(HAVE_SETENV_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int setenv (const char *, const char *, int);
#ifdef __cplusplus
}
#endif
extern "C++" int setenv (const char *, const char *, int);
#endif
#cmakedefine HAVE_UNSETENV_PROTO 1
#if !defined(HAVE_UNSETENV_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int unsetenv (const char *);
#ifdef __cplusplus
}
#endif
extern "C++" int unsetenv (const char *);
#endif
#cmakedefine HAVE_USLEEP_PROTO 1
#if !defined(HAVE_USLEEP_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int usleep (unsigned int);
#ifdef __cplusplus
}
#endif
extern "C++" int usleep (unsigned int);
#endif
#cmakedefine HAVE_INITGROUPS_PROTO 1
#if !defined(HAVE_INITGROUPS_PROTO)
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
int initgroups(const char *, gid_t);
#ifdef __cplusplus
}
#endif
extern "C++" int initgroups(const char *, gid_t);
#endif
#cmakedefine HAVE_MKDTEMP_PROTO 1
#if !defined(HAVE_MKDTEMP_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
char *mkdtemp(char *);
#ifdef __cplusplus
}
#endif
extern "C++" char *mkdtemp(char *);
#endif
#cmakedefine HAVE_MKSTEMPS_PROTO 1
#if !defined(HAVE_MKSTEMPS_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int mkstemps(char *, int);
#ifdef __cplusplus
}
#endif
extern "C++" int mkstemps(char *, int);
#endif
#cmakedefine HAVE_MKSTEMP_PROTO 1
#if !defined(HAVE_MKSTEMP_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int mkstemp(char *);
#ifdef __cplusplus
}
#endif
extern "C++" int mkstemp(char *);
#endif
#cmakedefine HAVE_TRUNC 1
#if !defined(HAVE_TRUNC)
#ifdef __cplusplus
extern "C" {
#endif
double trunc(double);
#ifdef __cplusplus
}
#endif
extern "C++" double trunc(double);
#endif
#cmakedefine HAVE_GETGROUPLIST 1
#if !defined(HAVE_GETGROUPLIST)
#include <sys/types.h> /* for gid_t */
#ifdef __cplusplus
extern "C" {
#endif
int getgrouplist(const char *, gid_t , gid_t *, int *);
#ifdef __cplusplus
}
#endif
extern "C++" int getgrouplist(const char *, gid_t , gid_t *, int *);
#endif

View file

@ -28,8 +28,8 @@
#include <klocale.h>
#include <kglobalsettings.h>
template <class T> class QList;
class QVariant;
#include <QVariant>
class KAboutData;
/**

View file

@ -21,13 +21,10 @@
#include <klocale.h>
template <class T> class QList;
class QString;
class QStringList;
class QByteArray;
class QDataStream;
class KUrl;
#include <QStringList>
#include <QDataStream>
class KUrl;
class KCmdLineArgs;
class KCmdLineArgsPrivate;
class KCmdLineArgsStatic;

View file

@ -21,8 +21,6 @@
#include <ksharedconfig.h>
class QByteArray;
class QString;
class KAboutData;
class KStandardDirs;
class KComponentDataPrivate;

View file

@ -24,16 +24,13 @@
#include <klocalizedstring.h>
#include <ksharedconfig.h>
class QStringList;
class QTextCodec;
class QDate;
class QTime;
class QDateTime;
#include <QStringList>
#include <QTextCodec>
#include <QDateTime>
class KDateTime;
class KCalendarSystem;
class KCurrencyCode;
class KLocalePrivate;
/**

View file

@ -33,12 +33,13 @@
#include <kstandarddirs.h>
#include <kurl.h>
#include <QtCore/QFile>
#include <QtDBus/QtDBus>
#include <QtCore/QHash>
#include <QBuffer>
#include <QtCore/qfile.h>
#include <QtCore/qhash.h>
#include <QtCore/qbuffer.h>
#include <QtCore/qstack.h>
#include <QtCore/qxmlstream.h>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusReply>
extern int servicesDebugArea();

View file

@ -32,8 +32,6 @@ void KTraderParse_mainParse( const char *_code );
#include <stdlib.h>
#include <kdebug.h>
#include <QtCore/QThreadStorage>
namespace KTraderParse
{

View file

@ -23,8 +23,9 @@
#include "ksycocafactory.h"
#include <QStringList>
class QFile;
class QDataStream;
#include <QFile>
#include <QDataStream>
class KSycocaAbstractDevice;
class KSycocaPrivate

View file

@ -23,12 +23,9 @@
#include <kdecore_export.h>
#include <QtCore/qnamespace.h>
class QChar;
class QRegExp;
class QString;
class QStringList;
#include <QChar>
#include <QRegExp>
#include <QStringList>
/**
* This namespace contains utility functions for handling strings.

View file

@ -21,7 +21,13 @@
#include <kdeui_export.h>
#include <ksharedconfig.h>
#include <QtCore/QObject>
#include <QtCore/QPoint>
#include <QtCore/QRect>
#include <QtGui/QPalette>
#include <QtGui/QColor>
#include <QtGui/QFont>
#include <QtGui/QWidget>
#define KDE_DEFAULT_SINGLECLICK true
#define KDE_DEFAULT_SMOOTHSCROLL true
@ -60,12 +66,6 @@
class KUrl;
class QColor;
class QFont;
class QPoint;
class QRect;
class QWidget;
/**
* Access the KDE global configuration.
*