summaryrefslogtreecommitdiffstats
path: root/src/xplist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xplist.c')
-rw-r--r--src/xplist.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/xplist.c b/src/xplist.c
index 9a5698c..abc448d 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -49,7 +49,7 @@ const char *plist_base = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
49 * 49 *
50 * @return The formatted string. 50 * @return The formatted string.
51 */ 51 */
52char *format_string(const char *buf, int cols, int depth) 52static char *format_string(const char *buf, int cols, int depth)
53{ 53{
54 int colw = depth + cols + 1; 54 int colw = depth + cols + 1;
55 int len = strlen(buf); 55 int len = strlen(buf);
@@ -89,7 +89,7 @@ struct xml_node {
89 * 89 *
90 * @return The plist XML document. 90 * @return The plist XML document.
91 */ 91 */
92xmlDocPtr new_xml_plist() 92static xmlDocPtr new_xml_plist()
93{ 93{
94 char *plist = strdup(plist_base); 94 char *plist = strdup(plist_base);
95 xmlDocPtr plist_xml = xmlReadMemory(plist, strlen(plist), NULL, NULL, 0); 95 xmlDocPtr plist_xml = xmlReadMemory(plist, strlen(plist), NULL, NULL, 0);
@@ -106,7 +106,7 @@ xmlDocPtr new_xml_plist()
106 * 106 *
107 * @param plist The XML document to destroy. 107 * @param plist The XML document to destroy.
108 */ 108 */
109void free_plist(xmlDocPtr plist) 109static void free_plist(xmlDocPtr plist)
110{ 110{
111 if (!plist) 111 if (!plist)
112 return; 112 return;
@@ -114,7 +114,7 @@ void free_plist(xmlDocPtr plist)
114 xmlFreeDoc(plist); 114 xmlFreeDoc(plist);
115} 115}
116 116
117void node_to_xml(GNode * node, gpointer xml_struct) 117static void node_to_xml(GNode * node, gpointer xml_struct)
118{ 118{
119 if (!node) 119 if (!node)
120 return; 120 return;
@@ -125,8 +125,8 @@ void node_to_xml(GNode * node, gpointer xml_struct)
125 xmlNodePtr child_node = NULL; 125 xmlNodePtr child_node = NULL;
126 char isStruct = FALSE; 126 char isStruct = FALSE;
127 127
128 gchar *tag = NULL; 128 const gchar *tag = NULL;
129 gchar *val = NULL; 129 const gchar *val = NULL;
130 130
131 switch (node_data->type) { 131 switch (node_data->type) {
132 case PLIST_BOOLEAN: 132 case PLIST_BOOLEAN:
@@ -166,7 +166,7 @@ void node_to_xml(GNode * node, gpointer xml_struct)
166 case PLIST_DATA: 166 case PLIST_DATA:
167 tag = "data"; 167 tag = "data";
168 gchar *valtmp = g_base64_encode(node_data->buff, node_data->length); 168 gchar *valtmp = g_base64_encode(node_data->buff, node_data->length);
169 val = format_string(valtmp, 60, xstruct->depth); 169 val = format_string(valtmp, 68, xstruct->depth);
170 g_free(valtmp); 170 g_free(valtmp);
171 break; 171 break;
172 case PLIST_ARRAY: 172 case PLIST_ARRAY:
@@ -191,7 +191,7 @@ void node_to_xml(GNode * node, gpointer xml_struct)
191 g_free(val); 191 g_free(val);
192 192
193 //add return for structured types 193 //add return for structured types
194 if (node_data->type == PLIST_ARRAY || node_data->type == PLIST_DICT || node_data->type == PLIST_DATA) 194 if (node_data->type == PLIST_ARRAY || node_data->type == PLIST_DICT)
195 xmlNodeAddContent(child_node, "\n"); 195 xmlNodeAddContent(child_node, "\n");
196 196
197 if (isStruct) { 197 if (isStruct) {
@@ -199,7 +199,7 @@ void node_to_xml(GNode * node, gpointer xml_struct)
199 g_node_children_foreach(node, G_TRAVERSE_ALL, node_to_xml, &child); 199 g_node_children_foreach(node, G_TRAVERSE_ALL, node_to_xml, &child);
200 } 200 }
201 //fix indent for structured types 201 //fix indent for structured types
202 if (node_data->type == PLIST_ARRAY || node_data->type == PLIST_DICT || node_data->type == PLIST_DATA) { 202 if (node_data->type == PLIST_ARRAY || node_data->type == PLIST_DICT) {
203 203
204 for (i = 0; i < xstruct->depth; i++) { 204 for (i = 0; i < xstruct->depth; i++) {
205 xmlNodeAddContent(child_node, "\t"); 205 xmlNodeAddContent(child_node, "\t");