Merge authors: poy (poy) ------------------------------------------------------------ revno: 13 [merge] committer: poy <p...@123gen.com> branch nick: ExamplePlugin timestamp: Sun 2013-03-03 20:30:06 +0100 message: merge modified: pluginsdk/PluginDefs.h src/Dialog.c
-- lp:~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin. To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin/+edit-subscription
=== modified file 'pluginsdk/PluginDefs.h' --- pluginsdk/PluginDefs.h 2013-01-29 18:13:20 +0000 +++ pluginsdk/PluginDefs.h 2013-03-03 19:23:58 +0000 @@ -74,7 +74,7 @@ #define DCINTF_DCPP_QUEUE_VER 2 #define DCINTF_DCPP_UTILS "dcpp.utils.DCUtils" /* Utility and convenience functions */ -#define DCINTF_DCPP_UTILS_VER 1 +#define DCINTF_DCPP_UTILS_VER 2 #define DCINTF_DCPP_TAGGER "dcpp.xml.DCTagger" /* Manipulation of an XML tagger */ #define DCINTF_DCPP_TAGGER_VER 2 @@ -409,6 +409,8 @@ /* Utility API version */ uint32_t apiVersion; + /* These functions attempt a conversion; they return the required buffer size. */ + size_t (DCAPI *to_utf8) (char* dst, const char* src, size_t n); size_t (DCAPI *from_utf8) (char* dst, const char* src, size_t n); === modified file 'src/Dialog.c' --- src/Dialog.c 2013-01-29 18:21:57 +0000 +++ src/Dialog.c 2013-03-03 19:30:06 +0000 @@ -40,8 +40,13 @@ char* value = get_cfg("SendSuffix"); size_t len = strlen(value) + 1; TCHAR* buf = (TCHAR*)memset(malloc(len * sizeof(TCHAR)), 0, len * sizeof(TCHAR)); - - utils->utf8_to_wcs(buf, value, len); + size_t convLen; + + convLen = utils->utf8_to_wcs(buf, value, len); + if(convLen > len) { + /* TODO extend alloc */ + } + free(value); value = NULL; @@ -57,9 +62,15 @@ int len = GetWindowTextLength(GetDlgItem(hWnd, IDC_SUFFIX)) + 1; TCHAR* wbuf = (TCHAR*)memset(malloc(len * sizeof(TCHAR)), 0, len * sizeof(TCHAR)); char* value = (char*)memset(malloc(len), 0, len); + size_t convLen; GetWindowText(GetDlgItem(hWnd, IDC_SUFFIX), wbuf, len); - utils->wcs_to_utf8(value, wbuf, len); + + convLen = utils->wcs_to_utf8(value, wbuf, len); + if(convLen > len) { + /* TODO extend alloc */ + } + set_cfg("SendSuffix", value); free(value);
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp