327 } |
327 } |
328 |
328 |
329 LocalResource* process_conflict(xmlTextReaderPtr reader) { |
329 LocalResource* process_conflict(xmlTextReaderPtr reader) { |
330 LocalResource *res = calloc(1, sizeof(LocalResource)); |
330 LocalResource *res = calloc(1, sizeof(LocalResource)); |
331 |
331 |
332 int path = 0; |
332 int field = 0; |
333 while(xmlTextReaderRead(reader)) { |
333 while(xmlTextReaderRead(reader)) { |
334 int type = xmlTextReaderNodeType(reader); |
334 int type = xmlTextReaderNodeType(reader); |
335 const xmlChar *name = xmlTextReaderConstName(reader); |
335 const xmlChar *name = xmlTextReaderConstName(reader); |
336 |
336 |
337 if(type == XML_READER_TYPE_ELEMENT) { |
337 if(type == XML_READER_TYPE_ELEMENT) { |
338 if(xstreq(name, "path")) { |
338 if(xstreq(name, "path")) { |
339 path = 1; |
339 field = 1; |
340 } |
340 } else if(xstreq(name, "source")) { |
341 } else if(type == XML_READER_TYPE_TEXT && path) { |
341 field = 2; |
|
342 } |
|
343 } else if(type == XML_READER_TYPE_TEXT) { |
342 const xmlChar *value = xmlTextReaderConstValue(reader); |
344 const xmlChar *value = xmlTextReaderConstValue(reader); |
343 res->path = strdup((char*)value); |
345 switch(field) { |
|
346 case 1: { |
|
347 res->path = strdup((const char*)value); |
|
348 break; |
|
349 } |
|
350 case 2: { |
|
351 res->conflict_source = strdup((const char*)value); |
|
352 break; |
|
353 } |
|
354 } |
344 } else if(XML_READER_TYPE_END_ELEMENT) { |
355 } else if(XML_READER_TYPE_END_ELEMENT) { |
345 if(xstreq(name, "conflict")) { |
356 if(xstreq(name, "conflict")) { |
346 break; |
357 break; |
347 } else { |
358 } else { |
348 path = 0; |
359 field = 0; |
349 } |
360 } |
350 } |
361 } |
351 } |
362 } |
352 |
363 |
353 if(!res->path) { |
364 if(!res->path) { |