diff options
author | Karl Linden <karl.j.linden@gmail.com> | 2016-02-20 19:34:18 +0100 |
---|---|---|
committer | Karl Linden <karl.j.linden@gmail.com> | 2016-02-20 19:34:18 +0100 |
commit | c4f01e514092ee6fd22dbb3e2f728c18c428dd81 (patch) | |
tree | 66bc77b49f3218e3f8f2ed63ea4f45ee61f72250 | |
parent | 75dfaa6575a01d5c552228f06fc1645ecec2c30c (diff) | |
parent | 51f923882ebc99e47037c5123f592a94203eb7da (diff) | |
download | jack2-c4f01e514092ee6fd22dbb3e2f728c18c428dd81.tar.gz |
Merge branch 'master' into waf-macosx-fixes
36 files changed, 159 insertions, 161 deletions
diff --git a/android/Shm.cpp b/android/Shm.cpp index 1149616f..275b6773 100644 --- a/android/Shm.cpp +++ b/android/Shm.cpp @@ -81,7 +81,7 @@ namespace android { /* pointers to registry header and array */ jack_shm_header_t *Shm::jack_shm_header = NULL; jack_shm_registry_t *Shm::jack_shm_registry = NULL; - char Shm::jack_shm_server_prefix[JACK_SERVER_NAME_SIZE] = ""; + char Shm::jack_shm_server_prefix[JACK_SERVER_NAME_SIZE+1] = ""; /* jack_shm_lock_registry() serializes updates to the shared memory * segment JACK uses to keep track of the SHM segments allocated to diff --git a/android/Shm.h b/android/Shm.h index cb75396e..6c8ecb43 100644 --- a/android/Shm.h +++ b/android/Shm.h @@ -124,7 +124,7 @@ namespace android { static jack_shm_info_t registry_info; static jack_shm_header_t *jack_shm_header; static jack_shm_registry_t *jack_shm_registry; - static char jack_shm_server_prefix[JACK_SERVER_NAME_SIZE]; + static char jack_shm_server_prefix[JACK_SERVER_NAME_SIZE+1]; static int semid; static pthread_mutex_t mutex; static Shm* ref; diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index 7ead9f1c..c2ea6400 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -1481,12 +1481,12 @@ LIB_EXPORT char* jack_get_client_name(jack_client_t* ext_client) LIB_EXPORT int jack_client_name_size(void) { - return JACK_CLIENT_NAME_SIZE; + return JACK_CLIENT_NAME_SIZE+1; } LIB_EXPORT int jack_port_name_size(void) { - return REAL_JACK_PORT_NAME_SIZE; + return REAL_JACK_PORT_NAME_SIZE+1; } LIB_EXPORT int jack_port_type_size(void) diff --git a/common/JackAudioDriver.cpp b/common/JackAudioDriver.cpp index 52ab00a8..e699bef5 100644 --- a/common/JackAudioDriver.cpp +++ b/common/JackAudioDriver.cpp @@ -115,8 +115,8 @@ int JackAudioDriver::Attach() { JackPort* port; jack_port_id_t port_index; - char name[REAL_JACK_PORT_NAME_SIZE]; - char alias[REAL_JACK_PORT_NAME_SIZE]; + char name[REAL_JACK_PORT_NAME_SIZE+1]; + char alias[REAL_JACK_PORT_NAME_SIZE+1]; int i; jack_log("JackAudioDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate); diff --git a/common/JackClient.cpp b/common/JackClient.cpp index e2edd544..7334a57a 100644 --- a/common/JackClient.cpp +++ b/common/JackClient.cpp @@ -1195,7 +1195,7 @@ int JackClient::SetLatencyCallback(JackLatencyCallback callback, void *arg) char* JackClient::GetInternalClientName(int ref) { - char name_res[JACK_CLIENT_NAME_SIZE + 1]; + char name_res[JACK_CLIENT_NAME_SIZE+1]; int result = -1; fChannel->GetInternalClientName(GetClientControl()->fRefNum, ref, name_res, &result); return (result < 0) ? NULL : strdup(name_res); diff --git a/common/JackClient.h b/common/JackClient.h index b8ed0b2f..3013334b 100644 --- a/common/JackClient.h +++ b/common/JackClient.h @@ -87,7 +87,7 @@ class SERVER_EXPORT JackClient : public JackClientInterface, public JackRunnable void* fThreadFunArg; void* fSessionArg; void* fLatencyArg; - char fServerName[JACK_SERVER_NAME_SIZE]; + char fServerName[JACK_SERVER_NAME_SIZE+1]; JackThread fThread; /*! Thread to execute the Process function */ detail::JackClientChannelInterface* fChannel; diff --git a/common/JackDebugClient.h b/common/JackDebugClient.h index 9eea72db..541c8cd8 100644 --- a/common/JackDebugClient.h +++ b/common/JackDebugClient.h @@ -59,7 +59,7 @@ class JackDebugClient : public JackClient int fIsDeactivated; int fIsClosed; bool fFreewheel; - char fClientName[JACK_CLIENT_NAME_SIZE + 1]; + char fClientName[JACK_CLIENT_NAME_SIZE+1]; JackProcessCallback fProcessTimeCallback; void* fProcessTimeCallbackArg; diff --git a/common/JackDriver.cpp b/common/JackDriver.cpp index 0b732c4e..1e57abc6 100644 --- a/common/JackDriver.cpp +++ b/common/JackDriver.cpp @@ -76,7 +76,7 @@ int JackDriver::Open() } int JackDriver::Open(jack_nframes_t buffer_size, - jack_nframes_t samplerate, + jack_nframes_t sample_rate, bool capturing, bool playing, int inchannels, @@ -111,8 +111,8 @@ int JackDriver::Open(jack_nframes_t buffer_size, if (buffer_size > 0) { fEngineControl->fBufferSize = buffer_size; } - if (samplerate > 0) { - fEngineControl->fSampleRate = samplerate; + if (sample_rate > 0) { + fEngineControl->fSampleRate = sample_rate; } fCaptureLatency = capture_latency; fPlaybackLatency = playback_latency; @@ -125,7 +125,7 @@ int JackDriver::Open(jack_nframes_t buffer_size, fEngineControl->UpdateTimeOut(); - fGraphManager->SetBufferSize(buffer_size); + fGraphManager->SetBufferSize(fEngineControl->fBufferSize); fGraphManager->DirectConnect(fClientControl.fRefNum, fClientControl.fRefNum); // Connect driver to itself for "sync" mode SetupDriverSync(fClientControl.fRefNum, false); return 0; @@ -422,10 +422,10 @@ static string RemoveLast(const string& name) void JackDriver::SaveConnections(int alias) { const char** connections; - char alias1[REAL_JACK_PORT_NAME_SIZE]; - char alias2[REAL_JACK_PORT_NAME_SIZE]; - char system_alias1[REAL_JACK_PORT_NAME_SIZE]; - char system_alias2[REAL_JACK_PORT_NAME_SIZE]; + char alias1[REAL_JACK_PORT_NAME_SIZE+1]; + char alias2[REAL_JACK_PORT_NAME_SIZE+1]; + char system_alias1[REAL_JACK_PORT_NAME_SIZE+1]; + char system_alias2[REAL_JACK_PORT_NAME_SIZE+1]; char* aliases[2]; char* system_aliases[2]; @@ -506,8 +506,8 @@ void JackDriver::SaveConnections(int alias) string JackDriver::MatchPortName(const char* name, const char** ports, int alias, const std::string& type) { - char alias1[REAL_JACK_PORT_NAME_SIZE]; - char alias2[REAL_JACK_PORT_NAME_SIZE]; + char alias1[REAL_JACK_PORT_NAME_SIZE+1]; + char alias2[REAL_JACK_PORT_NAME_SIZE+1]; char* aliases[2]; aliases[0] = alias1; diff --git a/common/JackDriver.h b/common/JackDriver.h index 804d9b27..3dd88e81 100644 --- a/common/JackDriver.h +++ b/common/JackDriver.h @@ -129,10 +129,9 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface protected: - char fCaptureDriverName[JACK_CLIENT_NAME_SIZE + 1]; - char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE + 1]; - - char fAliasName[JACK_CLIENT_NAME_SIZE + 1]; + char fCaptureDriverName[JACK_CLIENT_NAME_SIZE+1]; + char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE+1]; + char fAliasName[JACK_CLIENT_NAME_SIZE+1]; jack_nframes_t fCaptureLatency; jack_nframes_t fPlaybackLatency; diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index 81f381f4..15076599 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -1038,7 +1038,7 @@ int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t ds int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name) { - char old_name[REAL_JACK_PORT_NAME_SIZE]; + char old_name[REAL_JACK_PORT_NAME_SIZE+1]; strcpy(old_name, fGraphManager->GetPort(port)->GetName()); fGraphManager->GetPort(port)->SetName(name); NotifyPortRename(port, old_name); diff --git a/common/JackEngineControl.h b/common/JackEngineControl.h index 32526f0e..5e499525 100644 --- a/common/JackEngineControl.h +++ b/common/JackEngineControl.h @@ -63,7 +63,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem int fServerPriority; int fClientPriority; int fMaxClientPriority; - char fServerName[JACK_SERVER_NAME_SIZE]; + char fServerName[JACK_SERVER_NAME_SIZE+1]; JackTransportEngine fTransport; jack_timer_type_t fClockSource; int fDriverNum; diff --git a/common/JackGraphManager.cpp b/common/JackGraphManager.cpp index f89acf17..10f10df5 100644 --- a/common/JackGraphManager.cpp +++ b/common/JackGraphManager.cpp @@ -301,8 +301,9 @@ int JackGraphManager::ComputeTotalLatencies() jack_port_id_t port_index; for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) { JackPort* port = GetPort(port_index); - if (port->IsUsed()) + if (port->IsUsed()) { ComputeTotalLatency(port_index); + } } return 0; } @@ -321,14 +322,17 @@ void JackGraphManager::RecalculateLatencyAux(jack_port_id_t port_index, jack_lat dst_port->GetLatencyRange(mode, &other_latency); - if (other_latency.max > latency.max) + if (other_latency.max > latency.max) { latency.max = other_latency.max; - if (other_latency.min < latency.min) + } + if (other_latency.min < latency.min) { latency.min = other_latency.min; + } } - if (latency.min == UINT32_MAX) + if (latency.min == UINT32_MAX) { latency.min = 0; + } port->SetLatencyRange(mode, &latency); } @@ -355,8 +359,9 @@ void JackGraphManager::SetBufferSize(jack_nframes_t buffer_size) jack_port_id_t port_index; for (port_index = FIRST_AVAILABLE_PORT; port_index < fPortMax; port_index++) { JackPort* port = GetPort(port_index); - if (port->IsUsed()) + if (port->IsUsed()) { port->ClearBuffer(buffer_size); + } } } @@ -370,8 +375,9 @@ jack_port_id_t JackGraphManager::AllocatePortAux(int refnum, const char* port_na JackPort* port = GetPort(port_index); if (!port->IsUsed()) { jack_log("JackGraphManager::AllocatePortAux port_index = %ld name = %s type = %s", port_index, port_name, port_type); - if (!port->Allocate(refnum, port_name, port_type, flags)) + if (!port->Allocate(refnum, port_name, port_type, flags)) { return NO_PORT; + } break; } } diff --git a/common/JackLibClient.cpp b/common/JackLibClient.cpp index 2cd9c4a0..9eb7e350 100644 --- a/common/JackLibClient.cpp +++ b/common/JackLibClient.cpp @@ -98,7 +98,7 @@ int JackLibClient::Open(const char* server_name, const char* name, int uuid, jac strncpy(fServerName, server_name, sizeof(fServerName)); // Open server/client channel - char name_res[JACK_CLIENT_NAME_SIZE + 1]; + char name_res[JACK_CLIENT_NAME_SIZE+1]; if (fChannel->Open(server_name, name, uuid, name_res, this, options, status) < 0) { jack_error("Cannot connect to the server"); goto error; diff --git a/common/JackMidiAPI.cpp b/common/JackMidiAPI.cpp index 34733daa..61d77e12 100644 --- a/common/JackMidiAPI.cpp +++ b/common/JackMidiAPI.cpp @@ -99,8 +99,9 @@ LIB_EXPORT size_t jack_midi_max_event_size(void* port_buffer) { JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer; - if (buf && buf->IsValid()) + if (buf && buf->IsValid()) { return buf->MaxEventSize(); + } return 0; } @@ -152,7 +153,8 @@ LIB_EXPORT uint32_t jack_midi_get_lost_event_count(void* port_buffer) { JackMidiBuffer *buf = (JackMidiBuffer*)port_buffer; - if (buf && buf->IsValid()) + if (buf && buf->IsValid()) { return buf->lost_events; + } return 0; } diff --git a/common/JackMidiDriver.cpp b/common/JackMidiDriver.cpp index 482d1fe5..22060076 100644 --- a/common/JackMidiDriver.cpp +++ b/common/JackMidiDriver.cpp @@ -58,8 +58,8 @@ int JackMidiDriver::Attach() { JackPort* port; jack_port_id_t port_index; - char name[REAL_JACK_PORT_NAME_SIZE]; - char alias[REAL_JACK_PORT_NAME_SIZE]; + char name[REAL_JACK_PORT_NAME_SIZE+1]; + char alias[REAL_JACK_PORT_NAME_SIZE+1]; int i; jack_log("JackMidiDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate); diff --git a/common/JackMidiPort.h b/common/JackMidiPort.h index 29e3e4ec..d43c95ae 100644 --- a/common/JackMidiPort.h +++ b/common/JackMidiPort.h @@ -51,7 +51,7 @@ struct SERVER_EXPORT JackMidiEvent uint32_t time; jack_shmsize_t size; union { - jack_shmsize_t offset; + jack_shmsize_t offset; jack_midi_data_t data[INLINE_SIZE_MAX]; }; diff --git a/common/JackNetAPI.cpp b/common/JackNetAPI.cpp index bdf265f0..09962ca7 100644 --- a/common/JackNetAPI.cpp +++ b/common/JackNetAPI.cpp @@ -519,7 +519,7 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf fBufferSizeCallback(NULL), fBufferSizeArg(NULL), fSampleRateCallback(NULL), fSampleRateArg(NULL) { - char host_name[JACK_CLIENT_NAME_SIZE]; + char host_name[JACK_CLIENT_NAME_SIZE + 1]; // Request parameters assert(strlen(ip) < 32); diff --git a/common/JackNetDriver.cpp b/common/JackNetDriver.cpp index c9a11a98..3918582c 100644 --- a/common/JackNetDriver.cpp +++ b/common/JackNetDriver.cpp @@ -318,8 +318,8 @@ namespace Jack JackPort* port; jack_port_id_t port_index; - char name[REAL_JACK_PORT_NAME_SIZE]; - char alias[REAL_JACK_PORT_NAME_SIZE]; + char name[REAL_JACK_PORT_NAME_SIZE+1]; + char alias[REAL_JACK_PORT_NAME_SIZE+1]; int audio_port_index; int midi_port_index; @@ -720,7 +720,7 @@ Deactivated for now.. SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params) { char multicast_ip[32]; - char net_name[JACK_CLIENT_NAME_SIZE + 1] = {0}; + char net_name[JACK_CLIENT_NAME_SIZE+1] = {0}; int udp_port; int mtu = DEFAULT_MTU; // Desactivated for now... diff --git a/common/JackNetTool.h b/common/JackNetTool.h index 33d586d2..79c82f5c 100644 --- a/common/JackNetTool.h +++ b/common/JackNetTool.h @@ -94,9 +94,9 @@ namespace Jack char fPacketType[8]; //packet type ('param') uint32_t fProtocolVersion; //version int32_t fPacketID; //indicates the packet type - char fName[JACK_CLIENT_NAME_SIZE]; //slave's name - char fMasterNetName[JACK_SERVER_NAME_SIZE]; //master hostname (network) - char fSlaveNetName[JACK_SERVER_NAME_SIZE]; //slave hostname (network) + char fName[JACK_CLIENT_NAME_SIZE+1]; //slave's name + char fMasterNetName[JACK_SERVER_NAME_SIZE+1]; //master hostname (network) + char fSlaveNetName[JACK_SERVER_NAME_SIZE+1]; //slave hostname (network) uint32_t fMtu; //connection mtu uint32_t fID; //slave's ID uint32_t fTransportSync; //is the transport synced ? diff --git a/common/JackPort.cpp b/common/JackPort.cpp index 623a48f2..417882d4 100644 --- a/common/JackPort.cpp +++ b/common/JackPort.cpp @@ -230,7 +230,7 @@ void JackPort::SetName(const char* new_name) bool JackPort::NameEquals(const char* target) { - char buf[REAL_JACK_PORT_NAME_SIZE]; + char buf[REAL_JACK_PORT_NAME_SIZE+1]; /* this nasty, nasty kludge is here because between 0.109.0 and 0.109.1, the ALSA audio backend had the name "ALSA", whereas as before and diff --git a/common/JackPort.h b/common/JackPort.h index f7a601ed..5cd9aef2 100644 --- a/common/JackPort.h +++ b/common/JackPort.h @@ -45,9 +45,9 @@ class SERVER_EXPORT JackPort int fTypeId; enum JackPortFlags fFlags; - char fName[REAL_JACK_PORT_NAME_SIZE]; - char fAlias1[REAL_JACK_PORT_NAME_SIZE]; - char fAlias2[REAL_JACK_PORT_NAME_SIZE]; + char fName[REAL_JACK_PORT_NAME_SIZE+1]; + char fAlias1[REAL_JACK_PORT_NAME_SIZE+1]; + char fAlias2[REAL_JACK_PORT_NAME_SIZE+1]; int fRefNum; jack_nframes_t fLatency; diff --git a/common/JackProxyDriver.h b/common/JackProxyDriver.h index f7b25e41..82156555 100644 --- a/common/JackProxyDriver.h +++ b/common/JackProxyDriver.h @@ -62,9 +62,9 @@ namespace Jack private: - char fUpstream[JACK_CLIENT_NAME_SIZE]; /*<! the upstream server name */ - char fClientName[JACK_CLIENT_NAME_SIZE]; /*<! client name to use when connecting */ - const char* fPromiscuous; /*<! if not null, group or gid to use for promiscuous mode */ + char fUpstream[JACK_CLIENT_NAME_SIZE+1]; /*<! the upstream server name */ + char fClientName[JACK_CLIENT_NAME_SIZE+1]; /*<! client name to use when connecting */ + const char* fPromiscuous; /*<! if not null, group or gid to use for promiscuous mode */ //jack data jack_client_t* fClient; /*<! client handle */ diff --git a/common/JackRequest.h b/common/JackRequest.h index 56c203ac..9e3d2b84 100644 --- a/common/JackRequest.h +++ b/common/JackRequest.h @@ -157,7 +157,7 @@ struct JackResult struct JackClientCheckRequest : public JackRequest { - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; int fProtocol; int fOptions; int fUUID; @@ -202,7 +202,7 @@ struct JackClientCheckRequest : public JackRequest struct JackClientCheckResult : public JackResult { - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; int fStatus; JackClientCheckResult(): JackResult(), fStatus(0) @@ -240,7 +240,7 @@ struct JackClientOpenRequest : public JackRequest int fPID; int fUUID; - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; JackClientOpenRequest() {} @@ -517,8 +517,8 @@ struct JackPortConnectNameRequest : public JackRequest { int fRefNum; - char fSrc[REAL_JACK_PORT_NAME_SIZE + 1]; // port full name - char fDst[REAL_JACK_PORT_NAME_SIZE + 1]; // port full name + char fSrc[REAL_JACK_PORT_NAME_SIZE+1]; // port full name + char fDst[REAL_JACK_PORT_NAME_SIZE+1]; // port full name JackPortConnectNameRequest() {} @@ -559,8 +559,8 @@ struct JackPortDisconnectNameRequest : public JackRequest { int fRefNum; - char fSrc[REAL_JACK_PORT_NAME_SIZE + 1]; // port full name - char fDst[REAL_JACK_PORT_NAME_SIZE + 1]; // port full name + char fSrc[REAL_JACK_PORT_NAME_SIZE+1]; // port full name + char fDst[REAL_JACK_PORT_NAME_SIZE+1]; // port full name JackPortDisconnectNameRequest() {} @@ -901,7 +901,7 @@ struct JackGetInternalClientNameRequest : public JackRequest struct JackGetInternalClientNameResult : public JackResult { - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; JackGetInternalClientNameResult(): JackResult() {} @@ -936,7 +936,7 @@ struct JackInternalClientHandleRequest : public JackRequest { int fRefNum; - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; JackInternalClientHandleRequest() {} @@ -1010,9 +1010,9 @@ struct JackInternalClientLoadRequest : public JackRequest #endif int fRefNum; - char fName[JACK_CLIENT_NAME_SIZE + 1]; - char fDllName[MAX_PATH + 1]; - char fLoadInitName[JACK_LOAD_INIT_LIMIT + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; + char fDllName[MAX_PATH+1]; + char fLoadInitName[JACK_LOAD_INIT_LIMIT+1]; int fOptions; int fUUID; @@ -1194,7 +1194,7 @@ struct JackClientNotificationRequest : public JackRequest struct JackSessionCommand { char fUUID[JACK_UUID_SIZE]; - char fClientName[JACK_CLIENT_NAME_SIZE + 1]; + char fClientName[JACK_CLIENT_NAME_SIZE+1]; char fCommand[JACK_SESSION_COMMAND_SIZE]; jack_session_flags_t fFlags; @@ -1305,8 +1305,8 @@ struct JackSessionNotifyResult : public JackResult struct JackSessionNotifyRequest : public JackRequest { - char fPath[JACK_MESSAGE_SIZE + 1]; - char fDst[JACK_CLIENT_NAME_SIZE + 1]; + char fPath[JACK_MESSAGE_SIZE+1]; + char fDst[JACK_CLIENT_NAME_SIZE+1]; jack_session_event_type_t fEventType; int fRefNum; @@ -1377,7 +1377,7 @@ struct JackSessionReplyRequest : public JackRequest struct JackClientNameResult : public JackResult { - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; JackClientNameResult(): JackResult() {} @@ -1433,7 +1433,7 @@ struct JackUUIDResult : public JackResult struct JackGetUUIDRequest : public JackRequest { - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; JackGetUUIDRequest() {} @@ -1496,7 +1496,7 @@ struct JackGetClientNameRequest : public JackRequest struct JackReserveNameRequest : public JackRequest { int fRefNum; - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; char fUUID[JACK_UUID_SIZE]; JackReserveNameRequest() @@ -1533,7 +1533,7 @@ struct JackReserveNameRequest : public JackRequest struct JackClientHasSessionCallbackRequest : public JackRequest { - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; JackClientHasSessionCallbackRequest() {} @@ -1569,13 +1569,13 @@ struct JackClientHasSessionCallbackRequest : public JackRequest struct JackClientNotification { int fSize; - char fName[JACK_CLIENT_NAME_SIZE + 1]; + char fName[JACK_CLIENT_NAME_SIZE+1]; int fRefNum; int fNotify; int fValue1; int fValue2; int fSync; - char fMessage[JACK_MESSAGE_SIZE + 1]; + char fMessage[JACK_MESSAGE_SIZE+1]; JackClientNotification(): fNotify(-1), fValue1(-1), fValue2(-1) {} diff --git a/common/shm.c b/common/shm.c index c52dfa50..75075743 100644 --- a/common/shm.c +++ b/common/shm.c @@ -119,7 +119,7 @@ static jack_shm_info_t registry_info = { /* SHM info for the registry */ /* pointers to registry header and array */ static jack_shm_header_t *jack_shm_header = NULL; static jack_shm_registry_t *jack_shm_registry = NULL; -static char jack_shm_server_prefix[JACK_SERVER_NAME_SIZE] = ""; +static char jack_shm_server_prefix[JACK_SERVER_NAME_SIZE+1] = ""; /* jack_shm_lock_registry() serializes updates to the shared memory * segment JACK uses to keep track of the SHM segments allocated to diff --git a/common/shm.h b/common/shm.h index 92aa5a64..12f0f228 100644 --- a/common/shm.h +++ b/common/shm.h @@ -123,7 +123,7 @@ extern "C" pid_t pid; /* process ID */ #endif - char name[JACK_SERVER_NAME_SIZE]; + char name[JACK_SERVER_NAME_SIZE+1]; } jack_shm_server_t; diff --git a/example-clients/midiseq.c b/example-clients/midiseq.c index 1fc779e3..45085e80 100644 --- a/example-clients/midiseq.c +++ b/example-clients/midiseq.c @@ -50,49 +50,44 @@ static void usage() static int process(jack_nframes_t nframes, void *arg) { - int i,j; - void* port_buf = jack_port_get_buffer(output_port, nframes); - unsigned char* buffer; - jack_midi_clear_buffer(port_buf); - /*memset(buffer, 0, nframes*sizeof(jack_default_audio_sample_t));*/ + int i,j; + void* port_buf = jack_port_get_buffer(output_port, nframes); + unsigned char* buffer; + jack_midi_clear_buffer(port_buf); + /*memset(buffer, 0, nframes*sizeof(jack_default_audio_sample_t));*/ - for(i=0; i<nframes; i++) - { - for(j=0; j<num_notes; j++) - { - if(note_starts[j] == loop_index) - { - buffer = jack_midi_event_reserve(port_buf, i, 3); -/* printf("wrote a note on, port buffer = 0x%x, event buffer = 0x%x\n", port_buf, buffer);*/ - buffer[2] = 64; /* velocity */ - buffer[1] = note_frqs[j]; - buffer[0] = 0x90; /* note on */ - } - else if(note_starts[j] + note_lengths[j] == loop_index) - { - buffer = jack_midi_event_reserve(port_buf, i, 3); -/* printf("wrote a note off, port buffer = 0x%x, event buffer = 0x%x\n", port_buf, buffer);*/ - buffer[2] = 64; /* velocity */ - buffer[1] = note_frqs[j]; - buffer[0] = 0x80; /* note off */ - } - } - loop_index = loop_index+1 >= loop_nsamp ? 0 : loop_index+1; - } - return 0; + for (i = 0; i < nframes; i++) { + for (j = 0; j < num_notes; j++) { + if (note_starts[j] == loop_index) { + if ((buffer = jack_midi_event_reserve(port_buf, i, 3))) { + /* printf("wrote a note on, port buffer = 0x%x, event buffer = 0x%x\n", port_buf, buffer); */ + buffer[2] = 64; /* velocity */ + buffer[1] = note_frqs[j]; + buffer[0] = 0x90; /* note on */ + } + } else if (note_starts[j] + note_lengths[j] == loop_index) { + if ((buffer = jack_midi_event_reserve(port_buf, i, 3))) { + /* printf("wrote a note off, port buffer = 0x%x, event buffer = 0x%x\n", port_buf, buffer); */ + buffer[2] = 64; /* velocity */ + buffer[1] = note_frqs[j]; + buffer[0] = 0x80; /* note off */ + } + } + } + loop_index = loop_index+1 >= loop_nsamp ? 0 : loop_index+1; + } + return 0; } int main(int narg, char **args) { int i; jack_nframes_t nframes; - if((narg<6) || ((narg-3)%3 !=0)) - { + if ((narg<6) || ((narg-3)%3 != 0)) { usage(); exit(1); } - if((client = jack_client_open (args[1], JackNullOption, NULL)) == 0) - { + if ((client = jack_client_open (args[1], JackNullOption, NULL)) == 0) { fprintf (stderr, "JACK server not running?\n"); return 1; } @@ -105,15 +100,13 @@ int main(int narg, char **args) note_starts = malloc(num_notes*sizeof(jack_nframes_t)); note_lengths = malloc(num_notes*sizeof(jack_nframes_t)); loop_nsamp = atoi(args[2]); - for(i=0; i<num_notes; i++) - { + for (i = 0; i < num_notes; i++) { note_starts[i] = atoi(args[3 + 3*i]); note_frqs[i] = atoi(args[4 + 3*i]); note_lengths[i] = atoi(args[5 + 3*i]); } - if (jack_activate(client)) - { + if (jack_activate(client)) { fprintf (stderr, "cannot activate client"); return 1; } diff --git a/example-clients/transport.c b/example-clients/transport.c index 4847c1b8..fd258d8f 100644 --- a/example-clients/transport.c +++ b/example-clients/transport.c @@ -2,7 +2,7 @@ * transport.c -- JACK transport master example client. * * Copyright (C) 2003 Jack O'Quin. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -24,14 +24,14 @@ #include <signal.h> #include <stdlib.h> #include <string.h> -#ifdef HAVE_READLINE +#if HAVE_READLINE #include <readline/readline.h> #include <readline/history.h> #endif #include <jack/jack.h> #include <jack/transport.h> -#ifndef HAVE_READLINE +#if !HAVE_READLINE #define whitespace(c) (((c) == ' ') || ((c) == '\t')) #endif @@ -53,7 +53,7 @@ volatile int time_reset = 1; /* true when time values change */ * * Runs in the process thread. Realtime, must not wait. */ -static void timebase(jack_transport_state_t state, jack_nframes_t nframes, +static void timebase(jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void *arg) { double min; /* minutes since frame 0 */ @@ -238,7 +238,7 @@ command_t commands[] = { {"?", com_help, "Synonym for `help'" }, {(char *)NULL, (cmd_function_t *)NULL, (char *)NULL } }; - + static command_t *find_command(char *name) { register int i; @@ -258,7 +258,7 @@ static command_t *find_command(char *name) else return (&commands[i]); } - + return ((command_t *)NULL); } @@ -302,33 +302,33 @@ static void execute_command(char *line) register int i; command_t *command; char *word; - + /* Isolate the command word. */ i = 0; while (line[i] && whitespace(line[i])) i++; word = line + i; - + while (line[i] && !whitespace(line[i])) i++; - + if (line[i]) line[i++] = '\0'; - + command = find_command(word); - + if (!command) { fprintf(stderr, "%s: No such command. There is `help\'.\n", word); return; } - + /* Get argument to command, if any. */ while (whitespace(line[i])) i++; - + word = line + i; - + /* invoke the command function. */ (*command->func)(word); } @@ -345,28 +345,28 @@ static char *stripwhite(char *string) if (*s == '\0') return s; - + t = s + strlen (s) - 1; while (t > s && whitespace(*t)) t--; *++t = '\0'; - + return s; } - + static char *dupstr(char *s) { char *r = malloc(strlen(s) + 1); strcpy(r, s); return r; } - + /* Readline generator function for command completion. */ static char *command_generator (const char *text, int state) { static int list_index, len; char *name; - + /* If this is a new word to complete, initialize now. This includes saving the length of TEXT for efficiency, and initializing the index variable to 0. */ @@ -374,22 +374,22 @@ static char *command_generator (const char *text, int state) list_index = 0; len = strlen (text); } - + /* Return the next name which partially matches from the command list. */ while ((name = commands[list_index].name)) { list_index++; - + if (strncmp(name, text, len) == 0) return dupstr(name); } - + return (char *) NULL; /* No names matched. */ } static void command_loop() { -#ifdef HAVE_READLINE +#if HAVE_READLINE char *line, *cmd; char prompt[32]; @@ -397,7 +397,7 @@ static void command_loop() /* Allow conditional parsing of the ~/.inputrc file. */ rl_readline_name = package; - + /* Define a custom completion function. */ rl_completion_entry_function = command_generator; #else @@ -408,9 +408,9 @@ static void command_loop() /* Read and execute commands until the user quits. */ while (!done) { -#ifdef HAVE_READLINE +#if HAVE_READLINE line = readline(prompt); - + if (line == NULL) { /* EOF? */ printf("\n"); /* close out prompt */ done = 1; @@ -421,20 +421,20 @@ static void command_loop() fgets(line, sizeof(line), stdin); line[strlen(line)-1] = '\0'; #endif - + /* Remove leading and trailing whitespace from the line. */ cmd = stripwhite(line); /* If anything left, add to history and execute it. */ if (*cmd) { -#ifdef HAVE_READLINE +#if HAVE_READLINE add_history(cmd); #endif execute_command(cmd); } - -#ifdef HAVE_READLINE + +#if HAVE_READLINE free(line); /* realine() called malloc() */ #endif } @@ -459,7 +459,7 @@ int main(int argc, char *argv[]) return 1; } -#ifndef WIN32 +#if !WIN32 signal(SIGQUIT, signal_handler); signal(SIGHUP, signal_handler); #endif diff --git a/linux/alsa/JackAlsaDriver.cpp b/linux/alsa/JackAlsaDriver.cpp index 508a0d17..62d9f43b 100644 --- a/linux/alsa/JackAlsaDriver.cpp +++ b/linux/alsa/JackAlsaDriver.cpp @@ -116,8 +116,8 @@ int JackAlsaDriver::Attach() JackPort* port; jack_port_id_t port_index; unsigned long port_flags = (unsigned long)CaptureDriverFlags; - char name[REAL_JACK_PORT_NAME_SIZE]; - char alias[REAL_JACK_PORT_NAME_SIZE]; + char name[REAL_JACK_PORT_NAME_SIZE+1]; + char alias[REAL_JACK_PORT_NAME_SIZE+1]; assert(fCaptureChannels < DRIVER_PORT_NUM); assert(fPlaybackChannels < DRIVER_PORT_NUM); diff --git a/linux/alsarawmidi/JackALSARawMidiPort.h b/linux/alsarawmidi/JackALSARawMidiPort.h index 91c2522d..0770a8a6 100644 --- a/linux/alsarawmidi/JackALSARawMidiPort.h +++ b/linux/alsarawmidi/JackALSARawMidiPort.h @@ -31,12 +31,12 @@ namespace Jack { private: - char alias[REAL_JACK_PORT_NAME_SIZE]; + char alias[REAL_JACK_PORT_NAME_SIZE+1]; struct pollfd *alsa_poll_fds; int alsa_poll_fd_count; int fds[2]; unsigned short io_mask; - char name[REAL_JACK_PORT_NAME_SIZE]; + char name[REAL_JACK_PORT_NAME_SIZE+1]; struct pollfd *queue_poll_fd; protected: diff --git a/macosx/Jackdmp.xcodeproj/project.pbxproj b/macosx/Jackdmp.xcodeproj/project.pbxproj index b0c20e37..ee58ffb6 100644 --- a/macosx/Jackdmp.xcodeproj/project.pbxproj +++ b/macosx/Jackdmp.xcodeproj/project.pbxproj @@ -1785,7 +1785,6 @@ 4B49D3C214864D49003390F8 /* pa_asio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pa_asio.h; path = ../windows/portaudio/pa_asio.h; sourceTree = SOURCE_ROOT; }; 4B49D3C314864D49003390F8 /* portaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = portaudio.h; path = ../windows/portaudio/portaudio.h; sourceTree = SOURCE_ROOT; }; 4B49D3C914864DA7003390F8 /* JackLinuxTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = JackLinuxTime.c; path = ../linux/JackLinuxTime.c; sourceTree = SOURCE_ROOT; }; - 4B49D3CB14864DB2003390F8 /* cycles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cycles.h; path = ../linux/cycles.h; sourceTree = SOURCE_ROOT; }; 4B49D3D814864DEC003390F8 /* JackWinThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinThread.cpp; path = ../windows/JackWinThread.cpp; sourceTree = SOURCE_ROOT; }; 4B49D3D914864DEC003390F8 /* JackWinServerLaunch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinServerLaunch.cpp; path = ../windows/JackWinServerLaunch.cpp; sourceTree = SOURCE_ROOT; }; 4B49D3DA14864DEC003390F8 /* JackWinSemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinSemaphore.cpp; path = ../windows/JackWinSemaphore.cpp; sourceTree = SOURCE_ROOT; }; @@ -2029,7 +2028,7 @@ 4BF8D2470834F20600C94B91 /* testSem.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSem.cpp; path = ../tests/testSem.cpp; sourceTree = SOURCE_ROOT; }; 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackFrameTimer.cpp; path = ../common/JackFrameTimer.cpp; sourceTree = SOURCE_ROOT; }; 4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackFrameTimer.h; path = ../common/JackFrameTimer.h; sourceTree = SOURCE_ROOT; }; - 4BFA5E980DEC4D9C00FA4CDB /* testSem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testSem; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFA5E980DEC4D9C00FA4CDB /* testMutex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testMutex; sourceTree = BUILT_PRODUCTS_DIR; }; 4BFA5E9E0DEC4DD900FA4CDB /* testMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testMutex.cpp; path = ../tests/testMutex.cpp; sourceTree = SOURCE_ROOT; }; 4BFA828C0DF6A9E40087B4E1 /* jack_evmon */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_evmon; sourceTree = BUILT_PRODUCTS_DIR; }; 4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_bufsize; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -2837,7 +2836,7 @@ 4B363F1E0DEB0A6A001F72D9 /* jack_monitor_client */, 4B363F350DEB0BD1001F72D9 /* jack_showtime */, 4B363F720DEB0D4E001F72D9 /* jack_impulse_grabber */, - 4BFA5E980DEC4D9C00FA4CDB /* testSem */, + 4BFA5E980DEC4D9C00FA4CDB /* testMutex */, 4BFA828C0DF6A9E40087B4E1 /* jack_evmon */, 4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */, 4BFA82AB0DF6A9E40087B4E1 /* jack_rec */, @@ -2905,7 +2904,6 @@ isa = PBXGroup; children = ( 4B05A07D0DF72BC000840F4C /* driver.h */, - 4B49D3CB14864DB2003390F8 /* cycles.h */, 4B49D3C914864DA7003390F8 /* JackLinuxTime.c */, 4B349837133A6B6F00D130AB /* firewire */, 4B349825133A6AF500D130AB /* alsarawmidi */, @@ -6200,7 +6198,7 @@ name = "testMutex Universal"; productInstallPath = /usr/local/bin; productName = testSem; - productReference = 4BFA5E980DEC4D9C00FA4CDB /* testSem */; + productReference = 4BFA5E980DEC4D9C00FA4CDB /* testMutex */; productType = "com.apple.product-type.tool"; }; 4BFA82820DF6A9E40087B4E1 /* jack_evmon 64 bits */ = { diff --git a/macosx/coreaudio/JackCoreAudioDriver.mm b/macosx/coreaudio/JackCoreAudioDriver.mm index f6bc5f0d..d9448030 100644 --- a/macosx/coreaudio/JackCoreAudioDriver.mm +++ b/macosx/coreaudio/JackCoreAudioDriver.mm @@ -2262,8 +2262,8 @@ int JackCoreAudioDriver::Attach() UInt32 size; Boolean isWritable; char channel_name[64]; - char name[REAL_JACK_PORT_NAME_SIZE]; - char alias[REAL_JACK_PORT_NAME_SIZE]; + char name[REAL_JACK_PORT_NAME_SIZE+1]; + char alias[REAL_JACK_PORT_NAME_SIZE+1]; jack_log("JackCoreAudioDriver::Attach : fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate); diff --git a/macosx/coremidi/JackCoreMidiPort.h b/macosx/coremidi/JackCoreMidiPort.h index 3cb7b60b..6b132f2c 100644 --- a/macosx/coremidi/JackCoreMidiPort.h +++ b/macosx/coremidi/JackCoreMidiPort.h @@ -31,9 +31,9 @@ namespace Jack { private: - char alias[REAL_JACK_PORT_NAME_SIZE]; + char alias[REAL_JACK_PORT_NAME_SIZE+1]; + char name[REAL_JACK_PORT_NAME_SIZE+1]; bool initialized; - char name[REAL_JACK_PORT_NAME_SIZE]; protected: diff --git a/macosx/coremidi/JackCoreMidiPort.mm b/macosx/coremidi/JackCoreMidiPort.mm index 2bc4eb66..67367923 100644 --- a/macosx/coremidi/JackCoreMidiPort.mm +++ b/macosx/coremidi/JackCoreMidiPort.mm @@ -70,7 +70,7 @@ JackCoreMidiPort::Initialize(const char *alias_name, const char *client_name, const char *driver_name, int index, MIDIEndpointRef endpoint, bool is_output) { - char endpoint_name[REAL_JACK_PORT_NAME_SIZE]; + char endpoint_name[REAL_JACK_PORT_NAME_SIZE+1]; CFStringRef endpoint_name_ref; int num = index + 1; Boolean res; diff --git a/solaris/oss/JackOSSAdapter.h b/solaris/oss/JackOSSAdapter.h index d96bdd6a..4c5eba02 100644 --- a/solaris/oss/JackOSSAdapter.h +++ b/solaris/oss/JackOSSAdapter.h @@ -55,8 +55,8 @@ class JackOSSAdapter : public JackAudioAdapterInterface, public JackRunnableInte JackThread fThread; - char fCaptureDriverName[JACK_CLIENT_NAME_SIZE + 1]; - char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE + 1]; + char fCaptureDriverName[JACK_CLIENT_NAME_SIZE+1]; + char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE+1]; int fInFD; int fOutFD; diff --git a/windows/JackWinNamedPipeServerChannel.h b/windows/JackWinNamedPipeServerChannel.h index 54858853..e625565f 100644 --- a/windows/JackWinNamedPipeServerChannel.h +++ b/windows/JackWinNamedPipeServerChannel.h @@ -80,7 +80,7 @@ class JackWinNamedPipeServerChannel : public JackRunnableInterface JackWinNamedPipeServer fRequestListenPipe; // Pipe to create request socket for the client JackServer* fServer; JackThread fThread; // Thread to execute the event loop - char fServerName[JACK_SERVER_NAME_SIZE]; + char fServerName[JACK_SERVER_NAME_SIZE+1]; std::list<JackClientPipeThread*> fClientList; diff --git a/windows/winmme/JackWinMMEPort.h b/windows/winmme/JackWinMMEPort.h index a544c4a6..882db7f9 100644 --- a/windows/winmme/JackWinMMEPort.h +++ b/windows/winmme/JackWinMMEPort.h @@ -31,8 +31,8 @@ namespace Jack { protected: - char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; - char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE]; + char alias[REAL_JACK_PORT_NAME_SIZE+1]; + char name[REAL_JACK_PORT_NAME_SIZE+1]; public: |