[goffice] win32: fix cloning. I hope.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] win32: fix cloning. I hope.
- Date: Fri, 9 Apr 2010 02:19:00 +0000 (UTC)
commit e274df562fc305cad3df8a7c031f25eebe3982f7
Author: Morten Welinder <terra gnome org>
Date: Thu Apr 8 22:18:36 2010 -0400
win32: fix cloning. I hope.
ChangeLog | 5 +++++
NEWS | 1 +
goffice/app/go-conf-win32.c | 18 ++++++++++--------
3 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 98abf10..af21f04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-08 Morten Welinder <terra gnome org>
+
+ * goffice/app/go-conf-win32.c (go_conf_win32_clone_full): Handle
+ buffer expansion right.
+
2010-04-07 Valek Filippov <frob gnome org>
* tests/mf-demo.c: add 'Symbol' and 'MT Extra' support.
diff --git a/NEWS b/NEWS
index f2e9d30..cdc80d9 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Jean:
Morten:
* Implement conf notification in keyfile case. [#613523]
+ * Fix win32 configuration.
Valek:
* Fix distance calculation for arc, ellipse, polygon, polyline,
diff --git a/goffice/app/go-conf-win32.c b/goffice/app/go-conf-win32.c
index 6e617e5..39e819f 100644
--- a/goffice/app/go-conf-win32.c
+++ b/goffice/app/go-conf-win32.c
@@ -165,7 +165,8 @@ static const size_t WIN32_INIT_VALUE_DATA_LEN = 2048;
static void
go_conf_win32_clone_full (HKEY hSrcKey, const gchar *key, HKEY hDstKey,
- gchar *subkey, gchar *value_name, gchar *data)
+ gchar *subkey, gchar *value_name,
+ GString *data)
{
gint i;
HKEY hSrcSK, hDstSK;
@@ -193,17 +194,18 @@ go_conf_win32_clone_full (HKEY hSrcKey, const gchar *key, HKEY hDstKey,
ret = ERROR_SUCCESS;
for (i = 0; ret == ERROR_SUCCESS; ++i) {
DWORD name_size = WIN32_MAX_REG_KEYNAME_LEN;
- DWORD data_size = WIN32_MAX_REG_VALUENAME_LEN;
+ DWORD data_size = data->len;
DWORD type;
while ((ret = RegEnumValue (hSrcSK, i, value_name, &name_size,
- NULL, &type, data, &data_size)) ==
+ NULL, &type,
+ data->str, &data_size)) ==
ERROR_MORE_DATA)
- /* FIXME: surely this doesn't work -- MW */
- data = g_realloc (data, data_size);
+ g_string_set_size (data, data_size);
if (ret != ERROR_SUCCESS)
continue;
- RegSetValueEx (hDstKey, value_name, 0, type, data, data_size);
+ RegSetValueEx (hDstKey, value_name, 0, type,
+ data->str, data_size);
}
RegCloseKey (hSrcSK);
@@ -214,10 +216,10 @@ go_conf_win32_clone (HKEY hSrcKey, const gchar *key, HKEY hDstKey)
{
char *subkey = g_malloc (WIN32_MAX_REG_KEYNAME_LEN);
char *value_name = g_malloc (WIN32_MAX_REG_VALUENAME_LEN);
- char *data = g_malloc (WIN32_INIT_VALUE_DATA_LEN);
+ GString *data = g_string_sized_new (WIN32_INIT_VALUE_DATA_LEN);
go_conf_win32_clone_full (hSrcKey, key, hDstKey,
subkey, value_name, data);
- g_free (data);
+ g_string_free (data, TRUE);
g_free (value_name);
g_free (subkey);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]