fix merge with master
[ardour.git] / libs / ardour / linux_vst_info_file.cc
index 753c84a33ed80dfe09087d1c3b78c6fa8ae85da6..581bcca87fcb1e6423849c6d2def467170e74c6d 100644 (file)
@@ -1,3 +1,22 @@
+/*
+    Copyright (C) 2012 Paul Davis 
+
+    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
+    (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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
 /** @file libs/ardour/vst_info_file.cc
  *  @brief Code to manage info files containing cached information about a plugin.
  *  e.g. its name, creator etc.
@@ -49,7 +68,7 @@ read_string (FILE *fp)
 }
 
 /** Read an integer value from a line in fp into n,
- *  @return true on success, false on failure.
+ *  @return true on failure, false on success.
  */
 static bool
 read_int (FILE* fp, int* n)
@@ -58,7 +77,7 @@ read_int (FILE* fp, int* n)
 
        char* p = fgets (buf, MAX_STRING_LEN, fp);
        if (p == 0) {
-               return false;
+               return true;
        }
 
        return (sscanf (p, "%d", n) != 1);
@@ -150,7 +169,7 @@ vstfx_infofile_path (char* dllpath, int personal)
                }
                
        } else {
-               dir = Glib::path_get_dirname (dllpath);
+               dir = Glib::path_get_dirname (std::string(dllpath));
        }
 
        stringstream s;
@@ -195,6 +214,7 @@ vstfx_infofile_for_read (char* dllpath)
 {
        struct stat own_statbuf;
        struct stat sys_statbuf;
+       FILE *rv = NULL;
        
        char* own_info = vstfx_infofile_stat (dllpath, &own_statbuf, 1);
        char* sys_info = vstfx_infofile_stat (dllpath, &sys_statbuf, 0);
@@ -203,14 +223,16 @@ vstfx_infofile_for_read (char* dllpath)
                if (sys_info) {
                        if (own_statbuf.st_mtime <= sys_statbuf.st_mtime) {
                                /* system info file is newer, use it */
-                               return fopen (sys_info, "r");
+                               rv = g_fopen (sys_info, "rb");
                        }
                } else {
-                       return fopen (own_info, "r");
+                       rv = g_fopen (own_info, "rb");
                }
        }
+       free(own_info);
+       free(sys_info);
 
-       return 0;
+       return rv;
 }
 
 static FILE *
@@ -397,6 +419,8 @@ vstfx_free_info (VSTInfo *info)
        free (info->name);
        free (info->creator);
        free (info->Category);
+       free (info->ParamNames);
+       free (info->ParamLabels);
        free (info);
 }