summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/audio_clock.cc4
-rw-r--r--gtk2_ardour/led.cc2
-rw-r--r--libs/ardour/audiosource.cc10
-rwxr-xr-xlibs/ardour/lxvst_plugin.cc4
-rwxr-xr-xlibs/ardour/vstfxinfofile.cc87
5 files changed, 57 insertions, 50 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index 2e7826ef6c..47f17e5f4e 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -1681,7 +1681,7 @@ AudioClock::timecode_validate_edit (const string& str)
return false;
}
- if (TC.minutes > 59 || TC.seconds > 59) {
+ if (TC.minutes > 59U || TC.seconds > 59U) {
return false;
}
@@ -1690,7 +1690,7 @@ AudioClock::timecode_validate_edit (const string& str)
}
if (_session->timecode_drop_frames()) {
- if (TC.minutes % 10 && TC.seconds == 0 && TC.frames < 2) {
+ if (TC.minutes % 10 && TC.seconds == 0U && TC.frames < 2U) {
return false;
}
}
diff --git a/gtk2_ardour/led.cc b/gtk2_ardour/led.cc
index 474ffe508b..83fdc3e46c 100644
--- a/gtk2_ardour/led.cc
+++ b/gtk2_ardour/led.cc
@@ -146,7 +146,7 @@ LED::set_colors_from_style ()
Color c;
switch (_visual_state) {
- case 0:
+ case VisualState(0):
c = style->get_fg (STATE_NORMAL);
break;
default:
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index e9e7228421..3a84af58b5 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -881,8 +881,9 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
off_t target_length = blocksize * ((first_peak_byte + blocksize + 1) / blocksize);
if (endpos < target_length) {
- (void) ftruncate (_peakfile_fd, target_length);
- /* error doesn't actually matter though, so continue on without testing */
+ if (ftruncate (_peakfile_fd, target_length)) {
+ /* error doesn't actually matter so continue on without testing */
+ }
}
}
@@ -924,7 +925,10 @@ AudioSource::truncate_peakfile ()
off_t end = lseek (_peakfile_fd, 0, SEEK_END);
if (end > _peak_byte_max) {
- (void) ftruncate (_peakfile_fd, _peak_byte_max);
+ if (ftruncate (_peakfile_fd, _peak_byte_max)) {
+ error << string_compose (_("could not truncate peakfile %1 to %2 (error: %3)"),
+ peakpath, _peak_byte_max, errno) << endmsg;
+ }
}
}
diff --git a/libs/ardour/lxvst_plugin.cc b/libs/ardour/lxvst_plugin.cc
index 21bfdb42f5..7202134b77 100755
--- a/libs/ardour/lxvst_plugin.cc
+++ b/libs/ardour/lxvst_plugin.cc
@@ -344,8 +344,12 @@ LXVSTPlugin::load_plugin_preset (PresetRecord r)
/* Extract the index of this preset from the URI */
int id;
int index;
+#ifndef NDEBUG
int const p = sscanf (r.uri.c_str(), "VST:%d:%d", &id, &index);
assert (p == 2);
+#else
+ sscanf (r.uri.c_str(), "VST:%d:%d", &id, &index);
+#endif
_vstfx->want_program = index;
return true;
diff --git a/libs/ardour/vstfxinfofile.cc b/libs/ardour/vstfxinfofile.cc
index c81e0636c2..f98361fa18 100755
--- a/libs/ardour/vstfxinfofile.cc
+++ b/libs/ardour/vstfxinfofile.cc
@@ -28,18 +28,17 @@ static char* read_string(FILE *fp)
{
char buf[MAX_STRING_LEN];
- fgets( buf, MAX_STRING_LEN, fp );
-
- if(strlen(buf) < MAX_STRING_LEN)
- {
- if(strlen(buf))
- buf[strlen(buf)-1] = 0;
-
- return strdup(buf);
+ if (!fgets( buf, MAX_STRING_LEN, fp )) {
+ return 0;
}
- else
- {
- return NULL;
+
+ if(strlen(buf) < MAX_STRING_LEN) {
+ if (strlen(buf)) {
+ buf[strlen(buf)-1] = 0;
+ }
+ return strdup(buf);
+ } else {
+ return 0;
}
}
@@ -48,14 +47,14 @@ static VSTFXInfo* load_vstfx_info_file(FILE* fp)
VSTFXInfo *info;
int i;
- if ((info = (VSTFXInfo*) malloc(sizeof(VSTFXInfo))) == NULL) {
- return NULL;
+ if ((info = (VSTFXInfo*) malloc(sizeof(VSTFXInfo))) == 0) {
+ return 0;
}
- if((info->name = read_string(fp)) == NULL) goto error;
- if((info->creator = read_string(fp)) == NULL) goto error;
+ if((info->name = read_string(fp)) == 0) goto error;
+ if((info->creator = read_string(fp)) == 0) goto error;
if(1 != fscanf(fp, "%d\n", &info->UniqueID)) goto error;
- if((info->Category = read_string(fp)) == NULL) goto error;
+ if((info->Category = read_string(fp)) == 0) goto error;
if(1 != fscanf(fp, "%d\n", &info->numInputs)) goto error;
if(1 != fscanf(fp, "%d\n", &info->numOutputs)) goto error;
if(1 != fscanf(fp, "%d\n", &info->numParams)) goto error;
@@ -63,40 +62,40 @@ static VSTFXInfo* load_vstfx_info_file(FILE* fp)
if(1 != fscanf(fp, "%d\n", &info->hasEditor)) goto error;
if(1 != fscanf(fp, "%d\n", &info->canProcessReplacing)) goto error;
- if((info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams)) == NULL) {
+ if((info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams)) == 0) {
goto error;
}
for (i=0; i<info->numParams; i++) {
- if((info->ParamNames[i] = read_string(fp)) == NULL) goto error;
+ if((info->ParamNames[i] = read_string(fp)) == 0) goto error;
}
- if ((info->ParamLabels = (char **) malloc(sizeof(char*)*info->numParams)) == NULL) {
+ if ((info->ParamLabels = (char **) malloc(sizeof(char*)*info->numParams)) == 0) {
goto error;
}
for (i=0; i < info->numParams; i++) {
- if((info->ParamLabels[i] = read_string(fp)) == NULL) goto error;
+ if((info->ParamLabels[i] = read_string(fp)) == 0) goto error;
}
return info;
error:
free( info );
- return NULL;
+ return 0;
}
static int save_vstfx_info_file(VSTFXInfo *info, FILE* fp)
{
int i;
- if (info == NULL) {
- vstfx_error("** ERROR ** VSTFXinfofile : info ptr is NULL\n");
+ if (info == 0) {
+ vstfx_error("** ERROR ** VSTFXinfofile : info ptr is 0\n");
return -1;
}
- if (fp == NULL) {
- vstfx_error("** ERROR ** VSTFXinfofile : file ptr is NULL\n");
+ if (fp == 0) {
+ vstfx_error("** ERROR ** VSTFXinfofile : file ptr is 0\n");
return -1;
}
@@ -130,8 +129,8 @@ static char* vstfx_infofile_stat (char *dllpath, struct stat* statbuf, int perso
char* base;
size_t blen;
- if (strstr (dllpath, ".so" ) == NULL) {
- return NULL;
+ if (strstr (dllpath, ".so" ) == 0) {
+ return 0;
}
if (personal) {
@@ -145,9 +144,9 @@ static char* vstfx_infofile_stat (char *dllpath, struct stat* statbuf, int perso
basename = (char*) g_malloc (blen);
snprintf (basename, blen, ".%s.fsi", base);
g_free (base);
-
+
path = g_build_filename (dir_path, basename, NULL);
-
+
g_free (dir_path);
g_free (basename);
@@ -173,7 +172,7 @@ static char* vstfx_infofile_stat (char *dllpath, struct stat* statbuf, int perso
g_free (path);
- return NULL;
+ return 0;
}
@@ -198,7 +197,7 @@ static FILE* vstfx_infofile_for_read (char* dllpath)
}
}
- return NULL;
+ return 0;
}
static FILE* vstfx_infofile_create (char* dllpath, int personal)
@@ -209,8 +208,8 @@ static FILE* vstfx_infofile_create (char* dllpath, int personal)
char* base;
size_t blen;
- if (strstr (dllpath, ".so" ) == NULL) {
- return NULL;
+ if (strstr (dllpath, ".so" ) == 0) {
+ return 0;
}
if (personal) {
@@ -220,7 +219,7 @@ static FILE* vstfx_infofile_create (char* dllpath, int personal)
if (!g_file_test (dir_path, G_FILE_TEST_IS_DIR)) {
if (g_mkdir (dir_path, 0700)) {
- return NULL;
+ return 0;
}
}
@@ -249,7 +248,7 @@ static FILE* vstfx_infofile_for_write (char* dllpath)
{
FILE* f;
- if ((f = vstfx_infofile_create (dllpath, 0)) == NULL) {
+ if ((f = vstfx_infofile_create (dllpath, 0)) == 0) {
f = vstfx_infofile_create (dllpath, 1);
}
@@ -260,7 +259,7 @@ static int vstfx_can_midi(VSTFX *vstfx)
{
struct AEffect *plugin = vstfx->plugin;
- int vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0.0f);
+ int vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
if (vst_version >= 2)
{
@@ -288,12 +287,12 @@ static VSTFXInfo* vstfx_info_from_plugin(VSTFX *vstfx)
if(!vstfx)
{
- vstfx_error( "** ERROR ** VSTFXinfofile : vstfx ptr is NULL\n" );
- return NULL;
+ vstfx_error( "** ERROR ** VSTFXinfofile : vstfx ptr is 0\n" );
+ return 0;
}
if(!info)
- return NULL;
+ return 0;
plugin = vstfx->plugin;
@@ -366,7 +365,7 @@ VSTFXInfo *vstfx_get_info(char *dllpath)
VSTFX *vstfx;
VSTFXInfo *info;
- if ((infofile = vstfx_infofile_for_read (dllpath)) != NULL) {
+ if ((infofile = vstfx_infofile_for_read (dllpath)) != 0) {
VSTFXInfo *info;
info = load_vstfx_info_file (infofile);
fclose (infofile);
@@ -374,12 +373,12 @@ VSTFXInfo *vstfx_get_info(char *dllpath)
}
if(!(h = vstfx_load(dllpath)))
- return NULL;
+ return 0;
- if(!(vstfx = vstfx_instantiate(h, simple_master_callback, NULL))) {
+ if(!(vstfx = vstfx_instantiate(h, simple_master_callback, 0))) {
vstfx_unload(h);
vstfx_error( "** ERROR ** VSTFXinfofile : Instantiate failed\n" );
- return NULL;
+ return 0;
}
infofile = vstfx_infofile_for_write (dllpath);
@@ -388,7 +387,7 @@ VSTFXInfo *vstfx_get_info(char *dllpath)
vstfx_close(vstfx);
vstfx_unload(h);
vstfx_error("cannot create new FST info file for plugin");
- return NULL;
+ return 0;
}
info = vstfx_info_from_plugin(vstfx);