| 427 | } |
| 428 | |
| 429 | static int |
| 430 | xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NCtxPtr ctx) { |
| 431 | int i; |
| 432 | const xmlChar *prefix; |
| 433 | const xmlChar *href; |
| 434 | int has_empty_ns; |
| 435 | |
| 436 | if(cur == NULL) { |
| 437 | xmlC14NErrParam(ctx); |
| 438 | return (0); |
| 439 | } |
| 440 | |
| 441 | /* |
| 442 | * if the default namespace xmlns="" is not defined yet then |
| 443 | * we do not want to print it out |
| 444 | */ |
| 445 | prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix; |
| 446 | href = ((ns == NULL) || (ns->href == NULL)) ? BAD_CAST "" : ns->href; |
| 447 | has_empty_ns = (xmlC14NStrEqual(prefix, NULL) && xmlC14NStrEqual(href, NULL)); |
| 448 | |
| 449 | if (cur->nsTab != NULL) { |
| 450 | int start = 0; |
| 451 | for (i = cur->nsCurEnd - 1; i >= start; --i) { |
| 452 | xmlNsPtr ns1 = cur->nsTab[i]; |
| 453 | |
| 454 | if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) { |
| 455 | if(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL)) { |
| 456 | return(xmlC14NIsVisible(ctx, ns1, cur->nodeTab[i])); |
| 457 | } else { |
| 458 | return(0); |
| 459 | } |
| 460 | } |
| 461 | } |
| 462 | } |
| 463 | return(has_empty_ns); |
| 464 | } |
| 465 | |
| 466 | |
| 467 |
no test coverage detected