Commit b7c53a84 authored by Stephane Letz's avatar Stephane Letz
Browse files

Move SYNC_MAX_NAME_SIZE in JackConstants.h, correct synchro primitives BuildName method.

parent d3589cbc
......@@ -37,6 +37,8 @@
#define JACK_UUID_SIZE 32
#define JACK_SESSION_COMMAND_SIZE 256
#define SYNC_MAX_NAME_SIZE 256
#define REAL_JACK_PORT_NAME_SIZE JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE
#ifndef PORT_NUM
......
......@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __JackSynchro__
#define __JackSynchro__
#define SYNC_MAX_NAME_SIZE 256
#include "JackConstants.h"
namespace Jack
{
......
......@@ -28,7 +28,7 @@ namespace Jack
void JackMachSemaphore::BuildName(const char* client_name, const char* server_name, char* res, int size)
{
char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
char ext_client_name[SYNC_MAX_NAME_SIZE + 1];
JackTools::RewriteName(client_name, ext_client_name);
snprintf(res, size, "jack_mach_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name);
}
......
......@@ -30,9 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
namespace Jack
{
void JackFifo::BuildName(const char* client_name, const char* server_name, char* res)
void JackFifo::BuildName(const char* client_name, const char* server_name, char* res, int size)
{
char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
char ext_client_name[SYNC_MAX_NAME_SIZE + 1];
JackTools::RewriteName(client_name, ext_client_name);
sprintf(res, "%s/jack_fifo.%d_%s_%s", jack_client_dir, JackTools::GetUID(), server_name, ext_client_name);
}
......@@ -126,7 +126,7 @@ bool JackFifo::TimedWait(long usec)
bool JackFifo::Allocate(const char* name, const char* server_name, int value)
{
struct stat statbuf;
BuildName(name, server_name, fName);
BuildName(name, server_name, fName, sizeof(fName));
jack_log("JackFifo::Allocate name = %s", fName);
if (stat(fName, &statbuf) < 0) {
......@@ -159,7 +159,7 @@ bool JackFifo::Allocate(const char* name, const char* server_name, int value)
// Client side
bool JackFifo::ConnectAux(const char* name, const char* server_name, int access)
{
BuildName(name, server_name, fName);
BuildName(name, server_name, fName, sizeof(fName));
jack_log("JackFifo::ConnectAux name = %s", fName);
// Temporary...
......
......@@ -30,7 +30,7 @@ namespace Jack
void JackPosixSemaphore::BuildName(const char* client_name, const char* server_name, char* res, int size)
{
char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
char ext_client_name[SYNC_MAX_NAME_SIZE + 1];
JackTools::RewriteName(client_name, ext_client_name);
snprintf(res, size, "jack_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name);
}
......
......@@ -28,7 +28,7 @@ namespace Jack
void JackWinSemaphore::BuildName(const char* client_name, const char* server_name, char* res, int size)
{
char ext_client_name[JACK_CLIENT_NAME_SIZE + 1];
char ext_client_name[SYNC_MAX_NAME_SIZE + 1];
JackTools::RewriteName(client_name, ext_client_name);
_snprintf(res, size, "jack_pipe.%s_%s", server_name, ext_client_name);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment