| 463 | } |
| 464 | |
| 465 | static int parse_xml_file(const char *filepath) |
| 466 | { |
| 467 | int n; |
| 468 | char buf[10240]; |
| 469 | ACL_VSTREAM *fp = acl_vstream_fopen(filepath, O_RDONLY, 0600, 8192); |
| 470 | ACL_XML *xml = acl_xml_alloc(); |
| 471 | |
| 472 | if (fp == NULL) { |
| 473 | printf("open %s error %s\r\n", filepath, acl_last_serror()); |
| 474 | acl_xml_free(xml); |
| 475 | return -1; |
| 476 | } |
| 477 | |
| 478 | ACL_METER_TIME("-------------begin--------------"); |
| 479 | while (1) { |
| 480 | n = acl_vstream_read(fp, buf, sizeof(buf) - 1); |
| 481 | if (n == ACL_VSTREAM_EOF) |
| 482 | break; |
| 483 | buf[n] = 0; |
| 484 | acl_xml_update(xml, buf); |
| 485 | } |
| 486 | ACL_METER_TIME("-------------end--------------"); |
| 487 | |
| 488 | acl_vstream_close(fp); |
| 489 | |
| 490 | if (acl_xml_is_complete(xml, "root")) |
| 491 | printf("Xml is complete OK, filepath: %s\r\n", filepath); |
| 492 | else |
| 493 | printf("Xml is not complete, filepath: %s\r\n", filepath); |
| 494 | acl_xml_free(xml); |
| 495 | |
| 496 | printf("Enter any key to continue ...\r\n"); |
| 497 | getchar(); |
| 498 | |
| 499 | return 0; |
| 500 | } |
| 501 | |
| 502 | static void test1(void) |
| 503 | { |
no test coverage detected
searching dependent graphs…