Browse Source

Fix errors found by cppcheck.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3947 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.6
sletz 11 years ago
parent
commit
85a525d60b
11 changed files with 34 additions and 27 deletions
  1. +3
    -3
      common/JackTools.cpp
  2. +5
    -5
      example-clients/internal_metro.cpp
  3. +1
    -0
      example-clients/internal_metro.h
  4. +5
    -1
      example-clients/metro.c
  5. +1
    -1
      linux/firewire/JackFFADODriver.cpp
  6. +4
    -4
      macosx/coreaudio/JackCoreAudioDriver.cpp
  7. +4
    -4
      solaris/oss/JackBoomerDriver.cpp
  8. +4
    -4
      solaris/oss/JackOSSDriver.cpp
  9. +2
    -1
      tests/external_metro.cpp
  10. +1
    -0
      tests/external_metro.h
  11. +4
    -4
      windows/portaudio/JackPortAudioDriver.cpp

+ 3
- 3
common/JackTools.cpp View File

@@ -194,7 +194,7 @@ namespace Jack {
}

if (fgets(buf, sizeof(buf), in) == NULL) {
fclose(in);
pclose(in);
return -1;
}

@@ -202,7 +202,7 @@ namespace Jack {

if (buf[len - 1] != '\n') {
/* didn't get a whole line */
fclose(in);
pclose(in);
return -1;
}

@@ -210,7 +210,7 @@ namespace Jack {
memcpy(jack_tmpdir, buf, len - 1);
jack_tmpdir[len - 1] = '\0';

fclose(in);
pclose(in);
return 0;
}
#endif


+ 5
- 5
example-clients/internal_metro.cpp View File

@@ -46,7 +46,6 @@ InternalMetro::InternalMetro(int freq, double max_amp, int dur_arg, int bpm, cha
{
sample_t scale;
int i, attack_length, decay_length;
double *amp;
int attack_percent = 1, decay_percent = 10;
const char *bpm_string = "bpm";

@@ -59,7 +58,7 @@ InternalMetro::InternalMetro(int freq, double max_amp, int dur_arg, int bpm, cha
}
if ((client = jack_client_open (client_name, JackNullOption, NULL)) == 0) {
fprintf (stderr, "jack server not running?\n");
return ;
return;
}

jack_set_process_callback (client, process_audio, this);
@@ -81,11 +80,11 @@ InternalMetro::InternalMetro(int freq, double max_amp, int dur_arg, int bpm, cha
", wave length = %" PRIu32 "\n", tone_length,
wave_length);
*/
return ;
return;
}
if (attack_length + decay_length > (int)tone_length) {
fprintf (stderr, "invalid attack/decay\n");
return ;
return;
}

/* Build the wave table */
@@ -110,7 +109,6 @@ InternalMetro::InternalMetro(int freq, double max_amp, int dur_arg, int bpm, cha

if (jack_activate (client)) {
fprintf(stderr, "cannot activate client");
return;
}
}

@@ -120,4 +118,6 @@ InternalMetro::~InternalMetro()
jack_port_unregister(client, input_port);
jack_port_unregister(client, output_port);
jack_client_close(client);
free(amp);
free(wave);
}

+ 1
- 0
example-clients/internal_metro.h View File

@@ -53,6 +53,7 @@ extern "C"
int bpm;
jack_nframes_t tone_length, wave_length;
sample_t *wave;
double *amp;
long offset ;

InternalMetro(int freq, double max_amp, int dur_arg, int bpm, char* client_name);


+ 5
- 1
example-clients/metro.c View File

@@ -257,7 +257,7 @@ main (int argc, char *argv[])

if (jack_activate (client)) {
fprintf (stderr, "cannot activate client\n");
return 1;
goto error;
}
/* install a signal handler to properly quits jack client */
@@ -282,5 +282,9 @@ main (int argc, char *argv[])
};
jack_client_close(client);
error:
free(amp);
free(wave);
exit (0);
}

+ 1
- 1
linux/firewire/JackFFADODriver.cpp View File

@@ -881,7 +881,7 @@ extern "C"

switch (param->character) {
case 'd':
device_name = strdup (param->value.str);
device_name = param->value.str;
break;
case 'p':
cmlparams.period_size = param->value.ui;


+ 4
- 4
macosx/coreaudio/JackCoreAudioDriver.cpp View File

@@ -2002,8 +2002,8 @@ extern "C"
switch (param->character) {

case 'd':
capture_driver_uid = strdup(param->value.str);
playback_driver_uid = strdup(param->value.str);
capture_driver_uid = param->value.str;
playback_driver_uid = param->value.str;
break;

case 'D':
@@ -2026,14 +2026,14 @@ extern "C"
case 'C':
capture = true;
if (strcmp(param->value.str, "none") != 0) {
capture_driver_uid = strdup(param->value.str);
capture_driver_uid = param->value.str;
}
break;

case 'P':
playback = true;
if (strcmp(param->value.str, "none") != 0) {
playback_driver_uid = strdup(param->value.str);
playback_driver_uid = param->value.str;
}
break;



+ 4
- 4
solaris/oss/JackBoomerDriver.cpp View File

@@ -985,20 +985,20 @@ EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine
case 'C':
capture = true;
if (strcmp(param->value.str, "none") != 0) {
capture_pcm_name = strdup(param->value.str);
capture_pcm_name = param->value.str;
}
break;

case 'P':
playback = true;
if (strcmp(param->value.str, "none") != 0) {
playback_pcm_name = strdup(param->value.str);
playback_pcm_name = param->value.str;
}
break;

case 'd':
playback_pcm_name = strdup (param->value.str);
capture_pcm_name = strdup (param->value.str);
playback_pcm_name = param->value.str;
capture_pcm_name = param->value.str;
break;
case 'e':


+ 4
- 4
solaris/oss/JackOSSDriver.cpp View File

@@ -904,20 +904,20 @@ EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine
case 'C':
capture = true;
if (strcmp(param->value.str, "none") != 0) {
capture_pcm_name = strdup(param->value.str);
capture_pcm_name = param->value.str;
}
break;

case 'P':
playback = true;
if (strcmp(param->value.str, "none") != 0) {
playback_pcm_name = strdup(param->value.str);
playback_pcm_name = param->value.str;
}
break;

case 'd':
playback_pcm_name = strdup (param->value.str);
capture_pcm_name = strdup (param->value.str);
playback_pcm_name = param->value.str;
capture_pcm_name = param->value.str;
break;
case 'b':


+ 2
- 1
tests/external_metro.cpp View File

@@ -60,7 +60,6 @@ ExternalMetro::ExternalMetro(int freq, double max_amp, int dur_arg, int bpm, con
{
sample_t scale;
int i, attack_length, decay_length;
double *amp;
int attack_percent = 1, decay_percent = 10;
const char *bpm_string = "bpm";
jack_options_t options = JackNullOption;
@@ -131,6 +130,8 @@ ExternalMetro::~ExternalMetro()
jack_port_unregister(client, input_port);
jack_port_unregister(client, output_port);
jack_client_close(client);
free(amp);
free(wave);
}

int main (int argc, char *argv[])


+ 1
- 0
tests/external_metro.h View File

@@ -53,6 +53,7 @@ extern "C"
int bpm;
jack_nframes_t tone_length, wave_length;
sample_t *wave;
double *amp;
long offset ;

ExternalMetro(int freq, double max_amp, int dur_arg, int bpm, const char* client_name = "metro");


+ 4
- 4
windows/portaudio/JackPortAudioDriver.cpp View File

@@ -404,8 +404,8 @@ extern "C"
{

case 'd':
capture_pcm_name = strdup(param->value.str);
playback_pcm_name = strdup(param->value.str);
capture_pcm_name = param->value.str;
playback_pcm_name = param->value.str;
break;

case 'D':
@@ -428,14 +428,14 @@ extern "C"
case 'C':
capture = true;
if (strcmp(param->value.str, "none") != 0) {
capture_pcm_name = strdup(param->value.str);
capture_pcm_name = param->value.str;
}
break;

case 'P':
playback = TRUE;
if (strcmp(param->value.str, "none") != 0) {
playback_pcm_name = strdup(param->value.str);
playback_pcm_name = param->value.str;
}
break;



Loading…
Cancel
Save