[BACK]Return to patch-adplugdb_adplugdb_cpp CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / audio / adplug / patches

File: [cvs.NetBSD.org] / pkgsrc / audio / adplug / patches / Attic / patch-adplugdb_adplugdb_cpp (download)

Revision 1.1, Sat Sep 3 23:40:47 2011 UTC (11 years, 3 months ago) by dholland
Branch: MAIN
CVS Tags: pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, pkgsrc-2015Q3-base, pkgsrc-2015Q3, pkgsrc-2015Q2-base, pkgsrc-2015Q2, pkgsrc-2015Q1-base, pkgsrc-2015Q1, pkgsrc-2014Q4-base, pkgsrc-2014Q4, pkgsrc-2014Q3-base, pkgsrc-2014Q3, pkgsrc-2014Q2-base, pkgsrc-2014Q2, pkgsrc-2014Q1-base, pkgsrc-2014Q1, pkgsrc-2013Q4-base, pkgsrc-2013Q4, pkgsrc-2013Q3-base, pkgsrc-2013Q3, pkgsrc-2013Q2-base, pkgsrc-2013Q2, pkgsrc-2013Q1-base, pkgsrc-2013Q1, pkgsrc-2012Q4-base, pkgsrc-2012Q4, pkgsrc-2012Q3-base, pkgsrc-2012Q3, pkgsrc-2012Q2-base, pkgsrc-2012Q2, pkgsrc-2012Q1-base, pkgsrc-2012Q1, pkgsrc-2011Q4-base, pkgsrc-2011Q4, pkgsrc-2011Q3-base, pkgsrc-2011Q3

const correctness, required by clang

$NetBSD: patch-adplugdb_adplugdb_cpp,v 1.1 2011/09/03 23:40:47 dholland Exp $

const correctness, required by clang

--- adplugdb/adplugdb.cpp.orig	2006-05-17 12:47:21.000000000 +0000
+++ adplugdb/adplugdb.cpp
@@ -99,13 +99,15 @@ static const struct {
 };
 
 static struct {
-  char				*db_file;
+  const char				*db_file;
+  char					*freeable_db_file;
   CAdPlugDatabase::CRecord::RecordType	rtype;
   int					message_level;
   bool					usedefaultdb, usercomment, cmdkeys;
   const char				*homedir;
 } cfg = {
   ADPLUGDB_PATH,
+  NULL,
   CAdPlugDatabase::CRecord::Plain,
   MSG_NOTE,
   false, false, false,
@@ -297,7 +299,7 @@ static void db_save(void)
 static void shutdown(void)
 {
   // Free userdb variable, if applicable
-  if(cfg.homedir && !cfg.usedefaultdb) free(cfg.db_file);
+  if(cfg.homedir && !cfg.usedefaultdb) free(cfg.freeable_db_file);
 }
 
 /***** Main program *****/
@@ -355,11 +357,14 @@ int main(int argc, char *argv[])
   // Try user's home directory first, before trying the default location.
   cfg.homedir = getenv("HOME");
   if(cfg.homedir && !cfg.usedefaultdb) {
-    cfg.db_file = (char *)malloc(strlen(cfg.homedir) + strlen(ADPLUG_CONFDIR) +
+    char *s;
+    s = (char *)malloc(strlen(cfg.homedir) + strlen(ADPLUG_CONFDIR) +
 			 					 strlen(ADPLUGDB_FILE) + 3);
-    strcpy(cfg.db_file, cfg.homedir);
-	strcat(cfg.db_file, "/" ADPLUG_CONFDIR "/");
-	strcat(cfg.db_file, ADPLUGDB_FILE);
+    strcpy(s, cfg.homedir);
+    strcat(s, "/" ADPLUG_CONFDIR "/");
+    strcat(s, ADPLUGDB_FILE);
+    cfg.freeable_db_file = s;
+    cfg.db_file = s;
   }
 
   // Load database file