From ab2dc25202d04c83adb24b5bf8df231ddd2a7414 Mon Sep 17 00:00:00 2001 From: Stathis Kamperis Date: Sun, 27 Jan 2008 12:17:35 +0100 Subject: [PATCH] Use prop_number_t for blocks' size --- proplib/prop_du.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/proplib/prop_du.c b/proplib/prop_du.c index cd06838..29bdd49 100644 --- a/proplib/prop_du.c +++ b/proplib/prop_du.c @@ -16,7 +16,7 @@ int main(void) int i, j, ret; FILE *fp; prop_dictionary_t pd; - prop_string_t ps; + prop_number_t pn; /* Initiate pipe stream to ``du'' */ fp = popen("du", "r"); @@ -46,11 +46,14 @@ int main(void) /* Trim '\n' from tokens[1] */ (tokens[1])[strlen(tokens[1]) - 1] = '\0'; - ps = prop_string_create_cstring(tokens[0]); - prop_dictionary_set(pd, tokens[1], ps); - prop_object_release(ps); - - printf("%s\n", s); + /* + * We use a signed prop_number_t object, so that + * when externalized it will be represented as decimal + * (unsigned numbers are externalized in base-16) + */ + pn = prop_number_create_integer(atoi(tokens[0])); + prop_dictionary_set(pd, tokens[1], pn); + prop_object_release(pn); } prop_dictionary_externalize_to_file(pd, "./data.xml"); -- 2.11.4.GIT