From 8f8831f315b8f75565455416c168fc80bfac9b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 12 Jul 2015 19:04:57 +0200 Subject: Use preprocessor stringify for libksquirrel definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- ksquirrel/ksquirrel-libs-configurator/klc.ui.h | 9 +++++++-- ksquirrel/ksquirrelpart/sq_libraryhandler.cpp | 7 ++++++- ksquirrel/sq_libraryhandler.cpp | 7 ++++++- ksquirrel/sq_pluginsinfo.ui.h | 7 ++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ksquirrel/ksquirrel-libs-configurator/klc.ui.h b/ksquirrel/ksquirrel-libs-configurator/klc.ui.h index cc6f9b1..ccccad2 100644 --- a/ksquirrel/ksquirrel-libs-configurator/klc.ui.h +++ b/ksquirrel/ksquirrel-libs-configurator/klc.ui.h @@ -10,6 +10,11 @@ ** destructor. *****************************************************************************/ +#if !defined(QT_STRINGIFY) +# define QT_STRINGIFY2(x) #x +# define QT_STRINGIFY(x) QT_STRINGIFY2(x) +#endif + void KLC::init() { changed = false; @@ -25,7 +30,7 @@ void KLC::init() connect(lister, TQT_SIGNAL(deleteItem(KFileItem *)), this, TQT_SLOT(slotDeleteItem(KFileItem *))); connect(lister, TQT_SIGNAL(newItems(const KFileItemList &)), this, TQT_SLOT(slotNewItems(const KFileItemList &))); - base = KURL::fromPathOrURL(SQ_KLIBS); + base = KURL::fromPathOrURL(QT_STRINGIFY(SQ_KLIBS)); backup = base; backup.addPath("backup"); @@ -99,7 +104,7 @@ void KLC::slotNewItems(const KFileItemList &list) { KFileItemListIterator it(list); KFileItem *fi; - TQString soname = TQString::fromLatin1(".so.%1").arg(SQ_KL_VER); + TQString soname = TQString::fromLatin1(".so.%1").arg(QT_STRINGIFY(SQ_KL_VER)); while((fi = it.current())) { diff --git a/ksquirrel/ksquirrelpart/sq_libraryhandler.cpp b/ksquirrel/ksquirrelpart/sq_libraryhandler.cpp index 51d5e9b..3b6cf2c 100644 --- a/ksquirrel/ksquirrelpart/sq_libraryhandler.cpp +++ b/ksquirrel/ksquirrelpart/sq_libraryhandler.cpp @@ -41,6 +41,11 @@ #include #include +#if !defined(QT_STRINGIFY) +# define QT_STRINGIFY2(x) #x +# define QT_STRINGIFY(x) QT_STRINGIFY2(x) +#endif + static const int buffer_size = 10; SQ_LibraryHandler * SQ_LibraryHandler::m_instance = 0; @@ -513,7 +518,7 @@ void SQ_LibraryHandler::load() { TQStringList libs; - TQDir dir(SQ_KLIBS, TQString(), TQDir::Unsorted, TQDir::Files); + TQDir dir(QT_STRINGIFY(SQ_KLIBS), TQString(), TQDir::Unsorted, TQDir::Files); const TQFileInfoList *list = dir.entryInfoList(); diff --git a/ksquirrel/sq_libraryhandler.cpp b/ksquirrel/sq_libraryhandler.cpp index 51d5e9b..3b6cf2c 100644 --- a/ksquirrel/sq_libraryhandler.cpp +++ b/ksquirrel/sq_libraryhandler.cpp @@ -41,6 +41,11 @@ #include #include +#if !defined(QT_STRINGIFY) +# define QT_STRINGIFY2(x) #x +# define QT_STRINGIFY(x) QT_STRINGIFY2(x) +#endif + static const int buffer_size = 10; SQ_LibraryHandler * SQ_LibraryHandler::m_instance = 0; @@ -513,7 +518,7 @@ void SQ_LibraryHandler::load() { TQStringList libs; - TQDir dir(SQ_KLIBS, TQString(), TQDir::Unsorted, TQDir::Files); + TQDir dir(QT_STRINGIFY(SQ_KLIBS), TQString(), TQDir::Unsorted, TQDir::Files); const TQFileInfoList *list = dir.entryInfoList(); diff --git a/ksquirrel/sq_pluginsinfo.ui.h b/ksquirrel/sq_pluginsinfo.ui.h index f8e7d55..6522b62 100644 --- a/ksquirrel/sq_pluginsinfo.ui.h +++ b/ksquirrel/sq_pluginsinfo.ui.h @@ -7,6 +7,11 @@ ** place of a destructor. *****************************************************************************/ +#if !defined(QT_STRINGIFY) +# define QT_STRINGIFY2(x) #x +# define QT_STRINGIFY(x) QT_STRINGIFY2(x) +#endif + /* * SQ_PluginsInfo shows all found by SQ_LibraryListener libraries. */ @@ -23,7 +28,7 @@ void SQ_PluginsInfo::showLibs() { int cnt = SQ_LibraryHandler::instance()->count(); - textLibs->setText(SQ_KLIBS); + textLibs->setText(QT_STRINGIFY(SQ_KLIBS)); textCount->setNum(cnt); if(!cnt) return; -- cgit v1.2.3