gnucash master: Removed binary from kvpvalues
John Ralls
jralls at code.gnucash.org
Tue Sep 16 18:12:22 EDT 2014
Updated via https://github.com/Gnucash/gnucash/commit/d2913915 (commit)
from https://github.com/Gnucash/gnucash/commit/9bc5d1a2 (commit)
commit d2913915e62d6aa80559b67c6a603fe2661d8464
Author: lmat <dartme18 at gmail.com>
Date: Tue Sep 16 10:30:47 2014 -0400
Removed binary from kvpvalues
It looks like the binary kvpvalue wasn't being used, and, since
it is difficult to deal with, it is easiest to remove it altogether.
diff --git a/src/app-utils/test/test-print-queries.c b/src/app-utils/test/test-print-queries.c
index 7c660a0..5415ec2 100644
--- a/src/app-utils/test/test-print-queries.c
+++ b/src/app-utils/test/test-print-queries.c
@@ -66,9 +66,6 @@ main_helper (void *closure, int argc, char **argv)
xaccLogDisable ();
- /* scm conversion doesn't handle binary atm */
- kvp_exclude_type (KVP_TYPE_BINARY);
-
run_tests (count);
print_test_results ();
diff --git a/src/app-utils/test/test-scm-query-string.c b/src/app-utils/test/test-scm-query-string.c
index 448f0e4..c3bb1a5 100644
--- a/src/app-utils/test/test-scm-query-string.c
+++ b/src/app-utils/test/test-scm-query-string.c
@@ -96,9 +96,6 @@ main_helper (void *closure, int argc, char **argv)
xaccLogDisable ();
- /* scm conversion doesn't handle binary atm */
- kvp_exclude_type (KVP_TYPE_BINARY);
-
/* double->string->double is not idempotent */
kvp_exclude_type (KVP_TYPE_DOUBLE);
diff --git a/src/backend/xml/io-gncxml-v1.c b/src/backend/xml/io-gncxml-v1.c
index 099ccd6..a17b9a4 100644
--- a/src/backend/xml/io-gncxml-v1.c
+++ b/src/backend/xml/io-gncxml-v1.c
@@ -616,152 +616,6 @@ guid_kvp_value_parser_new(void)
}
/*********************************/
-/* kvp-frame binary value handlers
-
- A binary chunk can have a variety of types of children, and these
- children may appear multiple times, but at the moment only <hex>
- children are supported. The end handler has to take all the
- children's results, concatenate them into one big kvp_value, and
- return it.
-
- All of the children ATM are expected to return binary kvp_values. */
-
-/* <hex> (lineage <binary> <s> <kvp-frame>)
- input: NA
- returns: binary kvp_value
-
- start: NA
- chars: generic_accumulate_chars
- end: convert the chars from hex to binary data and return binary kvp_value.
-
- cleanup-result: kvp_value_delete
- cleanup-chars: g_free chars
- fail: NA
- result-fail: kvp_value_delete
- chars-fail: g_free chars
-
- */
-
-static gboolean
-hex_binary_kvp_value_end_handler(gpointer data_for_children,
- GSList *data_from_children, GSList *sibling_data,
- gpointer parent_data, gpointer global_data,
- gpointer *result, const gchar *tag)
-{
- gchar *txt = NULL;
- void *val;
- guint64 size;
- kvp_value *kvpv;
- gboolean ok;
-
- txt = concatenate_child_result_chars(data_from_children);
- g_return_val_if_fail(txt, FALSE);
-
- ok = hex_string_to_binary(txt, &val, &size);
- g_free(txt);
-
- g_return_val_if_fail(ok, FALSE);
-
- kvpv = kvp_value_new_binary_nc(val, size);
- g_return_val_if_fail(kvpv, FALSE);
-
- *result = kvpv;
- return(TRUE);
-}
-
-static sixtp*
-hex_binary_kvp_value_parser_new(void)
-{
- return(simple_kvp_value_parser_new(hex_binary_kvp_value_end_handler));
-}
-
-/* <binary> (lineage <s> <kvp-frame>)
- input: NA
- returns: binary kvp_value*
-
- start: NA
- chars: allow_and_ignore_only_whitespace.
- end: concatenate all the binary data from the children -> kvp_value.
-
- cleanup-result: kvp_value_delete
- cleanup-chars: NA
- fail: NA
- result-fail: kvp_value_delete
- chars-fail: NA
-
- */
-
-static gboolean
-kvp_frame_binary_end_handler(gpointer data_for_children,
- GSList *data_from_children, GSList *sibling_data,
- gpointer parent_data, gpointer global_data,
- gpointer *result, const gchar *tag)
-{
- char *data;
- guint64 total_size;
- guint64 pos;
- kvp_value *kvpv;
- GSList *lp;
-
- /* at this point, we know that if there are child results, they all
- have to be binary kvp_values. */
-
- /* first see how much data we've got. */
- total_size = 0;
- for (lp = data_from_children; lp; lp = lp->next)
- {
- sixtp_child_result *cr = (sixtp_child_result *) lp->data;
- kvp_value *kvp = (kvp_value *) cr->data;
- void *tmpdata;
- guint64 tmpsize;
-
- tmpdata = kvp_value_get_binary(kvp, &tmpsize);
- g_return_val_if_fail(tmpdata, FALSE);
- total_size += tmpsize;
- }
-
- /* allocate a chunk to hold it all and copy */
- data = g_new(gchar, total_size);
- g_return_val_if_fail(data, FALSE);
-
- pos = 0;
- for (lp = data_from_children; lp; lp = lp->next)
- {
- sixtp_child_result *cr = (sixtp_child_result *) lp->data;
- kvp_value *kvp = (kvp_value *) cr->data;
- void *new_data;
- guint64 new_size;
-
- new_data = kvp_value_get_binary(kvp, &new_size);
- g_return_val_if_fail(new_data, FALSE);
- memcpy((data + pos), new_data, new_size);
- pos += new_size;
- }
-
- kvpv = kvp_value_new_binary_nc(data, total_size);
- g_return_val_if_fail(kvpv, FALSE);
-
- *result = kvpv;
- return(TRUE);
-}
-
-static sixtp*
-binary_kvp_value_parser_new(void)
-{
- return sixtp_add_some_sub_parsers(
- sixtp_set_any(sixtp_new(), FALSE,
- SIXTP_CHARACTERS_HANDLER_ID,
- allow_and_ignore_only_whitespace,
- SIXTP_END_HANDLER_ID, kvp_frame_binary_end_handler,
- SIXTP_CLEANUP_RESULT_ID, kvp_value_result_cleanup,
- SIXTP_RESULT_FAIL_ID, kvp_value_result_cleanup,
- SIXTP_NO_MORE_HANDLERS),
- TRUE,
- "hex", hex_binary_kvp_value_parser_new(),
- NULL, NULL);
-}
-
-/*********************************/
/* glist kvp-value handler
*/
@@ -835,7 +689,6 @@ add_all_kvp_value_parsers_as_sub_nodes(sixtp *p,
KVP_TOKEN(gnc_numeric, "numeric");
KVP_TOKEN(string, "string");
KVP_TOKEN(guid, "guid");
- KVP_TOKEN(binary, "binary");
sixtp_add_sub_parser(p, "glist", glist_parser);
sixtp_add_sub_parser(p, "frame", kvp_frame_parser);
diff --git a/src/backend/xml/sixtp-dom-generators.c b/src/backend/xml/sixtp-dom-generators.c
index 2f2df24..c6518bb 100644
--- a/src/backend/xml/sixtp-dom-generators.c
+++ b/src/backend/xml/sixtp-dom-generators.c
@@ -325,18 +325,6 @@ add_kvp_value_node(xmlNodePtr node, gchar *tag, kvp_value* val)
break;
case KVP_TYPE_GDATE:
xmlSetProp(val_node, BAD_CAST "type", BAD_CAST "gdate");
- break;
- case KVP_TYPE_BINARY:
- {
- guint64 size;
- gchar *tmp_str1;
- void *binary_data = kvp_value_get_binary(val, &size);
- xmlSetProp(val_node, BAD_CAST "type", BAD_CAST "binary");
- g_return_if_fail(binary_data);
- tmp_str1 = binary_to_string(binary_data, size);
- xmlNodeSetContent(val_node, checked_char_cast (tmp_str1));
- g_free(tmp_str1);
- }
break;
case KVP_TYPE_GLIST:
{
diff --git a/src/backend/xml/sixtp-dom-parsers.c b/src/backend/xml/sixtp-dom-parsers.c
index 31803ab..4e5a71f 100644
--- a/src/backend/xml/sixtp-dom-parsers.c
+++ b/src/backend/xml/sixtp-dom-parsers.c
@@ -304,30 +304,6 @@ string_to_binary(const gchar *str, void **v, guint64 *data_len)
}
kvp_value*
-dom_tree_to_binary_kvp_value(xmlNodePtr node)
-{
- gchar *text;
- void *val;
- guint64 len;
- kvp_value *ret = NULL;
-
- text = dom_tree_to_text(node);
-
- if (string_to_binary(text, &val, &len))
- {
- ret = kvp_value_new_binary_nc(val, len);
- }
- else
- {
- PERR("string_to_binary returned false");
- }
-
- g_free(text);
-
- return ret;
-}
-
-kvp_value*
dom_tree_to_list_kvp_value(xmlNodePtr node)
{
GList *list = NULL;
@@ -387,7 +363,6 @@ struct kvp_val_converter val_converters[] =
{ "guid", dom_tree_to_guid_kvp_value },
{ "timespec", dom_tree_to_timespec_kvp_value },
{ "gdate", dom_tree_to_gdate_kvp_value },
- { "binary", dom_tree_to_binary_kvp_value },
{ "list", dom_tree_to_list_kvp_value },
{ "frame", dom_tree_to_frame_kvp_value },
{ 0, 0 },
diff --git a/src/backend/xml/test/test-string-converters.c b/src/backend/xml/test/test-string-converters.c
index 6df3c95..bed4792 100644
--- a/src/backend/xml/test/test-string-converters.c
+++ b/src/backend/xml/test/test-string-converters.c
@@ -14,65 +14,6 @@
#define GNC_V2_STRING "gnc-v2"
const gchar *gnc_v2_xml_version_string = GNC_V2_STRING;
-static void
-test_binary()
-{
- int i;
- for (i = 0; i < 20; i++)
- {
- bin_data *test_data1;
- void *test_data2;
- guint64 test_data2_len;
- gchar *converted;
-
- test_data1 = get_random_binary_data();
-
- converted = binary_to_string(test_data1->data, test_data1->len);
-
- if (!converted)
- {
- failure_args("binary_data", __FILE__, __LINE__, "binary_to_string returned NULL");
- continue;
- }
-
- if (!string_to_binary(converted, &test_data2, &test_data2_len))
- {
- failure_args("binary_data", __FILE__, __LINE__,
- "string_to_binary returned FALSE with data:\n%s\n",
- converted);
- continue;
- }
-
- if (test_data2_len != test_data1->len)
- {
- failure_args("binary_data", __FILE__, __LINE__,
- "lengths don't match: %" G_GINT64_FORMAT " vs %d",
- test_data2_len, test_data1->len);
- continue;
- }
-
- {
- int j;
- guchar *d1 = test_data1->data;
- guchar *d2 = (guchar*)test_data2;
-
- for (j = 0; j < test_data2_len; j++)
- {
- if (d1[j] != d2[j])
- {
- failure_args("binary_data", __FILE__, __LINE__,
- "data doesn't match at point %d.\n%d vs %d",
- i, d1[j], d2[j]);
- continue;
- }
- }
- }
-
- success("binary_data");
- }
-}
-
-
static char *test_strings[] =
{
"FooBar",
@@ -121,7 +62,6 @@ int
main(int argc, char **argv)
{
qof_log_init();
- test_binary();
fflush(stdout);
test_string_converters();
test_bad_string ();
diff --git a/src/engine/engine-helpers.c b/src/engine/engine-helpers.c
index 400909c..2864a6a 100644
--- a/src/engine/engine-helpers.c
+++ b/src/engine/engine-helpers.c
@@ -764,10 +764,6 @@ gnc_kvp_value2scm (const KvpValue *value)
scm = gnc_timespec2timepair (kvp_value_get_timespec (value));
break;
- case KVP_TYPE_BINARY:
- scm = SCM_BOOL_F;
- break;
-
case KVP_TYPE_NUMERIC:
{
gnc_numeric n = kvp_value_get_numeric (value);
@@ -901,10 +897,6 @@ gnc_scm2KvpValue (SCM value_scm)
break;
}
- case KVP_TYPE_BINARY:
- return NULL;
- break;
-
case KVP_TYPE_NUMERIC:
{
gnc_numeric n;
diff --git a/src/engine/kvp-scm.c b/src/engine/kvp-scm.c
index 0036022..52522a3 100644
--- a/src/engine/kvp-scm.c
+++ b/src/engine/kvp-scm.c
@@ -62,7 +62,6 @@ gnc_scm_to_kvp_value_ptr(SCM val)
#undef FUNC_NAME
return kvp_value_new_frame (frame);
}
- /* FIXME: add binary handler here when it's figured out */
/* FIXME: add list handler here */
return NULL;
}
@@ -107,7 +106,6 @@ gnc_kvp_value_ptr_to_scm(KvpValue* val)
return gnc_timespec2timepair(gdate_to_timespec(kvp_value_get_gdate(val)));
/* FIXME: handle types below */
- case KVP_TYPE_BINARY:
case KVP_TYPE_GLIST:
default:
break;
diff --git a/src/engine/test-core/test-engine-stuff.c b/src/engine/test-core/test-engine-stuff.c
index 3f11376..bb75422 100644
--- a/src/engine/test-core/test-engine-stuff.c
+++ b/src/engine/test-core/test-engine-stuff.c
@@ -208,7 +208,7 @@ get_random_glist(void)
}
/* ========================================================== */
-/* Time/Date, GncGUID, binary data stuff */
+/* Time/Date, GncGUID data stuff */
Timespec*
get_random_timespec(void)
@@ -248,25 +248,6 @@ get_random_guid(void)
return ret;
}
-bin_data*
-get_random_binary_data(void)
-{
- int len;
- bin_data *ret;
-
- len = get_random_int_in_range(20, 100);
- ret = g_new(bin_data, 1);
- ret->data = g_new(guchar, len);
- ret->len = len;
-
- for (len--; len >= 0; len--)
- {
- ret->data[len] = (guchar)get_random_int_in_range(0, 255);
- }
-
- return ret;
-}
-
/* ========================================================== */
/* KVP stuff */
@@ -340,16 +321,6 @@ get_random_kvp_value_depth (int type, gint depth)
}
break;
- case KVP_TYPE_BINARY:
- {
- bin_data *tmp_data;
- tmp_data = get_random_binary_data();
- ret = kvp_value_new_binary(tmp_data->data, tmp_data->len);
- g_free(tmp_data->data);
- g_free(tmp_data);
- }
- break;
-
case KVP_TYPE_GLIST:
ret = kvp_value_new_glist_nc(get_random_glist_depth (depth + 1));
break;
diff --git a/src/engine/test/test-scm-query.c b/src/engine/test/test-scm-query.c
index 8d9b0bc..388d1f7 100644
--- a/src/engine/test/test-scm-query.c
+++ b/src/engine/test/test-scm-query.c
@@ -67,9 +67,6 @@ main_helper (void *closure, int argc, char **argv)
xaccLogDisable ();
- /* scm conversion doesn't handle binary atm */
- kvp_exclude_type (KVP_TYPE_BINARY);
-
run_tests ();
print_test_results ();
diff --git a/src/libqof/qof/kvp_frame.cpp b/src/libqof/qof/kvp_frame.cpp
index 8d2fd84..5bd0b27 100644
--- a/src/libqof/qof/kvp_frame.cpp
+++ b/src/libqof/qof/kvp_frame.cpp
@@ -50,13 +50,6 @@ struct _KvpFrame
GHashTable * hash;
};
-
-typedef struct
-{
- void *data;
- int datasize;
-} KvpValueBinaryData;
-
struct _KvpValue
{
KvpValueType type;
@@ -68,7 +61,6 @@ struct _KvpValue
gchar *str;
GncGUID *guid;
Timespec timespec;
- KvpValueBinaryData binary;
GList *list;
KvpFrame *frame;
GDate gdate;
@@ -995,33 +987,6 @@ kvp_value_new_gdate(GDate value)
}
KvpValue *
-kvp_value_new_binary(const void * value, guint64 datasize)
-{
- KvpValue * retval;
- if (!value) return NULL;
-
- retval = g_new0(KvpValue, 1);
- retval->type = KVP_TYPE_BINARY;
- retval->value.binary.data = g_new0(char, datasize);
- retval->value.binary.datasize = datasize;
- memcpy(retval->value.binary.data, value, datasize);
- return retval;
-}
-
-KvpValue *
-kvp_value_new_binary_nc(void * value, guint64 datasize)
-{
- KvpValue * retval;
- if (!value) return NULL;
-
- retval = g_new0(KvpValue, 1);
- retval->type = KVP_TYPE_BINARY;
- retval->value.binary.data = value;
- retval->value.binary.datasize = datasize;
- return retval;
-}
-
-KvpValue *
kvp_value_new_glist(const GList * value)
{
KvpValue * retval;
@@ -1082,9 +1047,6 @@ kvp_value_delete(KvpValue * value)
case KVP_TYPE_GUID:
g_free(value->value.guid);
break;
- case KVP_TYPE_BINARY:
- g_free(value->value.binary.data);
- break;
case KVP_TYPE_GLIST:
kvp_glist_delete(value->value.list);
break;
@@ -1200,30 +1162,6 @@ kvp_value_get_gdate(const KvpValue * value)
return date;
}
-void *
-kvp_value_get_binary(const KvpValue * value, guint64 * size_return)
-{
- if (!value)
- {
- if (size_return)
- *size_return = 0;
- return NULL;
- }
-
- if (value->type == KVP_TYPE_BINARY)
- {
- if (size_return)
- *size_return = value->value.binary.datasize;
- return value->value.binary.data;
- }
- else
- {
- if (size_return)
- *size_return = 0;
- return NULL;
- }
-}
-
GList *
kvp_value_get_glist(const KvpValue * value)
{
@@ -1306,10 +1244,6 @@ kvp_value_copy(const KvpValue * value)
case KVP_TYPE_TIMESPEC:
return kvp_value_new_timespec(value->value.timespec);
break;
- case KVP_TYPE_BINARY:
- return kvp_value_new_binary(value->value.binary.data,
- value->value.binary.datasize);
- break;
case KVP_TYPE_GLIST:
return kvp_value_new_glist(value->value.list);
break;
@@ -1384,15 +1318,6 @@ kvp_value_compare(const KvpValue * kva, const KvpValue * kvb)
case KVP_TYPE_GDATE:
return g_date_compare(&(kva->value.gdate), &(kvb->value.gdate));
break;
- case KVP_TYPE_BINARY:
- /* I don't know that this is a good compare. Ab is bigger than Acef.
- But I'm not sure that actually matters here. */
- if (kva->value.binary.datasize < kvb->value.binary.datasize) return -1;
- if (kva->value.binary.datasize > kvb->value.binary.datasize) return 1;
- return memcmp(kva->value.binary.data,
- kvb->value.binary.data,
- kva->value.binary.datasize);
- break;
case KVP_TYPE_GLIST:
return kvp_glist_compare(kva->value.list, kvb->value.list);
break;
@@ -1461,23 +1386,6 @@ kvp_frame_compare(const KvpFrame *fa, const KvpFrame *fb)
return(-status.compare);
}
-gchar*
-binary_to_string(const void *data, guint32 size)
-{
- GString *output;
- guint32 i;
- guchar *data_str = (guchar*)data;
-
- output = g_string_sized_new(size * sizeof(char));
-
- for (i = 0; i < size; i++)
- {
- g_string_append_printf(output, "%02x", (unsigned int) (data_str[i]));
- }
-
- return output->str;
-}
-
static gchar*
kvp_value_glist_to_string(const GList *list)
{
@@ -1580,16 +1488,6 @@ kvp_value_to_string(const KvpValue *val)
tmp2 = g_strdup_printf("KVP_VALUE_TIMESPEC(%s)", tmp1);
g_free(tmp1);
return tmp2;
- break;
-
- case KVP_TYPE_BINARY:
- {
- guint64 len;
- void *data;
- data = kvp_value_get_binary(val, &len);
- tmp1 = binary_to_string(data, len);
- return g_strdup_printf("KVP_VALUE_BINARY(%s)", tmp1 ? tmp1 : "");
- }
break;
case KVP_TYPE_GLIST:
@@ -1728,11 +1626,6 @@ gvalue_from_kvp_value (KvpValue *kval)
tm = kvp_value_get_timespec (kval);
g_value_set_boxed (val, &tm);
break;
- case KVP_TYPE_BINARY:
- PWARN ("Error! Don't use Kvp Binary!");
- g_slice_free (GValue, val);
- val = NULL;
- break;
case KVP_TYPE_GDATE:
g_value_init (val, G_TYPE_DATE);
gdate = kvp_value_get_gdate (kval);
diff --git a/src/libqof/qof/kvp_frame.h b/src/libqof/qof/kvp_frame.h
index 12f9ab5..d92ce2a 100644
--- a/src/libqof/qof/kvp_frame.h
+++ b/src/libqof/qof/kvp_frame.h
@@ -99,7 +99,6 @@ typedef enum
KVP_TYPE_STRING, /**< QOF_TYPE_STRING gchar* */
KVP_TYPE_GUID, /**< QOF_TYPE_GUID */
KVP_TYPE_TIMESPEC, /**< QOF_TYPE_DATE */
- KVP_TYPE_BINARY, /**< no QOF equivalent. */
KVP_TYPE_GLIST, /**< no QOF equivalent. */
KVP_TYPE_FRAME /**< no QOF equivalent. */
, KVP_TYPE_GDATE /**< no QOF equivalent. */
@@ -270,7 +269,7 @@ void kvp_frame_add_frame_nc(KvpFrame *frame, const gchar *path, KvpFrame *chld);
If any part of the path does not exist, then NULL or zero will be
returned.
- The values returned for GncGUID, binary, GList, KvpFrame and string
+ The values returned for GncGUID, GList, KvpFrame and string
are "non-copying" -- the returned item is the actual item stored.
Do not delete this item unless you take the required care to avoid
possible bad pointer derefrences (i.e. core dumps). Also, be
@@ -278,7 +277,7 @@ void kvp_frame_add_frame_nc(KvpFrame *frame, const gchar *path, KvpFrame *chld);
at the same path names: the referenced item will be freed during
the store.
- That is, if you get a string value (or guid, binary or frame),
+ That is, if you get a string value (or guid or frame),
and then store something else at that path, the string that you've
gotten will be freed during the store (internally, by the set_*()
routines), and you will be left hanging onto an invalid pointer.
@@ -466,7 +465,6 @@ KvpValue * kvp_value_new_numeric(gnc_numeric value);
KvpValue * kvp_value_new_string(const gchar * value);
KvpValue * kvp_value_new_guid(const GncGUID * guid);
KvpValue * kvp_value_new_timespec(Timespec timespec);
-KvpValue * kvp_value_new_binary(const void * data, guint64 datasize);
KvpValue * kvp_value_new_frame(const KvpFrame * value);
KvpValue * kvp_value_new_gdate(GDate date);
@@ -474,10 +472,6 @@ KvpValue * kvp_value_new_gdate(GDate date);
* confused with GList's of something else!) */
KvpValue * kvp_value_new_glist(const GList * value);
-/** value constructors (non-copying - KvpValue takes pointer ownership)
- values *must* have been allocated via glib allocators! (gnew, etc.) */
-KvpValue * kvp_value_new_binary_nc(void * data, guint64 datasize);
-
/** Creates a KvpValue from a <b>GList of kvp_value's</b>! (Not to be
* confused with GList's of something else!)
*
@@ -514,7 +508,7 @@ GList * kvp_value_replace_glist_nc(KvpValue *value, GList *newlist);
KvpValueType kvp_value_get_type(const KvpValue * value);
-/** Value accessors. Those for GncGUID, binary, GList, KvpFrame and
+/** Value accessors. Those for GncGUID, GList, KvpFrame and
* string are non-copying -- the caller can modify the value
* directly. Just don't free it, or you screw up everything.
* Note that if another value is stored at the key location
@@ -536,11 +530,6 @@ char * kvp_value_get_string(const KvpValue * value);
* the value directly. */
GncGUID * kvp_value_get_guid(const KvpValue * value);
-/** Value accessor. This one is non-copying -- the caller can modify
- * the value directly. */
-void * kvp_value_get_binary(const KvpValue * value,
- guint64 * size_return);
-
/** Returns the GList of kvp_frame's (not to be confused with GList's
* of something else!) from the given kvp_frame. This one is
* non-copying -- the caller can modify the value directly. */
@@ -569,11 +558,6 @@ itself a debugging and development utility function.
*/
gchar* kvp_value_to_string(const KvpValue *val);
-/** Manipulator:
- *
- * copying - but more efficient than creating a new KvpValue manually. */
-gboolean kvp_value_binary_append(KvpValue *v, void *data, guint64 size);
-
/** @name Iterators
@{
*/
@@ -591,7 +575,6 @@ void kvp_frame_for_each_slot(KvpFrame *f,
/** Internal helper routines, you probably shouldn't be using these. */
gchar* kvp_frame_to_string(const KvpFrame *frame);
-gchar* binary_to_string(const void *data, guint32 size);
GHashTable* kvp_frame_get_hash(const KvpFrame *frame);
/** KvpItem: GValue Exchange
diff --git a/src/libqof/qof/test/test-kvp_frame.c b/src/libqof/qof/test/test-kvp_frame.c
index d173065..0ca7a3c 100644
--- a/src/libqof/qof/test/test-kvp_frame.c
+++ b/src/libqof/qof/test/test-kvp_frame.c
@@ -873,20 +873,12 @@ test_kvp_value_compare( void )
static void
test_kvp_value_new_foo_nc( void )
{
- KvpValue *binary_value_nc, *glist_value_nc, *frame_value_nc;
+ KvpValue *glist_value_nc, *frame_value_nc;
void *val;
guint64 size;
GList *list = NULL;
KvpFrame *frame = NULL;
- g_test_message( "Test new binary values are not copied" );
- val = g_new0( char, 5 );
- size = sizeof( val );
- binary_value_nc = kvp_value_new_binary_nc( val, size );
- g_assert( binary_value_nc );
- g_assert( kvp_value_get_type( binary_value_nc ) == KVP_TYPE_BINARY );
- g_assert( kvp_value_get_binary( binary_value_nc, &size ) == val );
-
g_test_message( "Test new glist is not copied" );
list = g_list_append( list, kvp_value_new_gint64( 2 ) );
g_assert_cmpint( g_list_length( list ), == , 1 );
@@ -902,7 +894,6 @@ test_kvp_value_new_foo_nc( void )
g_assert( kvp_value_get_type( frame_value_nc ) == KVP_TYPE_FRAME );
g_assert( kvp_value_get_frame( frame_value_nc ) == frame );
- kvp_value_delete( binary_value_nc );
kvp_value_delete( glist_value_nc );
kvp_value_delete( frame_value_nc );
}
@@ -956,28 +947,6 @@ test_kvp_frame_compare( Fixture *fixture, gconstpointer pData )
}
static void
-test_binary_to_string( void )
-{
- gchar *result;
- guchar *val;
- guint32 size;
- val = g_new0( guchar, 5 );
- size = 5 * sizeof( guchar );
- val[0] = (guchar) 0;
- val[1] = (guchar) 9;
- val[2] = (guchar) 10;
- val[3] = (guchar) 255;
- val[4] = (guchar) 256;
-
- result = binary_to_string( val, size );
- g_assert( result );
- g_assert_cmpstr( result, == , "00090aff00" );
-
- g_free( val );
- g_free( result );
-}
-
-static void
test_kvp_value_to_string( void )
{
gchar guidstr[GUID_ENCODING_LENGTH+1];
@@ -1696,7 +1665,6 @@ test_suite_kvp_frame( void )
GNC_TEST_ADD_FUNC( suitename, "kvp value compare", test_kvp_value_compare );
GNC_TEST_ADD_FUNC( suitename, "kvp value new foo no copy", test_kvp_value_new_foo_nc );
GNC_TEST_ADD( suitename, "kvp frame compare", Fixture, NULL, setup, test_kvp_frame_compare, teardown );
- GNC_TEST_ADD_FUNC( suitename, "binary to string", test_binary_to_string );
GNC_TEST_ADD_FUNC( suitename, "kvp value to string", test_kvp_value_to_string );
GNC_TEST_ADD( suitename, "kvp frame to string", Fixture, NULL, setup, test_kvp_frame_to_string, teardown );
GNC_TEST_ADD( suitename, "kvp frame set slot path", Fixture, NULL, setup, test_kvp_frame_set_slot_path, teardown );
Summary of changes:
src/app-utils/test/test-print-queries.c | 3 -
src/app-utils/test/test-scm-query-string.c | 3 -
src/backend/xml/io-gncxml-v1.c | 147 --------------------------
src/backend/xml/sixtp-dom-generators.c | 12 ---
src/backend/xml/sixtp-dom-parsers.c | 25 -----
src/backend/xml/test/test-string-converters.c | 60 -----------
src/engine/engine-helpers.c | 8 --
src/engine/kvp-scm.c | 2 -
src/engine/test-core/test-engine-stuff.c | 31 +-----
src/engine/test/test-scm-query.c | 3 -
src/libqof/qof/kvp_frame.cpp | 107 -------------------
src/libqof/qof/kvp_frame.h | 23 +---
src/libqof/qof/test/test-kvp_frame.c | 34 +-----
13 files changed, 5 insertions(+), 453 deletions(-)
More information about the gnucash-changes
mailing list