Browse Source

Cleanup JackInternalClient.h,cpp files

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2553 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 17 years ago
parent
commit
2d24e3a1c2
2 changed files with 45 additions and 39 deletions
  1. +45
    -0
      common/JackInternalClient.cpp
  2. +0
    -39
      common/JackInternalClient.h

+ 45
- 0
common/JackInternalClient.cpp View File

@@ -45,6 +45,51 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
namespace Jack namespace Jack
{ {


#ifdef WIN32

static void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
{
snprintf(path_to_so, path_len, ADDON_DIR "/%s.dll", so_name);
}

static void PrintLoadError(const char* so_name)
{
// Retrieve the system error message for the last-error code
LPVOID lpMsgBuf;
LPVOID lpDisplayBuf;
DWORD dw = GetLastError();

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );

// Display the error message and exit the process
lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
(lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)so_name) + 40) * sizeof(TCHAR));
_snprintf((LPTSTR)lpDisplayBuf, LocalSize(lpDisplayBuf) / sizeof(TCHAR),
TEXT("error loading %s err = %s"), so_name, lpMsgBuf);
jack_error((LPCTSTR)lpDisplayBuf);

LocalFree(lpMsgBuf);
LocalFree(lpDisplayBuf);
}

#else

static void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
{
snprintf(path_to_so, path_len, ADDON_DIR "/%s.so", so_name);
}

#endif

JackGraphManager* JackInternalClient::fGraphManager = NULL; JackGraphManager* JackInternalClient::fGraphManager = NULL;
JackEngineControl* JackInternalClient::fEngineControl = NULL; JackEngineControl* JackInternalClient::fEngineControl = NULL;




+ 0
- 39
common/JackInternalClient.h View File

@@ -67,40 +67,6 @@ class JackInternalClient : public JackClient
#define UnloadJackModule(handle) FreeLibrary((handle)); #define UnloadJackModule(handle) FreeLibrary((handle));
#define GetJackProc(handle, name) GetProcAddress((handle), (name)); #define GetJackProc(handle, name) GetProcAddress((handle), (name));


static void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
{
snprintf(path_to_so, path_len, ADDON_DIR "/%s.dll", so_name);
}

static void PrintLoadError(const char* so_name)
{
// Retrieve the system error message for the last-error code
LPVOID lpMsgBuf;
LPVOID lpDisplayBuf;
DWORD dw = GetLastError();

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );

// Display the error message and exit the process
lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
(lstrlen((LPCTSTR)lpMsgBuf) + lstrlen((LPCTSTR)so_name) + 40) * sizeof(TCHAR));
_snprintf((LPTSTR)lpDisplayBuf, LocalSize(lpDisplayBuf) / sizeof(TCHAR),
TEXT("error loading %s err = %s"), so_name, lpMsgBuf);
jack_error((LPCTSTR)lpDisplayBuf);

LocalFree(lpMsgBuf);
LocalFree(lpDisplayBuf);
}

#else #else


#include <dlfcn.h> #include <dlfcn.h>
@@ -110,11 +76,6 @@ static void PrintLoadError(const char* so_name)
#define GetJackProc(handle, name) dlsym((handle), (name)); #define GetJackProc(handle, name) dlsym((handle), (name));
#define PrintLoadError(so_name) jack_log("error loading %s err = %s", so_name, dlerror()); #define PrintLoadError(so_name) jack_log("error loading %s err = %s", so_name, dlerror());


static void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
{
snprintf(path_to_so, path_len, ADDON_DIR "/%s.so", so_name);
}

#endif #endif


typedef int (*InitializeCallback)(jack_client_t*, const char*); typedef int (*InitializeCallback)(jack_client_t*, const char*);


Loading…
Cancel
Save