g_thread_pool_free(pool, FALSE, TRUE);
g_message("Pool finished");
- cw_puts(user_data.pri_f, "\n</metadata>\n");
- cw_puts(user_data.fil_f, "\n</filelists>\n");
- cw_puts(user_data.oth_f, "\n</otherdata>\n");
+ cw_puts(user_data.pri_f, "</metadata>");
+ cw_puts(user_data.fil_f, "</filelists>");
+ cw_puts(user_data.oth_f, "</otherdata>");
cw_close(user_data.pri_f);
cw_close(user_data.fil_f);
// Write xml footers
- cw_puts(pri_f, "\n</metadata>\n");
- cw_puts(fil_f, "\n</filelists>\n");
- cw_puts(oth_f, "\n</otherdata>\n");
+ cw_puts(pri_f, "</metadata>");
+ cw_puts(fil_f, "</filelists>");
+ cw_puts(oth_f, "</otherdata>");
// Close files
#define RPM_NS "http://linux.duke.edu/metadata/rpm"
#define XMLNS_NS "http://linux.duke.edu/metadata/repo"
-#define FORMAT_XML 1
+#define XML_ENC "UTF-8"
+#define FORMAT_XML 1
#define REPOMD_OK 0
#define REPOMD_ERR 1
// Dump IT!
char *result;
- xmlDocDumpFormatMemory(doc, (xmlChar **) &result, NULL, FORMAT_XML);
+ //xmlDocDumpFormatMemory(doc, (xmlChar **) &result, NULL, FORMAT_XML);
+ xmlDocDumpFormatMemoryEnc(doc, (xmlChar **) &result, NULL, XML_ENC, FORMAT_XML);
// Clean up
#undef MODULE
#define MODULE "xml_dump_filelists: "
-#define FORMAT_XML 1
+#define FORMAT_XML 1
+#define FORMAT_LEVEL 0
void dump_filelists_items(xmlNodePtr root, Package *package)
return NULL;
}
// Seems to be little bit faster than xmlDocDumpFormatMemory
- xmlNodeDump(buf, NULL, root, 1, FORMAT_XML);
+ xmlNodeDump(buf, NULL, root, FORMAT_LEVEL, FORMAT_XML);
assert(buf->content);
- result = g_strdup((char *) buf->content);
+ result = g_strndup((char *) buf->content, (buf->use+1)); // g_strndup allocate (buf->use+1
+ result[buf->use] = '\n';
+ result[buf->use+1] = '\0';
xmlBufferFree(buf);
#undef MODULE
#define MODULE "xml_dump_other: "
-#define FORMAT_XML 1
+#define FORMAT_XML 1
+#define FORMAT_LEVEL 0
#define DATE_MAX_LEN 32
return NULL;
}
// Seems to be little bit faster than xmlDocDumpFormatMemory
- xmlNodeDump(buf, NULL, root, 1, FORMAT_XML);
+ xmlNodeDump(buf, NULL, root, FORMAT_LEVEL, FORMAT_XML);
assert(buf->content);
- result = g_strdup((char *) buf->content);
+ result = g_strndup((char *) buf->content, (buf->use+1)); // g_strndup allocate (buf->use+1
+ result[buf->use] = '\n';
+ result[buf->use+1] = '\0';
xmlBufferFree(buf);
#define OBSOLETES 2
#define REQUIRES 3
-#define FORMAT_XML 1
+#define FORMAT_XML 1
+#define FORMAT_LEVEL 0
#define DATE_STR_MAX_LEN 32
#define SIZE_STR_MAX_LEN 32
location = xmlNewChild(root, NULL, BAD_CAST "location", NULL);
- // Write location attribute href
- xmlNewProp(location, BAD_CAST "href", BAD_CAST ((package->location_href) ? package->location_href : ""));
-
- // Write location attribute base
+// Write location attribute base
if (package->location_base && package->location_base[0] != '\0') {
xmlNewProp(location, BAD_CAST "xml:base", BAD_CAST package->location_base);
}
+ // Write location attribute href
+ xmlNewProp(location, BAD_CAST "href", BAD_CAST ((package->location_href) ? package->location_href : ""));
+
/***********************************
Element: format
return NULL;
}
// Seems to be little bit faster than xmlDocDumpFormatMemory
- xmlNodeDump(buf, NULL, root, 1, FORMAT_XML);
+ xmlNodeDump(buf, NULL, root, FORMAT_LEVEL, FORMAT_XML);
assert(buf->content);
- result = g_strdup((char *) buf->content);
+ result = g_strndup((char *) buf->content, (buf->use+1)); // g_strndup allocate (buf->use+1)+1
+ result[buf->use] = '\n';
+ result[buf->use+1] = '\0';
xmlBufferFree(buf);