Skip to content

Commit d03c01a

Browse files
ruebotgreebie
authored andcommitted
Use XML 1.0; resolves #26. (#41)
- Roll back to XML 1.0 from 1.1 introduced in d17b57c - Roll back to Gexf 1.2 from 1.3 introduced in d17b57c - Switch line ending encoding from \n to \x0A - Clean up whitespace in file
1 parent 050127b commit d03c01a

File tree

1 file changed

+72
-72
lines changed

1 file changed

+72
-72
lines changed

src/gexf.c

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright © 2018 Ryan Deschamps. All rights reserved.
77
//
88

9-
/** @file gexf.c
9+
/** @file gexf.c
1010
@brief Writes gexf files.
1111
*/
1212

@@ -48,10 +48,10 @@ int igraph_i_xml_escape(char* src, char** dest) {
4848
}
4949

5050
/** Writes a GEXF file
51-
51+
5252
GEXF provides great support for visualizations and is therefore used by a number
5353
of light-weight visualization tools like SigmaJS and Gephi.
54-
54+
5555
@param graph - the graph to write to gexf
5656
@param outstream - a file object
5757
@param prefixattr - if "true" will add prefixes to the gexf output.
@@ -72,37 +72,37 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
7272
const char *gprefix= prefixattr ? "g_" : "";
7373
const char *vprefix= prefixattr ? "v_" : "";
7474
const char *eprefix= prefixattr ? "e_" : "";
75-
76-
ret=fprintf(outstream, "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n");
75+
76+
ret=fprintf(outstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\x0A");
7777
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
78-
ret=fprintf(outstream, "<gexf xmlns=\"http://www.gexf.net/1.3draft\"\n");
78+
ret=fprintf(outstream, "<gexf xmlns=\"http://www.gexf.net/1.2draft\"\x0A");
7979
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
80-
ret=fprintf(outstream, " xmlns:viz=\"http://www.gexf.net/1.3draft/viz\"\n");
81-
ret=fprintf(outstream, " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
80+
ret=fprintf(outstream, " xmlns:viz=\"http://www.gexf.net/1.2draft/viz\"\x0A");
81+
ret=fprintf(outstream, " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\x0A");
8282
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
83-
ret=fprintf(outstream, " xsi:schemaLocation=\"http://www.gexf.net/1.3draft\n");
83+
ret=fprintf(outstream, " xsi:schemaLocation=\"http://www.gexf.net/1.2draft\x0A");
8484
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
85-
ret=fprintf(outstream, " http://www.gexf.net/1.3draft/gexf.xsd\"\n");
85+
ret=fprintf(outstream, " http://www.gexf.net/1.2draft/gexf.xsd\"\x0A");
8686
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
87-
ret=fprintf(outstream, " version=\"1.3\">\n");
87+
ret=fprintf(outstream, " version=\"1.2\">\x0A");
8888
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
89-
ret=fprintf(outstream, "<!-- Created by igraph -->\n");
89+
ret=fprintf(outstream, "<!-- Created by igraph -->\x0A");
9090
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
91-
ret=fprintf(outstream, "<meta lastmodifieddate=\"%.19s\">\n", ctime(&t));
91+
ret=fprintf(outstream, "<meta lastmodifieddate=\"%.19s\">\x0A", ctime(&t));
9292
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
93-
ret=fprintf(outstream, "<creator>Graphpass filtering using Igraph by Archives Unleashed</creator>\n");
93+
ret=fprintf(outstream, "<creator>Graphpass filtering using Igraph by Archives Unleashed</creator>\x0A");
9494
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
95-
ret=fprintf(outstream, "<description> A Filtered Derivative Graph</description>\n");
95+
ret=fprintf(outstream, "<description> A Filtered Derivative Graph</description>\x0A");
9696
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
97-
ret=fprintf(outstream, "</meta>\n");
97+
ret=fprintf(outstream, "</meta>\x0A");
9898
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
99-
99+
100100
/* dump the <key> elements if any */
101-
101+
102102
IGRAPH_VECTOR_INIT_FINALLY(&numv, 1);
103103
IGRAPH_STRVECTOR_INIT_FINALLY(&strv, 1);
104104
IGRAPH_VECTOR_BOOL_INIT_FINALLY(&boolv, 1);
105-
105+
106106
IGRAPH_STRVECTOR_INIT_FINALLY(&gnames, 0);
107107
IGRAPH_STRVECTOR_INIT_FINALLY(&vnames, 0);
108108
IGRAPH_STRVECTOR_INIT_FINALLY(&enames, 0);
@@ -113,77 +113,77 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
113113
&gnames, &gtypes,
114114
&vnames, &vtypes,
115115
&enames, &etypes);
116-
117-
ret=fprintf(outstream, " <graph id=\"G\" defaultedgetype=\"%s\">\n", (igraph_is_directed(graph)?"directed":"undirected"));
116+
117+
ret=fprintf(outstream, " <graph id=\"G\" defaultedgetype=\"%s\">\x0A", (igraph_is_directed(graph)?"directed":"undirected"));
118118
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
119-
119+
120120
/* graph attributes */
121-
ret=fprintf(outstream, " <attributes class=\"graph\">\n");
121+
ret=fprintf(outstream, " <attributes class=\"graph\">\x0A");
122122
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
123123
for (i=0; i<igraph_vector_size(&gtypes); i++) {
124124
char *name, *name_escaped;
125125
igraph_strvector_get(&gnames, i, &name);
126126
IGRAPH_CHECK(igraph_i_xml_escape(name, &name_escaped));
127127
if (VECTOR(gtypes)[i] == IGRAPH_ATTRIBUTE_STRING) {
128-
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"string\"/>\n", gprefix, name_escaped, name_escaped);
128+
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"string\"/>\x0A", gprefix, name_escaped, name_escaped);
129129
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
130130
} else if (VECTOR(gtypes)[i] == IGRAPH_ATTRIBUTE_NUMERIC) {
131-
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"double\"/>\n", gprefix, name_escaped, name_escaped);
131+
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"double\"/>\x0A", gprefix, name_escaped, name_escaped);
132132
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
133133
} else if (VECTOR(gtypes)[i] == IGRAPH_ATTRIBUTE_BOOLEAN) {
134-
ret=fprintf(outstream, " <attribute id=\"%s%s\" attr.title=\"%s\" type=\"boolean\"/>\n", gprefix, name_escaped, name_escaped);
134+
ret=fprintf(outstream, " <attribute id=\"%s%s\" attr.title=\"%s\" type=\"boolean\"/>\x0A", gprefix, name_escaped, name_escaped);
135135
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
136136
}
137137
igraph_Free(name_escaped);
138138
}
139-
ret=fprintf(outstream, " </attributes>\n");
139+
ret=fprintf(outstream, " </attributes>\x0A");
140140
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
141-
141+
142142
/* vertex attributes */
143-
ret=fprintf(outstream, " <attributes class=\"node\">\n");
143+
ret=fprintf(outstream, " <attributes class=\"node\">\x0A");
144144
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
145-
145+
146146
for (i=0; i<igraph_vector_size(&vtypes); i++) {
147147
char *name, *name_escaped;
148148
igraph_strvector_get(&vnames, i, &name);
149149
IGRAPH_CHECK(igraph_i_xml_escape(name, &name_escaped));
150150
if (VECTOR(vtypes)[i] == IGRAPH_ATTRIBUTE_STRING) {
151-
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"string\"></attribute>\n", vprefix, name_escaped, name_escaped);
151+
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"string\"></attribute>\x0A", vprefix, name_escaped, name_escaped);
152152
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
153153
} else if (VECTOR(vtypes)[i] == IGRAPH_ATTRIBUTE_NUMERIC) {
154-
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"double\"></attribute>\n", vprefix, name_escaped, name_escaped);
154+
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"double\"></attribute>\x0A", vprefix, name_escaped, name_escaped);
155155
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
156156
} else if (VECTOR(vtypes)[i] == IGRAPH_ATTRIBUTE_BOOLEAN) {
157-
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"boolean\"></attribute>\n", vprefix, name_escaped, name_escaped);
157+
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"boolean\"></attribute>\x0A", vprefix, name_escaped, name_escaped);
158158
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
159159
}
160160
igraph_Free(name_escaped);
161161
}
162-
ret=fprintf(outstream, " </attributes>\n");
162+
ret=fprintf(outstream, " </attributes>\x0A");
163163
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
164-
164+
165165
/* edge attributes */
166-
ret=fprintf(outstream, " <attributes class=\"edge\">\n");
166+
ret=fprintf(outstream, " <attributes class=\"edge\">\x0A");
167167
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
168168
for (i=0; i<igraph_vector_size(&etypes); i++) {
169169
char *name, *name_escaped;
170170
igraph_strvector_get(&enames, i, &name);
171171
IGRAPH_CHECK(igraph_i_xml_escape(name, &name_escaped));
172172
if (VECTOR(etypes)[i] == IGRAPH_ATTRIBUTE_STRING) {
173-
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"string\"/>\n", eprefix, name_escaped, name_escaped);
173+
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"string\"/>\x0A", eprefix, name_escaped, name_escaped);
174174
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
175175
} else if (VECTOR(etypes)[i] == IGRAPH_ATTRIBUTE_NUMERIC) {
176-
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"double\"/>\n", eprefix, name_escaped, name_escaped);
176+
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"double\"/>\x0A", eprefix, name_escaped, name_escaped);
177177
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
178178
} else if (VECTOR(etypes)[i] == IGRAPH_ATTRIBUTE_BOOLEAN) {
179-
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"boolean\"/>\n", eprefix, name_escaped, name_escaped);
179+
ret=fprintf(outstream, " <attribute id=\"%s%s\" title=\"%s\" type=\"boolean\"/>\x0A", eprefix, name_escaped, name_escaped);
180180
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
181181
}
182182
igraph_Free(name_escaped);
183183
}
184-
ret=fprintf(outstream, " </attributes>\n");
184+
ret=fprintf(outstream, " </attributes>\x0A");
185185
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
186-
186+
187187
/* Do not include graph attvalues for now but can add them later */
188188
/*
189189
for (i=0; i<igraph_vector_size(&gtypes); i++) {
@@ -223,9 +223,9 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
223223
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
224224
}
225225
}*/
226-
226+
227227
/* Let's dump the nodes first */
228-
ret=fprintf(outstream, " <nodes>\n");
228+
ret=fprintf(outstream, " <nodes>\x0A");
229229
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
230230
vc=igraph_vcount(graph);
231231
ec=igraph_ecount(graph);
@@ -237,7 +237,7 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
237237
igraph_vector_init(&y, vc);
238238
igraph_vector_init(&x, vc);
239239
igraph_vector_init(&size, vc);
240-
240+
241241
if (igraph_cattribute_has_attr(graph, IGRAPH_ATTRIBUTE_EDGE, "weight") == true) {
242242
EANV(graph, "weight", &weight);
243243
}
@@ -249,7 +249,7 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
249249
} else {
250250
printf ("No label information available on this graph.");
251251
}
252-
252+
253253
/*if ( VASV(graph, "label", &label) == 0 ){
254254
VASV(graph, "label", &label);
255255
} else if (VASV(graph, "name", &label) == 0) {
@@ -267,9 +267,9 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
267267
char *name, *name_escaped, *label, *label_escaped;
268268
igraph_strvector_get(&labels, l, &label);
269269
IGRAPH_CHECK(igraph_i_xml_escape(label, &label_escaped));
270-
ret=fprintf(outstream, " <node id=\"n%ld\" label=\"%s\">\n", (long)l, label_escaped ? label_escaped : "x");
270+
ret=fprintf(outstream, " <node id=\"n%ld\" label=\"%s\">\x0A", (long)l, label_escaped ? label_escaped : "x");
271271
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
272-
ret=fprintf(outstream, " <attvalues>\n");
272+
ret=fprintf(outstream, " <attvalues>\x0A");
273273
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
274274
for (i=0; i<igraph_vector_size(&vtypes); i++) {
275275
if (VECTOR(vtypes)[i] == IGRAPH_ATTRIBUTE_NUMERIC) {
@@ -278,7 +278,7 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
278278
igraph_vss_1(l), &numv));
279279
if (!isnan(VECTOR(numv)[0])) {
280280
IGRAPH_CHECK(igraph_i_xml_escape(name, &name_escaped));
281-
ret=fprintf(outstream, " <attvalue for=\"%s%s\" value=\"%g\" />\n",
281+
ret=fprintf(outstream, " <attvalue for=\"%s%s\" value=\"%g\" />\x0A",
282282
vprefix, name_escaped, VECTOR(numv)[0]);
283283
igraph_Free(name_escaped);
284284
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
@@ -294,36 +294,36 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
294294
igraph_vss_1(l), &strv));
295295
igraph_strvector_get(&strv, 0, &s);
296296
IGRAPH_CHECK(igraph_i_xml_escape(s, &s_escaped));
297-
ret=fprintf(outstream, "%s\" />\n", s_escaped);
297+
ret=fprintf(outstream, "%s\" />\x0A", s_escaped);
298298
igraph_Free(s_escaped);
299299
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
300300
} else if (VECTOR(vtypes)[i] == IGRAPH_ATTRIBUTE_BOOLEAN) {
301301
igraph_strvector_get(&vnames, i, &name);
302302
IGRAPH_CHECK(igraph_i_attribute_get_bool_vertex_attr(graph, name,
303303
igraph_vss_1(l), &boolv));
304304
IGRAPH_CHECK(igraph_i_xml_escape(name, &name_escaped));
305-
ret=fprintf(outstream, " <attvalue for=\"%s%s\" value=\"%s\" />\n",
305+
ret=fprintf(outstream, " <attvalue for=\"%s%s\" value=\"%s\" />\x0A",
306306
vprefix, name_escaped, VECTOR(boolv)[0] ? "true" : "false");
307307
igraph_Free(name_escaped);
308308
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
309309
}
310310
}
311-
ret=fprintf(outstream, " </attvalues>\n");
311+
ret=fprintf(outstream, " </attvalues>\x0A");
312312
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
313-
ret=fprintf(outstream, " <viz:color r=\"%i\" g=\"%i\" b=\"%i\"></viz:color>\n", (int)VECTOR(r)[l], (int)VECTOR(g)[l], (int)VECTOR(b)[l]);
313+
ret=fprintf(outstream, " <viz:color r=\"%i\" g=\"%i\" b=\"%i\"></viz:color>\x0A", (int)VECTOR(r)[l], (int)VECTOR(g)[l], (int)VECTOR(b)[l]);
314314
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
315-
ret=fprintf(outstream, " <viz:size value=\"%f\"></viz:size>\n", VECTOR(size)[l]);
315+
ret=fprintf(outstream, " <viz:size value=\"%f\"></viz:size>\x0A", VECTOR(size)[l]);
316316
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
317-
ret=fprintf(outstream, " <viz:position y=\"%f\" x=\"%f\" z=\"0.0\"></viz:position>\n", VECTOR(y)[l], VECTOR(x)[l]);
317+
ret=fprintf(outstream, " <viz:position y=\"%f\" x=\"%f\" z=\"0.0\"></viz:position>\x0A", VECTOR(y)[l], VECTOR(x)[l]);
318318
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
319-
ret=fprintf(outstream, " </node>\n");
319+
ret=fprintf(outstream, " </node>\x0A");
320320
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
321321
}
322-
ret=fprintf(outstream, " </nodes>\n");
322+
ret=fprintf(outstream, " </nodes>\x0A");
323323
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
324-
324+
325325
/* Now the edges */
326-
ret=fprintf(outstream, " <edges>\n");
326+
ret=fprintf(outstream, " <edges>\x0A");
327327
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
328328
IGRAPH_CHECK(igraph_eit_create(graph, igraph_ess_all(0), &it));
329329
IGRAPH_FINALLY(igraph_eit_destroy, &it);
@@ -332,20 +332,20 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
332332
char *name, *name_escaped;
333333
long int edge=IGRAPH_EIT_GET(it);
334334
igraph_edge(graph, (igraph_integer_t) edge, &from, &to);
335-
ret=fprintf(outstream, " <edge id=\"%ld\" source=\"n%ld\" target=\"n%ld\" weight=\"%f\">\n",
335+
ret=fprintf(outstream, " <edge id=\"%ld\" source=\"n%ld\" target=\"n%ld\" weight=\"%f\">\x0A",
336336
(long int)l, (long int)from, (long int)to, VECTOR(weight)[l] ? VECTOR(weight)[l] : 0.0);
337337
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
338-
ret=fprintf(outstream, " <attvalues>\n");
338+
ret=fprintf(outstream, " <attvalues>\x0A");
339339
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
340-
340+
341341
for (i=0; i<igraph_vector_size(&etypes); i++) {
342342
if (VECTOR(etypes)[i] == IGRAPH_ATTRIBUTE_NUMERIC) {
343343
igraph_strvector_get(&enames, i, &name);
344344
IGRAPH_CHECK(igraph_i_attribute_get_numeric_edge_attr(graph, name,
345345
igraph_ess_1((igraph_integer_t) edge), &numv));
346346
if (!isnan(VECTOR(numv)[0])) {
347347
IGRAPH_CHECK(igraph_i_xml_escape(name, &name_escaped));
348-
ret=fprintf(outstream, " <attvalue for=\"%s%s\" value=\"%g\"></attvalue>\n",
348+
ret=fprintf(outstream, " <attvalue for=\"%s%s\" value=\"%g\"></attvalue>\x0A",
349349
eprefix, name_escaped, VECTOR(numv)[0]);
350350
igraph_Free(name_escaped);
351351
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
@@ -361,36 +361,36 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
361361
igraph_ess_1((igraph_integer_t) edge), &strv));
362362
igraph_strvector_get(&strv, 0, &s);
363363
IGRAPH_CHECK(igraph_i_xml_escape(s, &s_escaped));
364-
ret=fprintf(outstream, "%s\"></attvalue>\n", s_escaped);
364+
ret=fprintf(outstream, "%s\"></attvalue>\x0A", s_escaped);
365365
igraph_Free(s_escaped);
366366
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
367367
} else if (VECTOR(etypes)[i] == IGRAPH_ATTRIBUTE_BOOLEAN) {
368368
igraph_strvector_get(&enames, i, &name);
369369
IGRAPH_CHECK(igraph_i_attribute_get_bool_edge_attr(graph, name,
370370
igraph_ess_1((igraph_integer_t) edge), &boolv));
371371
IGRAPH_CHECK(igraph_i_xml_escape(name, &name_escaped));
372-
ret=fprintf(outstream, " <attvalue for=\"%s%s\" value\"%s\"></attvalue>\n",
372+
ret=fprintf(outstream, " <attvalue for=\"%s%s\" value\"%s\"></attvalue>\x0A",
373373
eprefix, name_escaped, VECTOR(boolv)[0] ? "true" : "false");
374374
igraph_Free(name_escaped);
375375
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
376376
}
377377
}
378-
ret=fprintf(outstream, " </attvalues>\n");
378+
ret=fprintf(outstream, " </attvalues>\x0A");
379379
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
380-
ret=fprintf(outstream, " </edge>\n");
380+
ret=fprintf(outstream, " </edge>\x0A");
381381
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
382382
IGRAPH_EIT_NEXT(it);
383383
}
384-
ret=fprintf(outstream, " </edges>\n");
384+
ret=fprintf(outstream, " </edges>\x0A");
385385
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
386386
igraph_eit_destroy(&it);
387387
IGRAPH_FINALLY_CLEAN(1);
388-
389-
ret=fprintf(outstream, " </graph>\n");
388+
389+
ret=fprintf(outstream, " </graph>\x0A");
390390
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
391-
fprintf(outstream, "</gexf>\n");
391+
fprintf(outstream, "</gexf>\x0A");
392392
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
393-
393+
394394
igraph_strvector_destroy(&gnames);
395395
igraph_strvector_destroy(&vnames);
396396
igraph_strvector_destroy(&enames);
@@ -401,6 +401,6 @@ extern int igraph_write_graph_gexf(const igraph_t *graph, FILE *outstream,
401401
igraph_strvector_destroy(&strv);
402402
igraph_vector_bool_destroy(&boolv);
403403
IGRAPH_FINALLY_CLEAN(9);
404-
404+
405405
return 0;
406406
}

0 commit comments

Comments
 (0)