From b5ee65cbb683bdb90f70dc75ca0ec0c9da8e5466 Mon Sep 17 00:00:00 2001 From: Justin Karneges Date: Wed, 17 Sep 2003 01:02:09 +0000 Subject: [PATCH] license info / plugin version define svn path=/trunk/kdesupport/qca/; revision=251711 --- plugins/qca-tls/qca-tls.cpp | 2 +- src/qca.cpp | 43 +++++++++++++++++++++++++++++++++---- src/qca.h | 20 +++++++++++++++++ src/qcaprovider.h | 22 +++++++++++++++++++ 4 files changed, 82 insertions(+), 5 deletions(-) diff --git a/plugins/qca-tls/qca-tls.cpp b/plugins/qca-tls/qca-tls.cpp index 4740a6ec..d22a9e9a 100644 --- a/plugins/qca-tls/qca-tls.cpp +++ b/plugins/qca-tls/qca-tls.cpp @@ -1365,7 +1365,7 @@ public: int qcaVersion() const { - return 1; + return QCA_PLUGIN_VERSION; } int capabilities() const diff --git a/src/qca.cpp b/src/qca.cpp index d9982aa2..4cb38e76 100644 --- a/src/qca.cpp +++ b/src/qca.cpp @@ -1,3 +1,23 @@ +/* + * qca.cpp - Qt Cryptographic Architecture + * Copyright (C) 2003 Justin Karneges + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include"qca.h" #include @@ -18,14 +38,13 @@ #define PLUGIN_EXT "so" #endif -#define QCA_PLUGIN_VERSION 1 - using namespace QCA; class ProviderItem { public: QCAProvider *p; + QString fname; static ProviderItem *load(const QString &fname) { @@ -46,6 +65,7 @@ public: return 0; } ProviderItem *i = new ProviderItem(lib, p); + i->fname = fname; return i; } @@ -84,6 +104,16 @@ private: static QPtrList providerList; static bool qca_init = false; +static bool plugin_have(const QString &fname) +{ + QPtrListIterator it(providerList); + for(ProviderItem *i; (i = it.current()); ++it) { + if(i->fname == fname) + return true; + } + return false; +} + static void plugin_scan() { QStringList dirs = QApplication::libraryPaths(); @@ -100,9 +130,14 @@ static void plugin_scan() continue; if(fi.extension() != PLUGIN_EXT) continue; - //printf("f=[%s]\n", fi.filePath().latin1()); + QString fname = fi.filePath(); - ProviderItem *i = ProviderItem::load(fi.filePath()); + // don't load the same plugin again! + if(plugin_have(fname)) + continue; + //printf("f=[%s]\n", fname.latin1()); + + ProviderItem *i = ProviderItem::load(fname); if(!i) continue; if(i->p->qcaVersion() != QCA_PLUGIN_VERSION) { diff --git a/src/qca.h b/src/qca.h index 848bc08f..4ac97a70 100644 --- a/src/qca.h +++ b/src/qca.h @@ -1,3 +1,23 @@ +/* + * qca.h - Qt Cryptographic Architecture + * Copyright (C) 2003 Justin Karneges + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #ifndef QCA_H #define QCA_H diff --git a/src/qcaprovider.h b/src/qcaprovider.h index 789964c3..8be9dff9 100644 --- a/src/qcaprovider.h +++ b/src/qcaprovider.h @@ -1,3 +1,23 @@ +/* + * qcaprovider.h - QCA Plugin API + * Copyright (C) 2003 Justin Karneges + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #ifndef QCAPROVIDER_H #define QCAPROVIDER_H @@ -8,6 +28,8 @@ #include #include"qca.h" +#define QCA_PLUGIN_VERSION 1 + #ifdef Q_WS_WIN #define QCA_EXPORT extern "C" __declspec(dllexport) #else