From 2b0a516f7330e65973a3a4caea1dbd9c9b97aada Mon Sep 17 00:00:00 2001 From: sletz Date: Thu, 12 Jun 2008 13:09:59 +0000 Subject: [PATCH] Another Tim Blechmann patch to remove unnecessary virtual methods. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2512 0c269be4-1314-0410-8aa9-9f06e86f4224 --- ChangeLog | 4 +++ common/JackActivationCount.h | 3 -- common/JackClientInterface.h | 6 ++-- common/JackConnectionManager.h | 11 ------ common/JackLibGlobals.h | 2 +- common/JackPlatformChannelTransaction.h | 46 ++++++++++++++++++++++++ common/JackPort.cpp | 3 -- common/JackPort.h | 1 - common/JackRequest.h | 2 +- common/JackServer.h | 2 +- common/JackServerGlobals.h | 2 +- common/JackShmMem.h | 32 +++++++++-------- common/JackSocket.h | 8 ++--- common/JackThread.h | 6 ++-- linux/alsa/JackAlsaDriver.cpp | 2 +- macosx/JackMachClientChannel.h | 2 +- macosx/Jackdmp.xcodeproj/project.pbxproj | 6 +++- windows/JackWinNamedPipe.h | 3 +- 18 files changed, 89 insertions(+), 52 deletions(-) create mode 100644 common/JackPlatformChannelTransaction.h diff --git a/ChangeLog b/ChangeLog index 964eb61e..20268612 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,10 @@ Romain Moret Jackdmp changes log --------------------------- +2008-06-12 Stephane Letz + + * Another Tim Blechmann patch to remove unnecessary virtual methods. + 2008-06-09 Stephane Letz * Improve net driver so that jack clients can be registered even if driver has not yet started. diff --git a/common/JackActivationCount.h b/common/JackActivationCount.h index 39744189..9b48c10a 100644 --- a/common/JackActivationCount.h +++ b/common/JackActivationCount.h @@ -45,8 +45,6 @@ class JackActivationCount JackActivationCount(): fValue(0), fCount(0) {} - virtual ~JackActivationCount() - {} bool Signal(JackSynchro* synchro, JackClientControl* control); @@ -81,4 +79,3 @@ class JackActivationCount #endif - diff --git a/common/JackClientInterface.h b/common/JackClientInterface.h index 69695445..dcea6fe8 100644 --- a/common/JackClientInterface.h +++ b/common/JackClientInterface.h @@ -35,13 +35,13 @@ struct JackClientControl; class EXPORT JackClientInterface { - public: - + public: + JackClientInterface() {} virtual ~JackClientInterface() {} - + virtual int Close() = 0; virtual int ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2) = 0; diff --git a/common/JackConnectionManager.h b/common/JackConnectionManager.h index 596d0c6c..33842302 100644 --- a/common/JackConnectionManager.h +++ b/common/JackConnectionManager.h @@ -51,9 +51,6 @@ class JackFixedArray Init(); } - virtual ~JackFixedArray() - {} - void Init() { for (int i = 0; i < SIZE; i++) @@ -138,9 +135,6 @@ class JackFixedArray1 : public JackFixedArray Init(); } - virtual ~JackFixedArray1() - {} - void Init() { JackFixedArray::Init(); @@ -174,9 +168,6 @@ class JackFixedMatrix JackFixedMatrix() {} - virtual ~JackFixedMatrix() - {} - void Init(jack_int_t index) { for (int i = 0; i < SIZE; i++) { @@ -301,8 +292,6 @@ class JackLoopFeedback { Init(); } - virtual ~JackLoopFeedback() - {} void Init() { diff --git a/common/JackLibGlobals.h b/common/JackLibGlobals.h index 8ae71f81..484648f7 100644 --- a/common/JackLibGlobals.h +++ b/common/JackLibGlobals.h @@ -63,7 +63,7 @@ struct JackLibGlobals fEngineControl = -1; } - virtual ~JackLibGlobals() + ~JackLibGlobals() { jack_log("~JackLibGlobals"); for (int i = 0; i < CLIENT_NUM; i++) { diff --git a/common/JackPlatformChannelTransaction.h b/common/JackPlatformChannelTransaction.h new file mode 100644 index 00000000..24f5f978 --- /dev/null +++ b/common/JackPlatformChannelTransaction.h @@ -0,0 +1,46 @@ +/* +Copyright (C) 2004-2006 Grame + + This program 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 program 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 program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#ifndef __JackPlatformChannelTransaction__ +#define __JackPlatformChannelTransaction__ + +#ifdef WIN32 +#include "JackWinNamedPipe.h" +#else +#include "JackSocket.h" +#endif + +namespace Jack +{ + + +/*! +\brief Channel input/output communication. +*/ + +#ifdef WIN32 +typedef JackWinNamedPipe JackChannelTransaction; +#else +typedef JackClientSocket JackChannelTransaction; +#endif + +} // end of namespace + +#endif + diff --git a/common/JackPort.cpp b/common/JackPort.cpp index a845342e..84c5b211 100644 --- a/common/JackPort.cpp +++ b/common/JackPort.cpp @@ -43,9 +43,6 @@ JackPort::JackPort() fTied(NO_PORT) {} -JackPort::~JackPort() -{} - bool JackPort::Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags) { int id = GetPortTypeId(port_type); diff --git a/common/JackPort.h b/common/JackPort.h index ad37be62..e912557b 100644 --- a/common/JackPort.h +++ b/common/JackPort.h @@ -75,7 +75,6 @@ class EXPORT JackPort public: JackPort(); - virtual ~JackPort(); bool Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags); void Release(); diff --git a/common/JackRequest.h b/common/JackRequest.h index 09d13f6c..84f7df08 100644 --- a/common/JackRequest.h +++ b/common/JackRequest.h @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __JackRequest__ #include "JackConstants.h" -#include "JackChannelTransaction.h" +#include "JackPlatformChannelTransaction.h" #include #include diff --git a/common/JackServer.h b/common/JackServer.h index c0f329e0..80bed289 100644 --- a/common/JackServer.h +++ b/common/JackServer.h @@ -66,7 +66,7 @@ class EXPORT JackServer public: JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose, const char* server_name); - virtual ~JackServer(); + ~JackServer(); int Open(jack_driver_desc_t* driver_desc, JSList* driver_params); int Close(); diff --git a/common/JackServerGlobals.h b/common/JackServerGlobals.h index 41d16454..baea169b 100644 --- a/common/JackServerGlobals.h +++ b/common/JackServerGlobals.h @@ -40,7 +40,7 @@ struct JackServerGlobals static JackServer* fServer; JackServerGlobals(); - virtual ~JackServerGlobals(); + ~JackServerGlobals(); static bool Init(); static void Destroy(); diff --git a/common/JackShmMem.h b/common/JackShmMem.h index 5aeebf32..61d62918 100644 --- a/common/JackShmMem.h +++ b/common/JackShmMem.h @@ -57,6 +57,14 @@ class JackMem size_t fSize; static size_t gSize; + protected: + + JackMem(): fSize(gSize) + {} + + ~JackMem() + {} + public: void* operator new(size_t size) @@ -70,12 +78,6 @@ class JackMem free(ptr); } - JackMem(): fSize(gSize) - {} - - virtual ~JackMem() - {} - void LockMemory() { LockMemoryImp(this, fSize); @@ -100,6 +102,13 @@ class EXPORT JackShmMem protected: jack_shm_info_t fInfo; + + protected: + + JackShmMem(); + + ~JackShmMem() + {} public: @@ -108,11 +117,6 @@ class EXPORT JackShmMem void operator delete(void* p, size_t size); void operator delete(void* p); - JackShmMem(); - - virtual ~JackShmMem() - {} - int GetShmIndex() { return fInfo.index; @@ -174,7 +178,7 @@ class JackShmReadWritePtr Init(index, server_name); } - virtual ~JackShmReadWritePtr() + ~JackShmReadWritePtr() { if (fInfo.index >= 0) { jack_log("JackShmReadWritePtr::~JackShmReadWritePtr %ld", fInfo.index); @@ -260,7 +264,7 @@ class JackShmReadWritePtr1 Init(index, server_name); } - virtual ~JackShmReadWritePtr1() + ~JackShmReadWritePtr1() { if (fInfo.index >= 0) { jack_log("JackShmReadWritePtr1::~JackShmReadWritePtr1 %ld", fInfo.index); @@ -340,7 +344,7 @@ class JackShmReadPtr Init(index, server_name); } - virtual ~JackShmReadPtr() + ~JackShmReadPtr() { if (fInfo.index >= 0) { jack_log("JackShmPtrRead::~JackShmPtrRead %ld", fInfo.index); diff --git a/common/JackSocket.h b/common/JackSocket.h index 7a2b9258..78a3d673 100644 --- a/common/JackSocket.h +++ b/common/JackSocket.h @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __JackSocket__ #define __JackSocket__ -#include "JackChannelTransaction.h" - #include #include #include @@ -42,7 +40,7 @@ namespace Jack \brief Client socket. */ -class JackClientSocket : public JackChannelTransaction +class JackClientSocket { private: @@ -54,8 +52,6 @@ class JackClientSocket : public JackChannelTransaction JackClientSocket(): fSocket( -1) {} JackClientSocket(int socket); - virtual ~JackClientSocket() - {} int Connect(const char* dir, int which); int Connect(const char* dir, const char* name, int which); @@ -88,7 +84,7 @@ class JackServerSocket JackServerSocket(): fSocket( -1) {} - virtual ~JackServerSocket() + ~JackServerSocket() {} int Bind(const char* dir, int which); diff --git a/common/JackThread.h b/common/JackThread.h index 42653d87..f14c2264 100644 --- a/common/JackThread.h +++ b/common/JackThread.h @@ -42,13 +42,15 @@ namespace Jack class JackRunnableInterface { - public: - + protected: + JackRunnableInterface() {} virtual ~JackRunnableInterface() {} + public: + virtual bool Init() /*! Called once when the thread is started */ { return true; diff --git a/linux/alsa/JackAlsaDriver.cpp b/linux/alsa/JackAlsaDriver.cpp index bea93bcb..371b1098 100644 --- a/linux/alsa/JackAlsaDriver.cpp +++ b/linux/alsa/JackAlsaDriver.cpp @@ -2194,7 +2194,7 @@ int JackAlsaDriver::Detach() if (alsa_driver->midi) (alsa_driver->midi->detach)(alsa_driver->midi); - return JackDriver::Detach(); + return JackAudioDriver::Detach(); } int JackAlsaDriver::Open(jack_nframes_t nframes, diff --git a/macosx/JackMachClientChannel.h b/macosx/JackMachClientChannel.h index d52f84e1..4164fa89 100644 --- a/macosx/JackMachClientChannel.h +++ b/macosx/JackMachClientChannel.h @@ -46,7 +46,7 @@ class JackMachClientChannel : public detail::JackClientChannelInterface, public public: JackMachClientChannel(); - virtual ~JackMachClientChannel(); + ~JackMachClientChannel(); int Open(const char* server_name, const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status); void Close(); diff --git a/macosx/Jackdmp.xcodeproj/project.pbxproj b/macosx/Jackdmp.xcodeproj/project.pbxproj index 44dfdfdd..98eaa4fe 100644 --- a/macosx/Jackdmp.xcodeproj/project.pbxproj +++ b/macosx/Jackdmp.xcodeproj/project.pbxproj @@ -4589,6 +4589,7 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 4B699DD5097D427F00A18468 /* Build configuration list for PBXProject "Jackdmp" */; + compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* JackServer */; projectDirPath = ""; @@ -9854,7 +9855,10 @@ 4B363EE70DEB091C001F72D9 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = i386; + ARCHS = ( + i386, + ppc, + ); COPY_PHASE_STRIP = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_ENABLE_FIX_AND_CONTINUE = NO; diff --git a/windows/JackWinNamedPipe.h b/windows/JackWinNamedPipe.h index b839d419..576b1336 100644 --- a/windows/JackWinNamedPipe.h +++ b/windows/JackWinNamedPipe.h @@ -20,7 +20,6 @@ This program is free software; you can redistribute it and/or modify #ifndef __JackWinNamedPipe__ #define __JackWinNamedPipe__ -#include "JackChannelTransaction.h" #include #include #include @@ -28,7 +27,7 @@ This program is free software; you can redistribute it and/or modify namespace Jack { -class JackWinNamedPipe : public JackChannelTransaction +class JackWinNamedPipe { protected: