← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-c/trunk] Rev 24: update defs

 

------------------------------------------------------------
revno: 24
committer: poy <poy@xxxxxxxxxx>
branch nick: dcpp-plugin-sdk-c
timestamp: Sun 2013-06-02 19:37:12 +0200
message:
  update defs
modified:
  pluginsdk/Config.c
  pluginsdk/Config.h
  pluginsdk/PluginDefs.h


--
lp:dcpp-plugin-sdk-c
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcpp-plugin-sdk-c.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/trunk/+edit-subscription
=== modified file 'pluginsdk/Config.c'
--- pluginsdk/Config.c	2013-04-23 18:11:29 +0000
+++ pluginsdk/Config.c	2013-06-02 17:37:12 +0000
@@ -99,7 +99,16 @@
 ConfigValuePtr DCAPI get_core_cfg(const char* name) { return config->get_cfg("CoreSetup", name, CFG_TYPE_UNKNOWN); }
 void DCAPI free_core_cfg(ConfigValuePtr val) { config->release(val); }
 
-const char* DCAPI get_cfg_path(PathType path) { return config->get_path(path); }
+char* DCAPI get_cfg_path(PathType path) {
+	ConfigStrPtr val = config->get_path(path);
+	size_t len = strlen(val->value) + 1;
+	char* value = (char*)memset(malloc(len), 0, len);
+
+	strncpy(value, val->value, len);
+	config->release((ConfigValuePtr)val);
+
+	return value;
+}
 
 char* DCAPI get_install_path() {
 	ConfigStrPtr val = config->get_install_path(guid);

=== modified file 'pluginsdk/Config.h'
--- pluginsdk/Config.h	2013-04-23 18:11:29 +0000
+++ pluginsdk/Config.h	2013-06-02 17:37:12 +0000
@@ -37,8 +37,7 @@
 ConfigValuePtr DCAPI get_core_cfg(const char* name);
 void DCAPI free_core_cfg(ConfigValuePtr val);
 
-const char* DCAPI get_cfg_path(PathType path);
-
+char* DCAPI get_cfg_path(PathType path);
 char* DCAPI get_install_path();
 
 #endif

=== modified file 'pluginsdk/PluginDefs.h'
--- pluginsdk/PluginDefs.h	2013-06-02 11:49:14 +0000
+++ pluginsdk/PluginDefs.h	2013-06-02 17:37:12 +0000
@@ -338,7 +338,7 @@
 	/* Config API version */
 	uint32_t apiVersion;
 
-	const char*			(DCAPI *get_path)			(PathType type);
+	ConfigStrPtr		(DCAPI *get_path)			(PathType type);
 	ConfigStrPtr		(DCAPI *get_install_path)	(const char* guid);
 
 	void				(DCAPI *set_cfg)			(const char* guid, const char* setting, ConfigValuePtr val);