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 */
+ }
}
}
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;
+ }
}
}
{
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;
}
}
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;
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;
}
char* base;
size_t blen;
- if (strstr (dllpath, ".so" ) == NULL) {
- return NULL;
+ if (strstr (dllpath, ".so" ) == 0) {
+ return 0;
}
if (personal) {
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);
g_free (path);
- return NULL;
+ return 0;
}
}
}
- return NULL;
+ return 0;
}
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) {
if (!g_file_test (dir_path, G_FILE_TEST_IS_DIR)) {
if (g_mkdir (dir_path, 0700)) {
- return NULL;
+ return 0;
}
}
{
FILE* f;
- if ((f = vstfx_infofile_create (dllpath, 0)) == NULL) {
+ if ((f = vstfx_infofile_create (dllpath, 0)) == 0) {
f = vstfx_infofile_create (dllpath, 1);
}
{
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)
{
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;
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);
}
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);
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);