diff --git a/common/JackAudioAdapter.cpp b/common/JackAudioAdapter.cpp index 22120fb7..9158171b 100644 --- a/common/JackAudioAdapter.cpp +++ b/common/JackAudioAdapter.cpp @@ -165,14 +165,14 @@ int JackAudioAdapter::Open() fPlaybackPortList = new jack_port_t*[fAudioAdapter->GetOutputs()]; for (int i = 0; i < fAudioAdapter->GetInputs(); i++) { - sprintf(name, "capture_%d", i + 1); + snprintf(name, sizeof(name), "capture_%d", i + 1); if ((fCapturePortList[i] = jack_port_register(fClient, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, 0)) == NULL) { goto fail; } } for (int i = 0; i < fAudioAdapter->GetOutputs(); i++) { - sprintf(name, "playback_%d", i + 1); + snprintf(name, sizeof(name), "playback_%d", i + 1); if ((fPlaybackPortList[i] = jack_port_register(fClient, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, 0)) == NULL) { goto fail; } diff --git a/common/JackDebugClient.cpp b/common/JackDebugClient.cpp index 387a4fa1..3b0af9b4 100644 --- a/common/JackDebugClient.cpp +++ b/common/JackDebugClient.cpp @@ -90,7 +90,7 @@ int JackDebugClient::Open(const char* server_name, const char* name, int uuid, j /* Convert it to local time representation. */ loctime = localtime (&curtime); strftime (buffer, 256, "%I-%M", loctime); - sprintf(provstr, "JackClientDebug-%s-%s.log", name, buffer); + snprintf(provstr, sizeof(provstr), "JackClientDebug-%s-%s.log", name, buffer); fStream = new ofstream(provstr, ios_base::ate); if (fStream->is_open()) { if (res == -1) { diff --git a/common/JackDriverLoader.cpp b/common/JackDriverLoader.cpp index dd06b767..f7de89ee 100644 --- a/common/JackDriverLoader.cpp +++ b/common/JackDriverLoader.cpp @@ -266,7 +266,7 @@ jackctl_parse_driver_params(jackctl_driver *driver_ptr, int argc, char* argv[]) options_ptr = options; for (i = 0; i < desc->nparams; i++) { - sprintf (options_ptr, "%c::", desc->params[i].character); + sprintf(options_ptr, "%c::", desc->params[i].character); options_ptr += 3; long_options[i].name = desc->params[i].name; long_options[i].flag = NULL; @@ -410,8 +410,9 @@ jack_get_descriptor (JSList * drivers, const char* sofile, const char* symbol) #endif } - filename = (char*)malloc(strlen (driver_dir) + 1 + strlen(sofile) + 1); - sprintf (filename, "%s/%s", driver_dir, sofile); + int len = strlen(driver_dir) + 1 + strlen(sofile) + 1; + filename = (char*)malloc(len); + snprintf(filename, len, "%s/%s", driver_dir, sofile); if ((dlhandle = LoadDriverModule(filename)) == NULL) { #ifdef WIN32 @@ -495,15 +496,16 @@ static bool check_symbol(const char* sofile, const char* symbol) } else { GetCurrentDirectory(512, temp_driver_dir1); } - sprintf(temp_driver_dir2, "%s/%s", temp_driver_dir1, ADDON_DIR); + snprintf(temp_driver_dir2, sizeof(temp_driver_dir2), "%s/%s", temp_driver_dir1, ADDON_DIR); driver_dir = temp_driver_dir2; #else driver_dir = ADDON_DIR; #endif } - char* filename = (char*)malloc(strlen (driver_dir) + 1 + strlen(sofile) + 1); - sprintf (filename, "%s/%s", driver_dir, sofile); + int len = strlen(driver_dir) + 1 + strlen(sofile) + 1; + char* filename = (char*)malloc(len); + snprintf(filename, len, "%s/%s", driver_dir, sofile); if ((dlhandle = LoadDriverModule(filename)) == NULL) { #ifdef WIN32 @@ -549,7 +551,7 @@ jack_drivers_load (JSList * drivers) { driver_dir = driver_dir_storage; } - sprintf(dll_filename, "%s/*.dll", driver_dir); + snprintf(dll_filename, sizeof(dll_filename), "%s/*.dll", driver_dir); file = (HANDLE )FindFirstFile(dll_filename, &filedata); @@ -694,7 +696,7 @@ jack_internals_load (JSList * internals) { driver_dir = driver_dir_storage; } - sprintf(dll_filename, "%s/*.dll", driver_dir); + snprintf(dll_filename, sizeof(dll_filename), "%s/*.dll", driver_dir); file = (HANDLE )FindFirstFile(dll_filename, &filedata); diff --git a/common/JackGlobals.cpp b/common/JackGlobals.cpp index 7c766945..dc40392b 100644 --- a/common/JackGlobals.cpp +++ b/common/JackGlobals.cpp @@ -52,8 +52,8 @@ void JackGlobals::CheckContext(const char* name) curtime = time (NULL); /* Convert it to local time representation. */ loctime = localtime (&curtime); - strftime (buffer, 256, "%I-%M", loctime); - sprintf(provstr, "JackAPICall-%s.log", buffer); + strftime(buffer, 256, "%I-%M", loctime); + sprintnf(provstr, sizeof(provstr), "JackAPICall-%s.log", buffer); JackGlobals::fStream = new std::ofstream(provstr, std::ios_base::ate); JackGlobals::fStream->is_open(); } diff --git a/common/JackNetManager.cpp b/common/JackNetManager.cpp index cb8afc5d..a432094c 100644 --- a/common/JackNetManager.cpp +++ b/common/JackNetManager.cpp @@ -176,7 +176,7 @@ namespace Jack //audio for (i = 0; i < fParams.fSendAudioChannels; i++) { - sprintf(name, "to_slave_%d", i+1); + snprintf(name, sizeof(name), "to_slave_%d", i+1); if ((fAudioCapturePorts[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0)) == NULL) return -1; //port latency @@ -185,7 +185,7 @@ namespace Jack } for (i = 0; i < fParams.fReturnAudioChannels; i++) { - sprintf(name, "from_slave_%d", i+1); + snprintf(name, sizeof(name), "from_slave_%d", i+1); if ((fAudioPlaybackPorts[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal, 0)) == NULL) return -1; //port latency @@ -195,7 +195,7 @@ namespace Jack //midi for (i = 0; i < fParams.fSendMidiChannels; i++) { - sprintf(name, "midi_to_slave_%d", i+1); + snprintf(name, sizeof(name), "midi_to_slave_%d", i+1); if ((fMidiCapturePorts[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput | JackPortIsTerminal, 0)) == NULL) return -1; //port latency @@ -204,7 +204,7 @@ namespace Jack } for (i = 0; i < fParams.fReturnMidiChannels; i++) { - sprintf(name, "midi_from_slave_%d", i+1); + snprintf(name, sizeof(name), "midi_from_slave_%d", i+1); if ((fMidiPlaybackPorts[i] = jack_port_register(fJackClient, name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput | JackPortIsTerminal, 0)) == NULL) return -1; //port latency @@ -779,7 +779,8 @@ namespace Jack jack_info("Takes physical %d outputs for client", params.fReturnAudioChannels); } - SetSlaveName(params); + // Rename done in jack_client_open if needed ? + //SetSlaveName(params); //create a new master and add it to the list JackNetMaster* master = new JackNetMaster(fSocket, params, fMulticastIP); @@ -798,7 +799,7 @@ namespace Jack master_list_it_t it; for (it = fMasterList.begin(); it != fMasterList.end(); it++) { if (strcmp((*it)->fParams.fName, params.fName) == 0) { - sprintf(params.fName, "%s-%u", params.fName, params.fID); + snprintf(params.fName, sizeof(params.fName), "%s-%u", params.fName, params.fID); } } } diff --git a/linux/alsa/JackAlsaDriver.cpp b/linux/alsa/JackAlsaDriver.cpp index a8d4acbe..b23f5415 100644 --- a/linux/alsa/JackAlsaDriver.cpp +++ b/linux/alsa/JackAlsaDriver.cpp @@ -574,7 +574,7 @@ enum_alsa_devices() while(snd_card_next(&card_no) >= 0 && card_no >= 0) { - sprintf(card_id, "hw:%d", card_no); + snprintf(card_id, sizeof(card_id), "hw:%d", card_no); if (snd_ctl_open(&handle, card_id, 0) >= 0 && snd_ctl_card_info(handle, info) >= 0) @@ -585,7 +585,7 @@ enum_alsa_devices() while (snd_ctl_pcm_next_device(handle, &device_no) >= 0 && device_no != -1) { - sprintf(device_id, "%s,%d", card_id, device_no); + snprintf(device_id, sizeof(device_id), "%s,%d", card_id, device_no); snd_pcm_info_set_device(pcminfo_capture, device_no); snd_pcm_info_set_subdevice(pcminfo_capture, 0); diff --git a/macosx/JackMachSemaphore.cpp b/macosx/JackMachSemaphore.cpp index 8d00b7e6..195fb8c8 100644 --- a/macosx/JackMachSemaphore.cpp +++ b/macosx/JackMachSemaphore.cpp @@ -28,11 +28,11 @@ namespace Jack mach_port_t JackMachSemaphore::fBootPort = 0; -void JackMachSemaphore::BuildName(const char* client_name, const char* server_name, char* res) +void JackMachSemaphore::BuildName(const char* client_name, const char* server_name, char* res, int size) { char ext_client_name[JACK_CLIENT_NAME_SIZE + 1]; JackTools::RewriteName(client_name, ext_client_name); - sprintf(res, "jack_mach_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name); + snprintf(res, size, "jack_mach_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name); } bool JackMachSemaphore::Signal() @@ -105,7 +105,7 @@ bool JackMachSemaphore::TimedWait(long usec) // Server side : publish the semaphore in the global namespace bool JackMachSemaphore::Allocate(const char* name, const char* server_name, int value) { - BuildName(name, server_name, fName); + BuildName(name, server_name, fName, sizeof(fName)); mach_port_t task = mach_task_self(); kern_return_t res; @@ -149,7 +149,7 @@ bool JackMachSemaphore::Allocate(const char* name, const char* server_name, int // Client side : get the published semaphore from server bool JackMachSemaphore::ConnectInput(const char* name, const char* server_name) { - BuildName(name, server_name, fName); + BuildName(name, server_name, fName, sizeof(fName)); kern_return_t res; // Temporary... A REVOIR diff --git a/macosx/JackMachSemaphore.h b/macosx/JackMachSemaphore.h index e87f0c5c..f0968126 100644 --- a/macosx/JackMachSemaphore.h +++ b/macosx/JackMachSemaphore.h @@ -12,7 +12,7 @@ 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 +along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -43,7 +43,7 @@ class SERVER_EXPORT JackMachSemaphore : public detail::JackSynchro protected: - void BuildName(const char* name, const char* server_name, char* res); + void BuildName(const char* name, const char* server_name, char* res, int size); public: diff --git a/macosx/coremidi/JackCoreMidiOutputPort.cpp b/macosx/coremidi/JackCoreMidiOutputPort.cpp index 9a66b88d..c8d54328 100644 --- a/macosx/coremidi/JackCoreMidiOutputPort.cpp +++ b/macosx/coremidi/JackCoreMidiOutputPort.cpp @@ -40,7 +40,7 @@ JackCoreMidiOutputPort::JackCoreMidiOutputPort(double time_ratio, std::auto_ptr thread_queue_ptr(thread_queue); thread = new JackThread(this); std::auto_ptr thread_ptr(thread); - sprintf(semaphore_name, "coremidi_%p", this); + snprintf(semaphore_name, sizeof(semaphore_name), "coremidi_%p", this); thread_queue_semaphore = sem_open(semaphore_name, O_CREAT, 0777, 0); if (thread_queue_semaphore == (sem_t *) SEM_FAILED) { throw std::runtime_error(strerror(errno)); diff --git a/posix/JackPosixSemaphore.cpp b/posix/JackPosixSemaphore.cpp index 91e9d601..2c3377ad 100644 --- a/posix/JackPosixSemaphore.cpp +++ b/posix/JackPosixSemaphore.cpp @@ -28,11 +28,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace Jack { -void JackPosixSemaphore::BuildName(const char* client_name, const char* server_name, char* res) +void JackPosixSemaphore::BuildName(const char* client_name, const char* server_name, char* res, int size) { char ext_client_name[JACK_CLIENT_NAME_SIZE + 1]; JackTools::RewriteName(client_name, ext_client_name); - sprintf(res, "jack_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name); + snprintf(res, size, "jack_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name); } bool JackPosixSemaphore::Signal() @@ -140,7 +140,7 @@ bool JackPosixSemaphore::TimedWait(long usec) // Server side : publish the semaphore in the global namespace bool JackPosixSemaphore::Allocate(const char* name, const char* server_name, int value) { - BuildName(name, server_name, fName); + BuildName(name, server_name, fName, sizeof(fName)); jack_log("JackPosixSemaphore::Allocate name = %s val = %ld", fName, value); if ((fSemaphore = sem_open(fName, O_CREAT, 0777, value)) == (sem_t*)SEM_FAILED) { @@ -154,7 +154,7 @@ bool JackPosixSemaphore::Allocate(const char* name, const char* server_name, int // Client side : get the published semaphore from server bool JackPosixSemaphore::ConnectInput(const char* name, const char* server_name) { - BuildName(name, server_name, fName); + BuildName(name, server_name, fName, sizeof(fName)); jack_log("JackPosixSemaphore::Connect name = %s", fName); // Temporary... diff --git a/posix/JackPosixSemaphore.h b/posix/JackPosixSemaphore.h index 226db2a1..94f4d60f 100644 --- a/posix/JackPosixSemaphore.h +++ b/posix/JackPosixSemaphore.h @@ -12,7 +12,7 @@ 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 +along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -42,7 +42,7 @@ class SERVER_EXPORT JackPosixSemaphore : public detail::JackSynchro protected: - void BuildName(const char* name, const char* server_name, char* res); + void BuildName(const char* name, const char* server_name, char* res, int size); public: diff --git a/windows/JackWinEvent.cpp b/windows/JackWinEvent.cpp index be5ff65d..9c04465c 100644 --- a/windows/JackWinEvent.cpp +++ b/windows/JackWinEvent.cpp @@ -1,20 +1,20 @@ /* Copyright (C) 2004-2008 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. - + */ @@ -29,9 +29,9 @@ namespace Jack { -void JackWinEvent::BuildName(const char* name, const char* server_name, char* res) +void JackWinEvent::BuildName(const char* name, const char* server_name, char* res, int size) { - sprintf(res, "jack_pipe.%s_%s", server_name, name); + snprintf(res, size, "jack_pipe.%s_%s", server_name, name); } bool JackWinEvent::Signal() @@ -89,7 +89,7 @@ bool JackWinEvent::TimedWait(long usec) // Client side : get the published semaphore from server bool JackWinEvent::ConnectInput(const char* name, const char* server_name) { - BuildName(name, server_name, fName); + BuildName(name, server_name, fName, sizeof(fName)); jack_log("JackWinEvent::Connect %s", fName); // Temporary... @@ -130,7 +130,7 @@ bool JackWinEvent::Disconnect() bool JackWinEvent::Allocate(const char* name, const char* server_name, int value) { - BuildName(name, server_name, fName); + BuildName(name, server_name, fName, sizeof(fName)); jack_log("JackWinEvent::Allocate name = %s val = %ld", fName, value); /* create an auto reset event */ diff --git a/windows/JackWinEvent.h b/windows/JackWinEvent.h index 379c4c63..dadda1c4 100644 --- a/windows/JackWinEvent.h +++ b/windows/JackWinEvent.h @@ -1,20 +1,20 @@ /* Copyright (C) 2004-2008 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 __JackWinEvent__ @@ -41,7 +41,7 @@ class JackWinEvent : public JackSynchro protected: - void BuildName(const char* name, const char* server_name, char* res); + void BuildName(const char* name, const char* server_name, char* res, int size); public: diff --git a/windows/JackWinNamedPipe.cpp b/windows/JackWinNamedPipe.cpp index 9d067cd2..eb7ccc8d 100644 --- a/windows/JackWinNamedPipe.cpp +++ b/windows/JackWinNamedPipe.cpp @@ -1,20 +1,20 @@ /* Copyright (C) 2004-2008 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. - + */ @@ -54,7 +54,7 @@ int JackWinNamedPipe::Write(void* data, int len) int JackWinNamedPipeClient::Connect(const char* dir, int which) { - sprintf(fName, "\\\\.\\pipe\\%s_jack_%d", dir, which); + snprintf(fName, sizeof(fName), "\\\\.\\pipe\\%s_jack_%d", dir, which); jack_log("Connect: fName %s", fName); fNamedPipe = CreateFile(fName, // pipe name @@ -76,7 +76,7 @@ int JackWinNamedPipeClient::Connect(const char* dir, int which) int JackWinNamedPipeClient::Connect(const char* dir, const char* name, int which) { - sprintf(fName, "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which); + snprintf(fName, sizeof(fName), "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which); jack_log("Connect: fName %s", fName); fNamedPipe = CreateFile(fName, // pipe name @@ -226,7 +226,7 @@ int JackWinAsyncNamedPipeClient::Write(void* data, int len) int JackWinNamedPipeServer::Bind(const char* dir, int which) { - sprintf(fName, "\\\\.\\pipe\\%s_jack_%d", dir, which); + snprintf(fName, sizeof(fName), "\\\\.\\pipe\\%s_jack_%d", dir, which); jack_log("Bind: fName %s", fName); if ((fNamedPipe = CreateNamedPipe(fName, @@ -248,7 +248,7 @@ int JackWinNamedPipeServer::Bind(const char* dir, int which) int JackWinNamedPipeServer::Bind(const char* dir, const char* name, int which) { - sprintf(fName, "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which); + snprintf(fName, sizeof(fName), "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which); jack_log("Bind: fName %s", fName); if ((fNamedPipe = CreateNamedPipe(fName, @@ -322,7 +322,7 @@ int JackWinNamedPipeServer::Close() int JackWinAsyncNamedPipeServer::Bind(const char* dir, int which) { - sprintf(fName, "\\\\.\\pipe\\%s_jack_%d", dir, which); + snprintf(fName, sizeof(fName), "\\\\.\\pipe\\%s_jack_%d", dir, which); jack_log("Bind: fName %s", fName); if ((fNamedPipe = CreateNamedPipe(fName, @@ -344,7 +344,7 @@ int JackWinAsyncNamedPipeServer::Bind(const char* dir, int which) int JackWinAsyncNamedPipeServer::Bind(const char* dir, const char* name, int which) { - sprintf(fName, "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which); + snprintf(fName, sizeof(fName), "\\\\.\\pipe\\%s_jack_%s_%d", dir, name, which); jack_log("Bind: fName %s", fName); if ((fNamedPipe = CreateNamedPipe(fName, diff --git a/windows/JackWinSemaphore.cpp b/windows/JackWinSemaphore.cpp index 4500b10b..5ca4b047 100644 --- a/windows/JackWinSemaphore.cpp +++ b/windows/JackWinSemaphore.cpp @@ -1,20 +1,20 @@ /* Copyright (C) 2004-2008 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. - + */ #include "JackWinSemaphore.h" @@ -26,11 +26,11 @@ namespace Jack { -void JackWinSemaphore::BuildName(const char* client_name, const char* server_name, char* res) +void JackWinSemaphore::BuildName(const char* client_name, const char* server_name, char* res, int size) { char ext_client_name[JACK_CLIENT_NAME_SIZE + 1]; JackTools::RewriteName(client_name, ext_client_name); - sprintf(res, "jack_pipe.%s_%s", server_name, ext_client_name); + snprintf(res, size, "jack_pipe.%s_%s", server_name, ext_client_name); } bool JackWinSemaphore::Signal() @@ -88,7 +88,7 @@ bool JackWinSemaphore::TimedWait(long usec) // Client side : get the published semaphore from server bool JackWinSemaphore::ConnectInput(const char* name, const char* server_name) { - BuildName(name, server_name, fName); + BuildName(name, server_name, fName, sizeof(fName)); jack_log("JackWinSemaphore::Connect %s", fName); // Temporary... @@ -129,7 +129,7 @@ bool JackWinSemaphore::Disconnect() bool JackWinSemaphore::Allocate(const char* name, const char* server_name, int value) { - BuildName(name, server_name, fName); + BuildName(name, server_name, fName, sizeof(fName)); jack_log("JackWinSemaphore::Allocate name = %s val = %ld", fName, value); if ((fSemaphore = CreateSemaphore(NULL, value, 32767, fName)) == NULL) { @@ -137,7 +137,7 @@ bool JackWinSemaphore::Allocate(const char* name, const char* server_name, int v return false; } else if (GetLastError() == ERROR_ALREADY_EXISTS) { jack_error("Allocate: named semaphore already exist name = %s", fName); - // Try to open it + // Try to open it fSemaphore = OpenSemaphore(SEMAPHORE_ALL_ACCESS, FALSE, fName); return (fSemaphore != NULL); } else { diff --git a/windows/JackWinSemaphore.h b/windows/JackWinSemaphore.h index 04779699..c3871c9a 100644 --- a/windows/JackWinSemaphore.h +++ b/windows/JackWinSemaphore.h @@ -1,20 +1,20 @@ /* Copyright (C) 2004-2008 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. - + */ @@ -41,7 +41,7 @@ class JackWinSemaphore : public detail::JackSynchro protected: - void BuildName(const char* name, const char* server_name, char* res); + void BuildName(const char* name, const char* server_name, char* res, int size); public: