Browse Source

Compiles on Windows again.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3793 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.4
sletz 16 years ago
parent
commit
bcb09a4d9c
3 changed files with 35 additions and 24 deletions
  1. +8
    -8
      common/JackLockedEngine.h
  2. +23
    -14
      common/JackTools.cpp
  3. +4
    -2
      common/JackTools.h

+ 8
- 8
common/JackLockedEngine.h View File

@@ -30,14 +30,14 @@ namespace Jack

#define TRY_CALL \
try { \
#define CATCH_EXCEPTION_RETURN \
} catch(std::bad_alloc& e) { \
jack_error("Memory allocation error..."); \
return -1; \
} catch(JackTemporaryException& e) { \
jack_error("JackTemporaryException : now quits..."); \
kill(JackTools::GetPID(), SIGINT); \
JackTools::KillServer(); \
return -1; \
} catch (...) { \
jack_error("Unknown error..."); \
@@ -54,7 +54,7 @@ namespace Jack
/*!
\brief Locked Engine, access to methods is serialized using a mutex.
*/
class SERVER_EXPORT JackLockedEngine : public JackLockAble
{
private:
@@ -205,7 +205,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
return fEngine.PortDisconnect(refnum, src, dst);
CATCH_EXCEPTION_RETURN
}
int PortRename(int refnum, jack_port_id_t port, const char* name)
{
TRY_CALL
@@ -263,7 +263,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
fEngine.NotifyFreewheel(onoff);
CATCH_ENGINE_EXCEPTION
}
void NotifyFailure(int code, const char* reason)
{
TRY_CALL
@@ -271,7 +271,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
fEngine.NotifyFailure(code, reason);
CATCH_ENGINE_EXCEPTION
}
int GetClientPID(const char* name)
{
TRY_CALL
@@ -279,7 +279,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
return fEngine.GetClientPID(name);
CATCH_EXCEPTION_RETURN
}
int GetClientRefNum(const char* name)
{
TRY_CALL
@@ -287,7 +287,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
return fEngine.GetClientRefNum(name);
CATCH_EXCEPTION_RETURN
}
};

} // end of namespace


+ 23
- 14
common/JackTools.cpp View File

@@ -33,10 +33,19 @@ using namespace std;

namespace Jack {

void JackTools::KillServer()
{
#ifdef WIN32
exit(1);
#else
kill(GetPID(), SIGINT);
#endif
}

#define DEFAULT_TMP_DIR "/tmp"
char* jack_tmpdir = (char*)DEFAULT_TMP_DIR;

int JackTools::GetPID()
int JackTools::GetPID()
{
#ifdef WIN32
return _getpid();
@@ -45,7 +54,7 @@ namespace Jack {
#endif
}

int JackTools::GetUID()
int JackTools::GetUID()
{
#ifdef WIN32
return _getpid();
@@ -55,7 +64,7 @@ namespace Jack {
#endif
}

const char* JackTools::DefaultServerName()
const char* JackTools::DefaultServerName()
{
const char* server_name;
if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL)
@@ -66,25 +75,25 @@ namespace Jack {
/* returns the name of the per-user subdirectory of jack_tmpdir */
#ifdef WIN32

char* JackTools::UserDir()
char* JackTools::UserDir()
{
return "";
}

char* JackTools::ServerDir(const char* server_name, char* server_dir)
char* JackTools::ServerDir(const char* server_name, char* server_dir)
{
return "";
}

void JackTools::CleanupFiles(const char* server_name) {}

int JackTools::GetTmpdir()
int JackTools::GetTmpdir()
{
return 0;
}

#else
char* JackTools::UserDir()
char* JackTools::UserDir()
{
static char user_dir[JACK_PATH_MAX + 1] = "";

@@ -101,7 +110,7 @@ namespace Jack {
}

/* returns the name of the per-server subdirectory of jack_user_dir() */
char* JackTools::ServerDir(const char* server_name, char* server_dir)
char* JackTools::ServerDir(const char* server_name, char* server_dir)
{
/* format the path name into the suppled server_dir char array,
* assuming that server_dir is at least as large as JACK_PATH_MAX + 1 */
@@ -110,7 +119,7 @@ namespace Jack {
return server_dir;
}

void JackTools::CleanupFiles(const char* server_name)
void JackTools::CleanupFiles(const char* server_name)
{
DIR* dir;
struct dirent *dirent;
@@ -169,7 +178,7 @@ namespace Jack {
}
}

int JackTools::GetTmpdir()
int JackTools::GetTmpdir()
{
FILE* in;
size_t len;
@@ -201,7 +210,7 @@ namespace Jack {
}
#endif

void JackTools::RewriteName(const char* name, char* new_name)
void JackTools::RewriteName(const char* name, char* new_name)
{
size_t i;
for (i = 0; i < strlen(name); i++) {
@@ -212,7 +221,7 @@ namespace Jack {
}
new_name[i] = '\0';
}
#ifdef WIN32

void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
@@ -251,7 +260,7 @@ void PrintLoadError(const char* so_name)

#else

void PrintLoadError(const char* so_name)
void PrintLoadError(const char* so_name)
{
jack_log("error loading %s err = %s", so_name, dlerror());
}
@@ -264,7 +273,7 @@ void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
internal_dir = ADDON_DIR;
}
}
snprintf(path_to_so, path_len, "%s/%s.so", internal_dir, so_name);
}



+ 4
- 2
common/JackTools.h View File

@@ -55,6 +55,8 @@ namespace Jack
static int GetPID();
static int GetUID();

static void KillServer();

static char* UserDir();
static char* ServerDir ( const char* server_name, char* server_dir );
static const char* DefaultServerName();
@@ -201,10 +203,10 @@ namespace Jack
return 0;
}
};
void BuildClientPath(char* path_to_so, int path_len, const char* so_name);
void PrintLoadError(const char* so_name);
}

#endif

Loading…
Cancel
Save